Snapshot: new training tasks (balanced generation), docs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
84
tasks_gen/train/G1913/faulty/m0_if_laundry_fee.intf.abap
Normal file
84
tasks_gen/train/G1913/faulty/m0_if_laundry_fee.intf.abap
Normal file
@@ -0,0 +1,84 @@
|
||||
INTERFACE {{p}}if_laundry_fee PUBLIC.
|
||||
TYPES ty_item TYPE c LENGTH 7.
|
||||
TYPES ty_service TYPE c LENGTH 4.
|
||||
TYPES ty_reason TYPE c LENGTH 10.
|
||||
TYPES ty_quantity TYPE i.
|
||||
TYPES ty_amount TYPE p LENGTH 7 DECIMALS 2.
|
||||
TYPES ty_flag TYPE abap_bool.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_order_line,
|
||||
item TYPE ty_item,
|
||||
service TYPE ty_service,
|
||||
quantity TYPE ty_quantity,
|
||||
express TYPE ty_flag,
|
||||
END OF ty_order_line.
|
||||
TYPES tt_order_line TYPE STANDARD TABLE OF ty_order_line WITH EMPTY KEY.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
item TYPE ty_reason VALUE 'ITEM',
|
||||
service TYPE ty_reason VALUE 'SERVICE',
|
||||
qty TYPE ty_reason VALUE 'QTY',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_item,
|
||||
shirt TYPE ty_item VALUE 'SHIRT',
|
||||
trousers TYPE ty_item VALUE 'TROUS',
|
||||
suit TYPE ty_item VALUE 'SUIT',
|
||||
coat TYPE ty_item VALUE 'COAT',
|
||||
dress TYPE ty_item VALUE 'DRESS',
|
||||
curtain TYPE ty_item VALUE 'CURTAIN',
|
||||
END OF c_item.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_service,
|
||||
wash TYPE ty_service VALUE 'WASH',
|
||||
dryc TYPE ty_service VALUE 'DRYC',
|
||||
iron TYPE ty_service VALUE 'IRON',
|
||||
mend TYPE ty_service VALUE 'MEND',
|
||||
END OF c_service.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_price,
|
||||
shirt TYPE ty_amount VALUE '3.50',
|
||||
trousers TYPE ty_amount VALUE '5.00',
|
||||
suit TYPE ty_amount VALUE '12.00',
|
||||
coat TYPE ty_amount VALUE '14.50',
|
||||
dress TYPE ty_amount VALUE '8.00',
|
||||
curtain TYPE ty_amount VALUE '9.50',
|
||||
END OF c_price.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_factor,
|
||||
wash TYPE i VALUE 100,
|
||||
dryc TYPE i VALUE 180,
|
||||
iron TYPE i VALUE 40,
|
||||
mend TYPE i VALUE 220,
|
||||
END OF c_factor.
|
||||
|
||||
CONSTANTS c_max_qty TYPE ty_quantity VALUE 99.
|
||||
CONSTANTS c_bulk_min_qty TYPE ty_quantity VALUE 10.
|
||||
CONSTANTS c_bulk_discount TYPE i VALUE 10.
|
||||
CONSTANTS c_express_surcharge TYPE i VALUE 25.
|
||||
CONSTANTS c_min_fee TYPE ty_amount VALUE '5.00'.
|
||||
|
||||
METHODS check_item
|
||||
IMPORTING iv_item TYPE ty_item
|
||||
iv_service TYPE ty_service
|
||||
iv_quantity TYPE ty_quantity
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS calculate_fee
|
||||
IMPORTING iv_item TYPE ty_item
|
||||
iv_service TYPE ty_service
|
||||
iv_quantity TYPE ty_quantity
|
||||
iv_express TYPE ty_flag
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
|
||||
METHODS calculate_order
|
||||
IMPORTING it_lines TYPE tt_order_line
|
||||
RETURNING VALUE(rv_total) TYPE ty_amount.
|
||||
ENDINTERFACE.
|
||||
84
tasks_gen/train/G1913/faulty/m1_if_laundry_fee.intf.abap
Normal file
84
tasks_gen/train/G1913/faulty/m1_if_laundry_fee.intf.abap
Normal file
@@ -0,0 +1,84 @@
|
||||
INTERFACE {{p}}if_laundry_fee PUBLIC.
|
||||
TYPES ty_item TYPE c LENGTH 7.
|
||||
TYPES ty_service TYPE c LENGTH 4.
|
||||
TYPES ty_reason TYPE c LENGTH 10.
|
||||
TYPES ty_quantity TYPE i.
|
||||
TYPES ty_amount TYPE p LENGTH 8 DECIMALS 2.
|
||||
TYPES ty_flag TYPE abap_bool.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_order_line,
|
||||
item TYPE ty_item,
|
||||
service TYPE ty_service,
|
||||
quantity TYPE ty_quantity,
|
||||
express TYPE ty_flag,
|
||||
END OF ty_order_line.
|
||||
TYPES tt_order_line TYPE STANDARD TABLE OF ty_order_line WITH EMPTY KEY.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'ZK',
|
||||
item TYPE ty_reason VALUE 'ITEM',
|
||||
service TYPE ty_reason VALUE 'SERVICE',
|
||||
qty TYPE ty_reason VALUE 'QTY',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_item,
|
||||
shirt TYPE ty_item VALUE 'SHIRT',
|
||||
trousers TYPE ty_item VALUE 'TROUS',
|
||||
suit TYPE ty_item VALUE 'SUIT',
|
||||
coat TYPE ty_item VALUE 'COAT',
|
||||
dress TYPE ty_item VALUE 'DRESS',
|
||||
curtain TYPE ty_item VALUE 'CURTAIN',
|
||||
END OF c_item.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_service,
|
||||
wash TYPE ty_service VALUE 'WASH',
|
||||
dryc TYPE ty_service VALUE 'DRYC',
|
||||
iron TYPE ty_service VALUE 'IRON',
|
||||
mend TYPE ty_service VALUE 'MEND',
|
||||
END OF c_service.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_price,
|
||||
shirt TYPE ty_amount VALUE '3.50',
|
||||
trousers TYPE ty_amount VALUE '5.00',
|
||||
suit TYPE ty_amount VALUE '12.00',
|
||||
coat TYPE ty_amount VALUE '14.50',
|
||||
dress TYPE ty_amount VALUE '8.00',
|
||||
curtain TYPE ty_amount VALUE '9.50',
|
||||
END OF c_price.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_factor,
|
||||
wash TYPE i VALUE 100,
|
||||
dryc TYPE i VALUE 180,
|
||||
iron TYPE i VALUE 40,
|
||||
mend TYPE i VALUE 220,
|
||||
END OF c_factor.
|
||||
|
||||
CONSTANTS c_max_qty TYPE ty_quantity VALUE 99.
|
||||
CONSTANTS c_bulk_min_qty TYPE ty_quantity VALUE 10.
|
||||
CONSTANTS c_bulk_discount TYPE i VALUE 10.
|
||||
CONSTANTS c_express_surcharge TYPE i VALUE 25.
|
||||
CONSTANTS c_min_fee TYPE ty_amount VALUE '5.00'.
|
||||
|
||||
METHODS check_item
|
||||
IMPORTING iv_item TYPE ty_item
|
||||
iv_service TYPE ty_service
|
||||
iv_quantity TYPE ty_quantity
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS calculate_fee
|
||||
IMPORTING iv_item TYPE ty_item
|
||||
iv_service TYPE ty_service
|
||||
iv_quantity TYPE ty_quantity
|
||||
iv_express TYPE ty_flag
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
|
||||
METHODS calculate_order
|
||||
IMPORTING it_lines TYPE tt_order_line
|
||||
RETURNING VALUE(rv_total) TYPE ty_amount.
|
||||
ENDINTERFACE.
|
||||
84
tasks_gen/train/G1913/faulty/m2_if_laundry_fee.intf.abap
Normal file
84
tasks_gen/train/G1913/faulty/m2_if_laundry_fee.intf.abap
Normal file
@@ -0,0 +1,84 @@
|
||||
INTERFACE {{p}}if_laundry_fee PUBLIC.
|
||||
TYPES ty_item TYPE c LENGTH 7.
|
||||
TYPES ty_service TYPE c LENGTH 4.
|
||||
TYPES ty_reason TYPE c LENGTH 10.
|
||||
TYPES ty_quantity TYPE i.
|
||||
TYPES ty_amount TYPE p LENGTH 8 DECIMALS 2.
|
||||
TYPES ty_flag TYPE abap_bool.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_order_line,
|
||||
item TYPE ty_item,
|
||||
service TYPE ty_service,
|
||||
quantity TYPE ty_quantity,
|
||||
express TYPE ty_flag,
|
||||
END OF ty_order_line.
|
||||
TYPES tt_order_line TYPE STANDARD TABLE OF ty_order_line WITH EMPTY KEY.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
item TYPE ty_reason VALUE 'ITEM',
|
||||
service TYPE ty_reason VALUE 'SERVICE',
|
||||
qty TYPE ty_reason VALUE 'ZTY',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_item,
|
||||
shirt TYPE ty_item VALUE 'SHIRT',
|
||||
trousers TYPE ty_item VALUE 'TROUS',
|
||||
suit TYPE ty_item VALUE 'SUIT',
|
||||
coat TYPE ty_item VALUE 'COAT',
|
||||
dress TYPE ty_item VALUE 'DRESS',
|
||||
curtain TYPE ty_item VALUE 'CURTAIN',
|
||||
END OF c_item.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_service,
|
||||
wash TYPE ty_service VALUE 'WASH',
|
||||
dryc TYPE ty_service VALUE 'DRYC',
|
||||
iron TYPE ty_service VALUE 'IRON',
|
||||
mend TYPE ty_service VALUE 'MEND',
|
||||
END OF c_service.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_price,
|
||||
shirt TYPE ty_amount VALUE '3.50',
|
||||
trousers TYPE ty_amount VALUE '5.00',
|
||||
suit TYPE ty_amount VALUE '12.00',
|
||||
coat TYPE ty_amount VALUE '14.50',
|
||||
dress TYPE ty_amount VALUE '8.00',
|
||||
curtain TYPE ty_amount VALUE '9.50',
|
||||
END OF c_price.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_factor,
|
||||
wash TYPE i VALUE 100,
|
||||
dryc TYPE i VALUE 180,
|
||||
iron TYPE i VALUE 40,
|
||||
mend TYPE i VALUE 220,
|
||||
END OF c_factor.
|
||||
|
||||
CONSTANTS c_max_qty TYPE ty_quantity VALUE 99.
|
||||
CONSTANTS c_bulk_min_qty TYPE ty_quantity VALUE 10.
|
||||
CONSTANTS c_bulk_discount TYPE i VALUE 10.
|
||||
CONSTANTS c_express_surcharge TYPE i VALUE 25.
|
||||
CONSTANTS c_min_fee TYPE ty_amount VALUE '5.00'.
|
||||
|
||||
METHODS check_item
|
||||
IMPORTING iv_item TYPE ty_item
|
||||
iv_service TYPE ty_service
|
||||
iv_quantity TYPE ty_quantity
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS calculate_fee
|
||||
IMPORTING iv_item TYPE ty_item
|
||||
iv_service TYPE ty_service
|
||||
iv_quantity TYPE ty_quantity
|
||||
iv_express TYPE ty_flag
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
|
||||
METHODS calculate_order
|
||||
IMPORTING it_lines TYPE tt_order_line
|
||||
RETURNING VALUE(rv_total) TYPE ty_amount.
|
||||
ENDINTERFACE.
|
||||
84
tasks_gen/train/G1913/faulty/m3_if_laundry_fee.intf.abap
Normal file
84
tasks_gen/train/G1913/faulty/m3_if_laundry_fee.intf.abap
Normal file
@@ -0,0 +1,84 @@
|
||||
INTERFACE {{p}}if_laundry_fee PUBLIC.
|
||||
TYPES ty_item TYPE c LENGTH 7.
|
||||
TYPES ty_service TYPE c LENGTH 4.
|
||||
TYPES ty_reason TYPE c LENGTH 10.
|
||||
TYPES ty_quantity TYPE i.
|
||||
TYPES ty_amount TYPE p LENGTH 8 DECIMALS 2.
|
||||
TYPES ty_flag TYPE abap_bool.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_order_line,
|
||||
item TYPE ty_item,
|
||||
service TYPE ty_service,
|
||||
quantity TYPE ty_quantity,
|
||||
express TYPE ty_flag,
|
||||
END OF ty_order_line.
|
||||
TYPES tt_order_line TYPE STANDARD TABLE OF ty_order_line WITH EMPTY KEY.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
item TYPE ty_reason VALUE 'ITEM',
|
||||
service TYPE ty_reason VALUE 'SERVICE',
|
||||
qty TYPE ty_reason VALUE 'QTY',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_item,
|
||||
shirt TYPE ty_item VALUE 'SHIRT',
|
||||
trousers TYPE ty_item VALUE 'TROUS',
|
||||
suit TYPE ty_item VALUE 'SUIT',
|
||||
coat TYPE ty_item VALUE 'COAT',
|
||||
dress TYPE ty_item VALUE 'DRESS',
|
||||
curtain TYPE ty_item VALUE 'CURTAIN',
|
||||
END OF c_item.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_service,
|
||||
wash TYPE ty_service VALUE 'WASH',
|
||||
dryc TYPE ty_service VALUE 'DRYC',
|
||||
iron TYPE ty_service VALUE 'ZRON',
|
||||
mend TYPE ty_service VALUE 'MEND',
|
||||
END OF c_service.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_price,
|
||||
shirt TYPE ty_amount VALUE '3.50',
|
||||
trousers TYPE ty_amount VALUE '5.00',
|
||||
suit TYPE ty_amount VALUE '12.00',
|
||||
coat TYPE ty_amount VALUE '14.50',
|
||||
dress TYPE ty_amount VALUE '8.00',
|
||||
curtain TYPE ty_amount VALUE '9.50',
|
||||
END OF c_price.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_factor,
|
||||
wash TYPE i VALUE 100,
|
||||
dryc TYPE i VALUE 180,
|
||||
iron TYPE i VALUE 40,
|
||||
mend TYPE i VALUE 220,
|
||||
END OF c_factor.
|
||||
|
||||
CONSTANTS c_max_qty TYPE ty_quantity VALUE 99.
|
||||
CONSTANTS c_bulk_min_qty TYPE ty_quantity VALUE 10.
|
||||
CONSTANTS c_bulk_discount TYPE i VALUE 10.
|
||||
CONSTANTS c_express_surcharge TYPE i VALUE 25.
|
||||
CONSTANTS c_min_fee TYPE ty_amount VALUE '5.00'.
|
||||
|
||||
METHODS check_item
|
||||
IMPORTING iv_item TYPE ty_item
|
||||
iv_service TYPE ty_service
|
||||
iv_quantity TYPE ty_quantity
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS calculate_fee
|
||||
IMPORTING iv_item TYPE ty_item
|
||||
iv_service TYPE ty_service
|
||||
iv_quantity TYPE ty_quantity
|
||||
iv_express TYPE ty_flag
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
|
||||
METHODS calculate_order
|
||||
IMPORTING it_lines TYPE tt_order_line
|
||||
RETURNING VALUE(rv_total) TYPE ty_amount.
|
||||
ENDINTERFACE.
|
||||
84
tasks_gen/train/G1913/faulty/m4_if_laundry_fee.intf.abap
Normal file
84
tasks_gen/train/G1913/faulty/m4_if_laundry_fee.intf.abap
Normal file
@@ -0,0 +1,84 @@
|
||||
INTERFACE {{p}}if_laundry_fee PUBLIC.
|
||||
TYPES ty_item TYPE c LENGTH 7.
|
||||
TYPES ty_service TYPE c LENGTH 4.
|
||||
TYPES ty_reason TYPE c LENGTH 10.
|
||||
TYPES ty_quantity TYPE i.
|
||||
TYPES ty_amount TYPE p LENGTH 8 DECIMALS 2.
|
||||
TYPES ty_flag TYPE abap_bool.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_order_line,
|
||||
item TYPE ty_item,
|
||||
service TYPE ty_service,
|
||||
quantity TYPE ty_quantity,
|
||||
express TYPE ty_flag,
|
||||
END OF ty_order_line.
|
||||
TYPES tt_order_line TYPE STANDARD TABLE OF ty_order_line WITH EMPTY KEY.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
item TYPE ty_reason VALUE 'ITEM',
|
||||
service TYPE ty_reason VALUE 'SERVICE',
|
||||
qty TYPE ty_reason VALUE 'QTY',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_item,
|
||||
shirt TYPE ty_item VALUE 'SHIRT',
|
||||
trousers TYPE ty_item VALUE 'TROUS',
|
||||
suit TYPE ty_item VALUE 'SUIT',
|
||||
coat TYPE ty_item VALUE 'COAT',
|
||||
dress TYPE ty_item VALUE 'DRESS',
|
||||
curtain TYPE ty_item VALUE 'CURTAIN',
|
||||
END OF c_item.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_service,
|
||||
wash TYPE ty_service VALUE 'WASH',
|
||||
dryc TYPE ty_service VALUE 'DRYC',
|
||||
iron TYPE ty_service VALUE 'IRON',
|
||||
mend TYPE ty_service VALUE 'MEND',
|
||||
END OF c_service.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_price,
|
||||
shirt TYPE ty_amount VALUE '3.50',
|
||||
trousers TYPE ty_amount VALUE '5.00',
|
||||
suit TYPE ty_amount VALUE '12.00',
|
||||
coat TYPE ty_amount VALUE '14.50',
|
||||
dress TYPE ty_amount VALUE '8.00',
|
||||
curtain TYPE ty_amount VALUE '9.50',
|
||||
END OF c_price.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_factor,
|
||||
wash TYPE i VALUE 100,
|
||||
dryc TYPE i VALUE 180,
|
||||
iron TYPE i VALUE 40,
|
||||
mend TYPE i VALUE 220,
|
||||
END OF c_factor.
|
||||
|
||||
CONSTANTS c_max_qty TYPE ty_quantity VALUE 99.
|
||||
CONSTANTS c_bulk_min_qty TYPE ty_quantity VALUE 10.
|
||||
CONSTANTS c_bulk_discount TYPE i VALUE 10.
|
||||
CONSTANTS c_express_surcharge TYPE i VALUE 26.
|
||||
CONSTANTS c_min_fee TYPE ty_amount VALUE '5.00'.
|
||||
|
||||
METHODS check_item
|
||||
IMPORTING iv_item TYPE ty_item
|
||||
iv_service TYPE ty_service
|
||||
iv_quantity TYPE ty_quantity
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS calculate_fee
|
||||
IMPORTING iv_item TYPE ty_item
|
||||
iv_service TYPE ty_service
|
||||
iv_quantity TYPE ty_quantity
|
||||
iv_express TYPE ty_flag
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
|
||||
METHODS calculate_order
|
||||
IMPORTING it_lines TYPE tt_order_line
|
||||
RETURNING VALUE(rv_total) TYPE ty_amount.
|
||||
ENDINTERFACE.
|
||||
38
tasks_gen/train/G1913/generation.json
Normal file
38
tasks_gen/train/G1913/generation.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"id": "G1913",
|
||||
"pool": "train",
|
||||
"object_type": "INTF",
|
||||
"category": "A",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"invalid JSON: Unterminated string starting at: line 1 column 905 (char 904)"
|
||||
],
|
||||
"by_check": {
|
||||
"json": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 0,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 81.0,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
197
tasks_gen/train/G1913/hidden/laundry_hidden.clas.abap
Normal file
197
tasks_gen/train/G1913/hidden/laundry_hidden.clas.abap
Normal file
@@ -0,0 +1,197 @@
|
||||
CLASS {{p}}laundry_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_laundry_fee.
|
||||
PRIVATE SECTION.
|
||||
METHODS reason_codes FOR TESTING.
|
||||
METHODS item_codes FOR TESTING.
|
||||
METHODS service_codes FOR TESTING.
|
||||
METHODS price_table FOR TESTING.
|
||||
METHODS factor_table FOR TESTING.
|
||||
METHODS limit_values FOR TESTING.
|
||||
METHODS char_type_lengths FOR TESTING.
|
||||
METHODS amount_type FOR TESTING.
|
||||
METHODS order_line_type FOR TESTING.
|
||||
METHODS methods_callable FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS {{p}}laundry_hidden IMPLEMENTATION.
|
||||
METHOD {{p}}if_laundry_fee~check_item.
|
||||
rv_reason = {{p}}if_laundry_fee=>c_reason-ok.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_laundry_fee~calculate_fee.
|
||||
rv_fee = {{p}}if_laundry_fee=>c_min_fee.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_laundry_fee~calculate_order.
|
||||
rv_total = {{p}}if_laundry_fee=>c_min_fee.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reason_codes.
|
||||
DATA lv_reason TYPE {{p}}if_laundry_fee=>ty_reason.
|
||||
lv_reason = 'OK'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_reason act = {{p}}if_laundry_fee=>c_reason-ok ).
|
||||
lv_reason = 'ITEM'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_reason act = {{p}}if_laundry_fee=>c_reason-item ).
|
||||
lv_reason = 'SERVICE'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_reason act = {{p}}if_laundry_fee=>c_reason-service ).
|
||||
lv_reason = 'QTY'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_reason act = {{p}}if_laundry_fee=>c_reason-qty ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD item_codes.
|
||||
DATA lv_item TYPE {{p}}if_laundry_fee=>ty_item.
|
||||
lv_item = 'SHIRT'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_item act = {{p}}if_laundry_fee=>c_item-shirt ).
|
||||
lv_item = 'TROUS'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_item act = {{p}}if_laundry_fee=>c_item-trousers ).
|
||||
lv_item = 'SUIT'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_item act = {{p}}if_laundry_fee=>c_item-suit ).
|
||||
lv_item = 'COAT'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_item act = {{p}}if_laundry_fee=>c_item-coat ).
|
||||
lv_item = 'DRESS'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_item act = {{p}}if_laundry_fee=>c_item-dress ).
|
||||
lv_item = 'CURTAIN'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_item act = {{p}}if_laundry_fee=>c_item-curtain ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD service_codes.
|
||||
DATA lv_service TYPE {{p}}if_laundry_fee=>ty_service.
|
||||
lv_service = 'WASH'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_service act = {{p}}if_laundry_fee=>c_service-wash ).
|
||||
lv_service = 'DRYC'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_service act = {{p}}if_laundry_fee=>c_service-dryc ).
|
||||
lv_service = 'IRON'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_service act = {{p}}if_laundry_fee=>c_service-iron ).
|
||||
lv_service = 'MEND'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_service act = {{p}}if_laundry_fee=>c_service-mend ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD price_table.
|
||||
DATA lv_price TYPE {{p}}if_laundry_fee=>ty_amount.
|
||||
lv_price = '3.50'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_price act = {{p}}if_laundry_fee=>c_price-shirt ).
|
||||
lv_price = '5.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_price act = {{p}}if_laundry_fee=>c_price-trousers ).
|
||||
lv_price = '12.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_price act = {{p}}if_laundry_fee=>c_price-suit ).
|
||||
lv_price = '14.50'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_price act = {{p}}if_laundry_fee=>c_price-coat ).
|
||||
lv_price = '8.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_price act = {{p}}if_laundry_fee=>c_price-dress ).
|
||||
lv_price = '9.50'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_price act = {{p}}if_laundry_fee=>c_price-curtain ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD factor_table.
|
||||
DATA lv_factor TYPE i.
|
||||
lv_factor = 100.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_factor act = {{p}}if_laundry_fee=>c_factor-wash ).
|
||||
lv_factor = 180.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_factor act = {{p}}if_laundry_fee=>c_factor-dryc ).
|
||||
lv_factor = 40.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_factor act = {{p}}if_laundry_fee=>c_factor-iron ).
|
||||
lv_factor = 220.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_factor act = {{p}}if_laundry_fee=>c_factor-mend ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD limit_values.
|
||||
DATA lv_qty TYPE {{p}}if_laundry_fee=>ty_quantity.
|
||||
DATA lv_int TYPE i.
|
||||
DATA lv_fee TYPE {{p}}if_laundry_fee=>ty_amount.
|
||||
lv_qty = 99.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_qty act = {{p}}if_laundry_fee=>c_max_qty ).
|
||||
lv_qty = 10.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_qty act = {{p}}if_laundry_fee=>c_bulk_min_qty ).
|
||||
lv_int = 10.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_int act = {{p}}if_laundry_fee=>c_bulk_discount ).
|
||||
lv_int = 25.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_int act = {{p}}if_laundry_fee=>c_express_surcharge ).
|
||||
lv_fee = '5.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_fee act = {{p}}if_laundry_fee=>c_min_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD char_type_lengths.
|
||||
DATA lv_item TYPE {{p}}if_laundry_fee=>ty_item.
|
||||
DATA lv_item_ref TYPE c LENGTH 7.
|
||||
DATA lv_service TYPE {{p}}if_laundry_fee=>ty_service.
|
||||
DATA lv_service_ref TYPE c LENGTH 4.
|
||||
DATA lv_reason TYPE {{p}}if_laundry_fee=>ty_reason.
|
||||
DATA lv_reason_ref TYPE c LENGTH 10.
|
||||
DATA lv_flag TYPE {{p}}if_laundry_fee=>ty_flag.
|
||||
DATA lv_flag_ref TYPE abap_bool.
|
||||
|
||||
DATA(lo_item) = CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( lv_item ) ).
|
||||
DATA(lo_item_ref) = CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( lv_item_ref ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lo_item_ref->length act = lo_item->length ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lo_item_ref->type_kind act = lo_item->type_kind ).
|
||||
|
||||
DATA(lo_service) = CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( lv_service ) ).
|
||||
DATA(lo_service_ref) = CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( lv_service_ref ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lo_service_ref->length act = lo_service->length ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lo_service_ref->type_kind act = lo_service->type_kind ).
|
||||
|
||||
DATA(lo_reason) = CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( lv_reason ) ).
|
||||
DATA(lo_reason_ref) = CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( lv_reason_ref ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lo_reason_ref->length act = lo_reason->length ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lo_reason_ref->type_kind act = lo_reason->type_kind ).
|
||||
|
||||
DATA(lo_flag) = CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( lv_flag ) ).
|
||||
DATA(lo_flag_ref) = CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( lv_flag_ref ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lo_flag_ref->length act = lo_flag->length ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lo_flag_ref->type_kind act = lo_flag->type_kind ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD amount_type.
|
||||
DATA lv_amount TYPE {{p}}if_laundry_fee=>ty_amount.
|
||||
DATA lv_amount_ref TYPE p LENGTH 8 DECIMALS 2.
|
||||
|
||||
DATA(lo_amount) = CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( lv_amount ) ).
|
||||
DATA(lo_amount_ref) = CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( lv_amount_ref ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = lo_amount_ref->type_kind act = lo_amount->type_kind ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lo_amount_ref->length act = lo_amount->length ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lo_amount_ref->decimals act = lo_amount->decimals ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD order_line_type.
|
||||
DATA ls_line TYPE {{p}}if_laundry_fee=>ty_order_line.
|
||||
DATA lt_lines TYPE {{p}}if_laundry_fee=>tt_order_line.
|
||||
|
||||
ls_line-item = {{p}}if_laundry_fee=>c_item-shirt.
|
||||
ls_line-service = {{p}}if_laundry_fee=>c_service-wash.
|
||||
ls_line-quantity = 3.
|
||||
ls_line-express = abap_true.
|
||||
APPEND ls_line TO lt_lines.
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_laundry_fee=>c_item-shirt
|
||||
act = lt_lines[ 1 ]-item ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_lines[ 1 ]-quantity ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD methods_callable.
|
||||
DATA lo_cut TYPE REF TO {{p}}if_laundry_fee.
|
||||
DATA lt_lines TYPE {{p}}if_laundry_fee=>tt_order_line.
|
||||
|
||||
lo_cut = NEW {{p}}laundry_hidden( ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_laundry_fee=>c_reason-ok
|
||||
act = lo_cut->check_item( iv_item = {{p}}if_laundry_fee=>c_item-shirt
|
||||
iv_service = {{p}}if_laundry_fee=>c_service-wash
|
||||
iv_quantity = 2 ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_laundry_fee=>c_min_fee
|
||||
act = lo_cut->calculate_fee( iv_item = {{p}}if_laundry_fee=>c_item-shirt
|
||||
iv_service = {{p}}if_laundry_fee=>c_service-wash
|
||||
iv_quantity = 2
|
||||
iv_express = abap_false ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_laundry_fee=>c_min_fee
|
||||
act = lo_cut->calculate_order( lt_lines ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
54
tasks_gen/train/G1913/mutation.json
Normal file
54
tasks_gen/train/G1913/mutation.json
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"task": "G1913",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}IF_LAUNDRY_FEE",
|
||||
"mutant": "line 6: LENGTH 8 -> LENGTH 7 (length)",
|
||||
"status": "killed",
|
||||
"hidden": "9/10",
|
||||
"failed_tests": [
|
||||
"AMOUNT_TYPE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}IF_LAUNDRY_FEE",
|
||||
"mutant": "line 20: VALUE 'OK' -> VALUE 'ZK' (lit)",
|
||||
"status": "killed",
|
||||
"hidden": "9/10",
|
||||
"failed_tests": [
|
||||
"REASON_CODES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}IF_LAUNDRY_FEE",
|
||||
"mutant": "line 23: VALUE 'QTY' -> VALUE 'ZTY' (lit)",
|
||||
"status": "killed",
|
||||
"hidden": "9/10",
|
||||
"failed_tests": [
|
||||
"REASON_CODES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}IF_LAUNDRY_FEE",
|
||||
"mutant": "line 40: VALUE 'IRON' -> VALUE 'ZRON' (lit)",
|
||||
"status": "killed",
|
||||
"hidden": "9/10",
|
||||
"failed_tests": [
|
||||
"SERVICE_CODES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}IF_LAUNDRY_FEE",
|
||||
"mutant": "line 65: VALUE 25 -> VALUE 26 (const)",
|
||||
"status": "killed",
|
||||
"hidden": "9/10",
|
||||
"failed_tests": [
|
||||
"LIMIT_VALUES"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
84
tasks_gen/train/G1913/reference/if_laundry_fee.intf.abap
Normal file
84
tasks_gen/train/G1913/reference/if_laundry_fee.intf.abap
Normal file
@@ -0,0 +1,84 @@
|
||||
INTERFACE {{p}}if_laundry_fee PUBLIC.
|
||||
TYPES ty_item TYPE c LENGTH 7.
|
||||
TYPES ty_service TYPE c LENGTH 4.
|
||||
TYPES ty_reason TYPE c LENGTH 10.
|
||||
TYPES ty_quantity TYPE i.
|
||||
TYPES ty_amount TYPE p LENGTH 8 DECIMALS 2.
|
||||
TYPES ty_flag TYPE abap_bool.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_order_line,
|
||||
item TYPE ty_item,
|
||||
service TYPE ty_service,
|
||||
quantity TYPE ty_quantity,
|
||||
express TYPE ty_flag,
|
||||
END OF ty_order_line.
|
||||
TYPES tt_order_line TYPE STANDARD TABLE OF ty_order_line WITH EMPTY KEY.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
item TYPE ty_reason VALUE 'ITEM',
|
||||
service TYPE ty_reason VALUE 'SERVICE',
|
||||
qty TYPE ty_reason VALUE 'QTY',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_item,
|
||||
shirt TYPE ty_item VALUE 'SHIRT',
|
||||
trousers TYPE ty_item VALUE 'TROUS',
|
||||
suit TYPE ty_item VALUE 'SUIT',
|
||||
coat TYPE ty_item VALUE 'COAT',
|
||||
dress TYPE ty_item VALUE 'DRESS',
|
||||
curtain TYPE ty_item VALUE 'CURTAIN',
|
||||
END OF c_item.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_service,
|
||||
wash TYPE ty_service VALUE 'WASH',
|
||||
dryc TYPE ty_service VALUE 'DRYC',
|
||||
iron TYPE ty_service VALUE 'IRON',
|
||||
mend TYPE ty_service VALUE 'MEND',
|
||||
END OF c_service.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_price,
|
||||
shirt TYPE ty_amount VALUE '3.50',
|
||||
trousers TYPE ty_amount VALUE '5.00',
|
||||
suit TYPE ty_amount VALUE '12.00',
|
||||
coat TYPE ty_amount VALUE '14.50',
|
||||
dress TYPE ty_amount VALUE '8.00',
|
||||
curtain TYPE ty_amount VALUE '9.50',
|
||||
END OF c_price.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_factor,
|
||||
wash TYPE i VALUE 100,
|
||||
dryc TYPE i VALUE 180,
|
||||
iron TYPE i VALUE 40,
|
||||
mend TYPE i VALUE 220,
|
||||
END OF c_factor.
|
||||
|
||||
CONSTANTS c_max_qty TYPE ty_quantity VALUE 99.
|
||||
CONSTANTS c_bulk_min_qty TYPE ty_quantity VALUE 10.
|
||||
CONSTANTS c_bulk_discount TYPE i VALUE 10.
|
||||
CONSTANTS c_express_surcharge TYPE i VALUE 25.
|
||||
CONSTANTS c_min_fee TYPE ty_amount VALUE '5.00'.
|
||||
|
||||
METHODS check_item
|
||||
IMPORTING iv_item TYPE ty_item
|
||||
iv_service TYPE ty_service
|
||||
iv_quantity TYPE ty_quantity
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS calculate_fee
|
||||
IMPORTING iv_item TYPE ty_item
|
||||
iv_service TYPE ty_service
|
||||
iv_quantity TYPE ty_quantity
|
||||
iv_express TYPE ty_flag
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
|
||||
METHODS calculate_order
|
||||
IMPORTING it_lines TYPE tt_order_line
|
||||
RETURNING VALUE(rv_total) TYPE ty_amount.
|
||||
ENDINTERFACE.
|
||||
114
tasks_gen/train/G1913/reference/laundry_fee_test.clas.abap
Normal file
114
tasks_gen/train/G1913/reference/laundry_fee_test.clas.abap
Normal file
@@ -0,0 +1,114 @@
|
||||
CLASS {{p}}laundry_fee_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS reason_codes FOR TESTING.
|
||||
METHODS item_codes FOR TESTING.
|
||||
METHODS service_codes FOR TESTING.
|
||||
METHODS price_table FOR TESTING.
|
||||
METHODS factor_table FOR TESTING.
|
||||
METHODS limit_values FOR TESTING.
|
||||
METHODS type_lengths FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS {{p}}laundry_fee_test IMPLEMENTATION.
|
||||
METHOD reason_codes.
|
||||
DATA lv_reason TYPE {{p}}if_laundry_fee=>ty_reason.
|
||||
lv_reason = 'OK'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_reason act = {{p}}if_laundry_fee=>c_reason-ok ).
|
||||
lv_reason = 'ITEM'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_reason act = {{p}}if_laundry_fee=>c_reason-item ).
|
||||
lv_reason = 'SERVICE'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_reason act = {{p}}if_laundry_fee=>c_reason-service ).
|
||||
lv_reason = 'QTY'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_reason act = {{p}}if_laundry_fee=>c_reason-qty ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD item_codes.
|
||||
DATA lv_item TYPE {{p}}if_laundry_fee=>ty_item.
|
||||
lv_item = 'SHIRT'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_item act = {{p}}if_laundry_fee=>c_item-shirt ).
|
||||
lv_item = 'TROUS'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_item act = {{p}}if_laundry_fee=>c_item-trousers ).
|
||||
lv_item = 'SUIT'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_item act = {{p}}if_laundry_fee=>c_item-suit ).
|
||||
lv_item = 'COAT'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_item act = {{p}}if_laundry_fee=>c_item-coat ).
|
||||
lv_item = 'DRESS'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_item act = {{p}}if_laundry_fee=>c_item-dress ).
|
||||
lv_item = 'CURTAIN'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_item act = {{p}}if_laundry_fee=>c_item-curtain ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD service_codes.
|
||||
DATA lv_service TYPE {{p}}if_laundry_fee=>ty_service.
|
||||
lv_service = 'WASH'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_service act = {{p}}if_laundry_fee=>c_service-wash ).
|
||||
lv_service = 'DRYC'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_service act = {{p}}if_laundry_fee=>c_service-dryc ).
|
||||
lv_service = 'IRON'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_service act = {{p}}if_laundry_fee=>c_service-iron ).
|
||||
lv_service = 'MEND'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_service act = {{p}}if_laundry_fee=>c_service-mend ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD price_table.
|
||||
DATA lv_price TYPE {{p}}if_laundry_fee=>ty_amount.
|
||||
lv_price = '3.50'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_price act = {{p}}if_laundry_fee=>c_price-shirt ).
|
||||
lv_price = '5.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_price act = {{p}}if_laundry_fee=>c_price-trousers ).
|
||||
lv_price = '12.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_price act = {{p}}if_laundry_fee=>c_price-suit ).
|
||||
lv_price = '14.50'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_price act = {{p}}if_laundry_fee=>c_price-coat ).
|
||||
lv_price = '8.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_price act = {{p}}if_laundry_fee=>c_price-dress ).
|
||||
lv_price = '9.50'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_price act = {{p}}if_laundry_fee=>c_price-curtain ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD factor_table.
|
||||
DATA lv_factor TYPE i.
|
||||
lv_factor = 100.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_factor act = {{p}}if_laundry_fee=>c_factor-wash ).
|
||||
lv_factor = 180.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_factor act = {{p}}if_laundry_fee=>c_factor-dryc ).
|
||||
lv_factor = 40.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_factor act = {{p}}if_laundry_fee=>c_factor-iron ).
|
||||
lv_factor = 220.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_factor act = {{p}}if_laundry_fee=>c_factor-mend ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD limit_values.
|
||||
DATA lv_qty TYPE {{p}}if_laundry_fee=>ty_quantity.
|
||||
DATA lv_int TYPE i.
|
||||
DATA lv_fee TYPE {{p}}if_laundry_fee=>ty_amount.
|
||||
lv_qty = 99.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_qty act = {{p}}if_laundry_fee=>c_max_qty ).
|
||||
lv_qty = 10.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_qty act = {{p}}if_laundry_fee=>c_bulk_min_qty ).
|
||||
lv_int = 10.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_int act = {{p}}if_laundry_fee=>c_bulk_discount ).
|
||||
lv_int = 25.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_int act = {{p}}if_laundry_fee=>c_express_surcharge ).
|
||||
lv_fee = '5.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_fee act = {{p}}if_laundry_fee=>c_min_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD type_lengths.
|
||||
DATA lv_item TYPE {{p}}if_laundry_fee=>ty_item.
|
||||
DATA lv_item_ref TYPE c LENGTH 7.
|
||||
DATA lv_amount TYPE {{p}}if_laundry_fee=>ty_amount.
|
||||
DATA lv_amount_ref TYPE p LENGTH 8 DECIMALS 2.
|
||||
|
||||
DATA(lo_item) = CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( lv_item ) ).
|
||||
DATA(lo_item_ref) = CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( lv_item_ref ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lo_item_ref->length act = lo_item->length ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lo_item_ref->type_kind act = lo_item->type_kind ).
|
||||
|
||||
DATA(lo_amount) = CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( lv_amount ) ).
|
||||
DATA(lo_amount_ref) = CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( lv_amount_ref ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lo_amount_ref->length act = lo_amount->length ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lo_amount_ref->decimals act = lo_amount->decimals ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
119
tasks_gen/train/G1913/spec.md
Normal file
119
tasks_gen/train/G1913/spec.md
Normal file
@@ -0,0 +1,119 @@
|
||||
# 1. Goal
|
||||
|
||||
A laundry and dry-cleaning shop prices the orders of its customers. The checkout
|
||||
program of the shop and the pricing class of the shop must use the same contract.
|
||||
Create the interface {{P}}IF_LAUNDRY_FEE in package $TMP. The interface holds the
|
||||
item codes, the service codes, the reason codes, the price table, the factor
|
||||
table and the three methods.
|
||||
|
||||
# 2. Open questions
|
||||
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
|
||||
- The interface {{P}}IF_LAUNDRY_FEE does not exist. Create it in package $TMP.
|
||||
- The checkout program calls the method CHECK_ITEM before it calls the method
|
||||
CALCULATE_FEE.
|
||||
- The pricing class that implements the interface is written by another
|
||||
developer. It is not part of this task.
|
||||
- The interface contains declarations only.
|
||||
|
||||
# 4. Contract
|
||||
|
||||
Create the interface {{P}}IF_LAUNDRY_FEE in package $TMP. The interface has these
|
||||
components.
|
||||
|
||||
Types:
|
||||
- TY_ITEM: character, length 7.
|
||||
- TY_SERVICE: character, length 4.
|
||||
- TY_REASON: character, length 10.
|
||||
- TY_QUANTITY: integer.
|
||||
- TY_AMOUNT: packed number, length 8, 2 decimal places.
|
||||
- TY_FLAG: the type of ABAP_BOOL.
|
||||
- TY_ORDER_LINE: structure with the components ITEM (TY_ITEM), SERVICE
|
||||
(TY_SERVICE), QUANTITY (TY_QUANTITY) and EXPRESS (TY_FLAG).
|
||||
- TT_ORDER_LINE: standard table of TY_ORDER_LINE with an empty key.
|
||||
|
||||
Constants:
|
||||
- C_REASON: structure with the components OK, ITEM, SERVICE and QTY. Each
|
||||
component has the type TY_REASON.
|
||||
- C_ITEM: structure with the components SHIRT, TROUSERS, SUIT, COAT, DRESS and
|
||||
CURTAIN. Each component has the type TY_ITEM.
|
||||
- C_SERVICE: structure with the components WASH, DRYC, IRON and MEND. Each
|
||||
component has the type TY_SERVICE.
|
||||
- C_PRICE: structure with the components SHIRT, TROUSERS, SUIT, COAT, DRESS and
|
||||
CURTAIN. Each component has the type TY_AMOUNT.
|
||||
- C_FACTOR: structure with the components WASH, DRYC, IRON and MEND. Each
|
||||
component has the integer type.
|
||||
- C_MAX_QTY: type TY_QUANTITY.
|
||||
- C_BULK_MIN_QTY: type TY_QUANTITY.
|
||||
- C_BULK_DISCOUNT: integer.
|
||||
- C_EXPRESS_SURCHARGE: integer.
|
||||
- C_MIN_FEE: type TY_AMOUNT.
|
||||
|
||||
Methods:
|
||||
- CHECK_ITEM, importing IV_ITEM (TY_ITEM), IV_SERVICE (TY_SERVICE) and
|
||||
IV_QUANTITY (TY_QUANTITY), returning RV_REASON (TY_REASON).
|
||||
- CALCULATE_FEE, importing IV_ITEM (TY_ITEM), IV_SERVICE (TY_SERVICE),
|
||||
IV_QUANTITY (TY_QUANTITY) and IV_EXPRESS (TY_FLAG), returning RV_FEE
|
||||
(TY_AMOUNT).
|
||||
- CALCULATE_ORDER, importing IT_LINES (TT_ORDER_LINE), returning RV_TOTAL
|
||||
(TY_AMOUNT).
|
||||
|
||||
Do not add other public components.
|
||||
|
||||
# 5. Business rules
|
||||
|
||||
The values of the constants:
|
||||
1. C_REASON: OK = 'OK', ITEM = 'ITEM', SERVICE = 'SERVICE', QTY = 'QTY'.
|
||||
2. C_ITEM: SHIRT = 'SHIRT', TROUSERS = 'TROUS', SUIT = 'SUIT', COAT = 'COAT',
|
||||
DRESS = 'DRESS', CURTAIN = 'CURTAIN'.
|
||||
3. C_SERVICE: WASH = 'WASH', DRYC = 'DRYC', IRON = 'IRON', MEND = 'MEND'.
|
||||
4. C_PRICE is the price of one piece in euro: SHIRT = 3.50, TROUSERS = 5.00,
|
||||
SUIT = 12.00, COAT = 14.50, DRESS = 8.00, CURTAIN = 9.50.
|
||||
5. C_FACTOR is the service factor in percent: WASH = 100, DRYC = 180, IRON = 40,
|
||||
MEND = 220.
|
||||
6. C_MAX_QTY = 99, C_BULK_MIN_QTY = 10, C_BULK_DISCOUNT = 10,
|
||||
C_EXPRESS_SURCHARGE = 25, C_MIN_FEE = 5.00.
|
||||
|
||||
The rules of CHECK_ITEM. The first failing rule wins.
|
||||
7. If IV_ITEM is not one of the six codes of C_ITEM, the reason is ITEM.
|
||||
8. Else if IV_SERVICE is not one of the four codes of C_SERVICE, the reason is
|
||||
SERVICE.
|
||||
9. Else if IV_QUANTITY is less than 1 or greater than C_MAX_QTY, the reason is
|
||||
QTY.
|
||||
10. Else the reason is OK.
|
||||
|
||||
The rules of CALCULATE_FEE.
|
||||
11. If CHECK_ITEM does not return OK, the fee is 0.00 and no other rule applies.
|
||||
12. The base amount is the quantity multiplied by the price of the item.
|
||||
13. If the quantity is at least C_BULK_MIN_QTY, reduce the base amount by
|
||||
C_BULK_DISCOUNT percent.
|
||||
14. Multiply the base amount by the factor of the service and divide the result
|
||||
by 100.
|
||||
15. If IV_EXPRESS is ABAP_TRUE, increase the result by C_EXPRESS_SURCHARGE
|
||||
percent.
|
||||
16. Round the result of rule 13, of rule 14 and of rule 15 to 2 decimal places.
|
||||
Round a half away from zero.
|
||||
17. If the fee is below C_MIN_FEE, the fee is C_MIN_FEE.
|
||||
|
||||
The rules of CALCULATE_ORDER.
|
||||
18. The total is the sum of the fees of all lines. A line with an invalid item,
|
||||
an invalid service or an invalid quantity adds 0.00.
|
||||
19. The total of an empty table is 0.00.
|
||||
|
||||
# 6. Constraints
|
||||
|
||||
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
|
||||
- Coding standards: Clean ABAP. The interface contains declarations only. Do not
|
||||
use obsolete syntax. Do not write a comment that restates the code.
|
||||
- Out of scope: do not create the pricing class that implements the interface. Do
|
||||
not create database tables, CDS views, programs or function modules.
|
||||
|
||||
# 7. Acceptance
|
||||
|
||||
- The interface {{P}}IF_LAUNDRY_FEE is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write your own ABAP Unit tests for the interface in a global test class in
|
||||
package $TMP.
|
||||
49
tasks_gen/train/G1913/task.json
Normal file
49
tasks_gen/train/G1913/task.json
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"id": "G1913",
|
||||
"category": "A",
|
||||
"object_type": "INTF",
|
||||
"difficulty": 3,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [],
|
||||
"contract": [
|
||||
{
|
||||
"type": "INTF",
|
||||
"name": "{{P}}IF_LAUNDRY_FEE"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"the pricing class that implements {{P}}IF_LAUNDRY_FEE",
|
||||
"database tables, CDS views, programs and function modules"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}LAUNDRY_HIDDEN",
|
||||
"file": "hidden/laundry_hidden.clas.abap",
|
||||
"description": "Hidden tests for the laundry fee interface"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "INTF",
|
||||
"name": "{{P}}IF_LAUNDRY_FEE",
|
||||
"file": "reference/if_laundry_fee.intf.abap",
|
||||
"description": "Laundry fee interface"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}LAUNDRY_FEE_TEST",
|
||||
"file": "reference/laundry_fee_test.clas.abap",
|
||||
"description": "Own tests for the interface"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"no_obsolete_syntax"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user