Snapshot: new training tasks (balanced generation), docs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
55
tasks_gen/train/G1921/faulty/m0_if_kiln_quote.intf.abap
Normal file
55
tasks_gen/train/G1921/faulty/m0_if_kiln_quote.intf.abap
Normal file
@@ -0,0 +1,55 @@
|
||||
INTERFACE {{p}}if_kiln_quote PUBLIC.
|
||||
TYPES ty_reason TYPE c LENGTH 11.
|
||||
TYPES ty_kiln TYPE c LENGTH 4.
|
||||
TYPES ty_amount TYPE p LENGTH 7 DECIMALS 2.
|
||||
|
||||
TYPES: BEGIN OF ty_load,
|
||||
kiln TYPE ty_kiln,
|
||||
pieces TYPE i,
|
||||
weight_kg TYPE i,
|
||||
glazed TYPE abap_bool,
|
||||
END OF ty_load.
|
||||
|
||||
TYPES: BEGIN OF ty_quote,
|
||||
kiln TYPE ty_kiln,
|
||||
base TYPE ty_amount,
|
||||
weight TYPE ty_amount,
|
||||
glaze TYPE ty_amount,
|
||||
total TYPE ty_amount,
|
||||
reason TYPE ty_reason,
|
||||
END OF ty_quote.
|
||||
|
||||
CONSTANTS: BEGIN OF c_kiln,
|
||||
small TYPE ty_kiln VALUE 'SMAL',
|
||||
medium TYPE ty_kiln VALUE 'MEDI',
|
||||
large TYPE ty_kiln VALUE 'LARG',
|
||||
END OF c_kiln.
|
||||
|
||||
CONSTANTS: BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
kiln TYPE ty_reason VALUE 'KILN',
|
||||
pieces TYPE ty_reason VALUE 'PIECES',
|
||||
weight TYPE ty_reason VALUE 'WEIGHT',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
c_base_small TYPE ty_amount VALUE '25.00',
|
||||
c_base_medium TYPE ty_amount VALUE '40.00',
|
||||
c_base_large TYPE ty_amount VALUE '60.00',
|
||||
c_weight_rate TYPE ty_amount VALUE '1.50',
|
||||
c_glaze_fee TYPE ty_amount VALUE '8.00',
|
||||
c_max_pieces TYPE i VALUE 40,
|
||||
c_max_weight TYPE i VALUE 120.
|
||||
|
||||
METHODS check_load
|
||||
IMPORTING is_load TYPE ty_load
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS kiln_fee
|
||||
IMPORTING iv_kiln TYPE ty_kiln
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
|
||||
METHODS quote
|
||||
IMPORTING is_load TYPE ty_load
|
||||
RETURNING VALUE(rs_quote) TYPE ty_quote.
|
||||
ENDINTERFACE.
|
||||
55
tasks_gen/train/G1921/faulty/m2_if_kiln_quote.intf.abap
Normal file
55
tasks_gen/train/G1921/faulty/m2_if_kiln_quote.intf.abap
Normal file
@@ -0,0 +1,55 @@
|
||||
INTERFACE {{p}}if_kiln_quote PUBLIC.
|
||||
TYPES ty_reason TYPE c LENGTH 12.
|
||||
TYPES ty_kiln TYPE c LENGTH 4.
|
||||
TYPES ty_amount TYPE p LENGTH 7 DECIMALS 2.
|
||||
|
||||
TYPES: BEGIN OF ty_load,
|
||||
kiln TYPE ty_kiln,
|
||||
pieces TYPE i,
|
||||
weight_kg TYPE i,
|
||||
glazed TYPE abap_bool,
|
||||
END OF ty_load.
|
||||
|
||||
TYPES: BEGIN OF ty_quote,
|
||||
kiln TYPE ty_kiln,
|
||||
base TYPE ty_amount,
|
||||
weight TYPE ty_amount,
|
||||
glaze TYPE ty_amount,
|
||||
total TYPE ty_amount,
|
||||
reason TYPE ty_reason,
|
||||
END OF ty_quote.
|
||||
|
||||
CONSTANTS: BEGIN OF c_kiln,
|
||||
small TYPE ty_kiln VALUE 'ZMAL',
|
||||
medium TYPE ty_kiln VALUE 'MEDI',
|
||||
large TYPE ty_kiln VALUE 'LARG',
|
||||
END OF c_kiln.
|
||||
|
||||
CONSTANTS: BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
kiln TYPE ty_reason VALUE 'KILN',
|
||||
pieces TYPE ty_reason VALUE 'PIECES',
|
||||
weight TYPE ty_reason VALUE 'WEIGHT',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
c_base_small TYPE ty_amount VALUE '25.00',
|
||||
c_base_medium TYPE ty_amount VALUE '40.00',
|
||||
c_base_large TYPE ty_amount VALUE '60.00',
|
||||
c_weight_rate TYPE ty_amount VALUE '1.50',
|
||||
c_glaze_fee TYPE ty_amount VALUE '8.00',
|
||||
c_max_pieces TYPE i VALUE 40,
|
||||
c_max_weight TYPE i VALUE 120.
|
||||
|
||||
METHODS check_load
|
||||
IMPORTING is_load TYPE ty_load
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS kiln_fee
|
||||
IMPORTING iv_kiln TYPE ty_kiln
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
|
||||
METHODS quote
|
||||
IMPORTING is_load TYPE ty_load
|
||||
RETURNING VALUE(rs_quote) TYPE ty_quote.
|
||||
ENDINTERFACE.
|
||||
55
tasks_gen/train/G1921/faulty/m4_if_kiln_quote.intf.abap
Normal file
55
tasks_gen/train/G1921/faulty/m4_if_kiln_quote.intf.abap
Normal file
@@ -0,0 +1,55 @@
|
||||
INTERFACE {{p}}if_kiln_quote PUBLIC.
|
||||
TYPES ty_reason TYPE c LENGTH 12.
|
||||
TYPES ty_kiln TYPE c LENGTH 4.
|
||||
TYPES ty_amount TYPE p LENGTH 7 DECIMALS 2.
|
||||
|
||||
TYPES: BEGIN OF ty_load,
|
||||
kiln TYPE ty_kiln,
|
||||
pieces TYPE i,
|
||||
weight_kg TYPE i,
|
||||
glazed TYPE abap_bool,
|
||||
END OF ty_load.
|
||||
|
||||
TYPES: BEGIN OF ty_quote,
|
||||
kiln TYPE ty_kiln,
|
||||
base TYPE ty_amount,
|
||||
weight TYPE ty_amount,
|
||||
glaze TYPE ty_amount,
|
||||
total TYPE ty_amount,
|
||||
reason TYPE ty_reason,
|
||||
END OF ty_quote.
|
||||
|
||||
CONSTANTS: BEGIN OF c_kiln,
|
||||
small TYPE ty_kiln VALUE 'SMAL',
|
||||
medium TYPE ty_kiln VALUE 'MEDI',
|
||||
large TYPE ty_kiln VALUE 'LARG',
|
||||
END OF c_kiln.
|
||||
|
||||
CONSTANTS: BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
kiln TYPE ty_reason VALUE 'KILN',
|
||||
pieces TYPE ty_reason VALUE 'PIECES',
|
||||
weight TYPE ty_reason VALUE 'WEIGHT',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
c_base_small TYPE ty_amount VALUE '25.00',
|
||||
c_base_medium TYPE ty_amount VALUE '40.00',
|
||||
c_base_large TYPE ty_amount VALUE '60.00',
|
||||
c_weight_rate TYPE ty_amount VALUE '1.50',
|
||||
c_glaze_fee TYPE ty_amount VALUE '8.00',
|
||||
c_max_pieces TYPE i VALUE 40,
|
||||
c_max_weight TYPE i VALUE 121.
|
||||
|
||||
METHODS check_load
|
||||
IMPORTING is_load TYPE ty_load
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS kiln_fee
|
||||
IMPORTING iv_kiln TYPE ty_kiln
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
|
||||
METHODS quote
|
||||
IMPORTING is_load TYPE ty_load
|
||||
RETURNING VALUE(rs_quote) TYPE ty_quote.
|
||||
ENDINTERFACE.
|
||||
34
tasks_gen/train/G1921/generation.json
Normal file
34
tasks_gen/train/G1921/generation.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"id": "G1921",
|
||||
"pool": "train",
|
||||
"object_type": "INTF",
|
||||
"category": "A",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 0,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 0,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 77.7,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 4,
|
||||
"killed": 3,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
148
tasks_gen/train/G1921/hidden/t02_hidden.clas.abap
Normal file
148
tasks_gen/train/G1921/hidden/t02_hidden.clas.abap
Normal file
@@ -0,0 +1,148 @@
|
||||
CLASS {{p}}t02_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_kiln_quote.
|
||||
|
||||
PRIVATE SECTION.
|
||||
METHODS kiln_codes FOR TESTING.
|
||||
METHODS reason_codes FOR TESTING.
|
||||
METHODS base_fees FOR TESTING.
|
||||
METHODS extra_fees FOR TESTING.
|
||||
METHODS load_limits FOR TESTING.
|
||||
METHODS reason_type_length FOR TESTING.
|
||||
METHODS kiln_type_length FOR TESTING.
|
||||
METHODS amount_decimals FOR TESTING.
|
||||
METHODS load_structure FOR TESTING.
|
||||
METHODS quote_structure FOR TESTING.
|
||||
METHODS methods_callable FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t02_hidden IMPLEMENTATION.
|
||||
METHOD {{p}}if_kiln_quote~check_load.
|
||||
rv_reason = {{p}}if_kiln_quote=>c_reason-ok.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_kiln_quote~kiln_fee.
|
||||
rv_fee = {{p}}if_kiln_quote=>c_base_small.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_kiln_quote~quote.
|
||||
rs_quote-kiln = is_load-kiln.
|
||||
rs_quote-reason = {{p}}if_kiln_quote=>c_reason-ok.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD kiln_codes.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'SMAL' act = {{p}}if_kiln_quote=>c_kiln-small ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'MEDI' act = {{p}}if_kiln_quote=>c_kiln-medium ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'LARG' act = {{p}}if_kiln_quote=>c_kiln-large ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reason_codes.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'OK' act = {{p}}if_kiln_quote=>c_reason-ok ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'KILN' act = {{p}}if_kiln_quote=>c_reason-kiln ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'PIECES' act = {{p}}if_kiln_quote=>c_reason-pieces ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'WEIGHT' act = {{p}}if_kiln_quote=>c_reason-weight ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD base_fees.
|
||||
DATA lv_exp TYPE {{p}}if_kiln_quote=>ty_amount.
|
||||
lv_exp = '25.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = {{p}}if_kiln_quote=>c_base_small ).
|
||||
lv_exp = '40.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = {{p}}if_kiln_quote=>c_base_medium ).
|
||||
lv_exp = '60.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = {{p}}if_kiln_quote=>c_base_large ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD extra_fees.
|
||||
DATA lv_exp TYPE {{p}}if_kiln_quote=>ty_amount.
|
||||
lv_exp = '1.50'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = {{p}}if_kiln_quote=>c_weight_rate ).
|
||||
lv_exp = '8.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = {{p}}if_kiln_quote=>c_glaze_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD load_limits.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 40 act = {{p}}if_kiln_quote=>c_max_pieces ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 120 act = {{p}}if_kiln_quote=>c_max_weight ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reason_type_length.
|
||||
DATA lv_reason TYPE {{p}}if_kiln_quote=>ty_reason.
|
||||
DATA lv_src TYPE string.
|
||||
lv_src = 'ABCDEFGHIJKLM'.
|
||||
lv_reason = lv_src.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'ABCDEFGHIJKL' act = lv_reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD kiln_type_length.
|
||||
DATA lv_kiln TYPE {{p}}if_kiln_quote=>ty_kiln.
|
||||
DATA lv_src TYPE string.
|
||||
lv_src = 'ABCDE'.
|
||||
lv_kiln = lv_src.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'ABCD' act = lv_kiln ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD amount_decimals.
|
||||
DATA lv_amount TYPE {{p}}if_kiln_quote=>ty_amount.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 2
|
||||
act = cl_abap_typedescr=>describe_by_data( lv_amount )->decimals ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD load_structure.
|
||||
DATA ls_load TYPE {{p}}if_kiln_quote=>ty_load.
|
||||
DATA(lo_struct) = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_data( ls_load ) ).
|
||||
DATA(lt_comp) = lo_struct->get_components( ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4 act = lines( lt_comp ) ).
|
||||
DATA(lv_names) = REDUCE string( INIT s TYPE string
|
||||
FOR ls IN lt_comp
|
||||
NEXT s = s && ls-name ).
|
||||
cl_abap_unit_assert=>assert_true( xsdbool( lv_names CS 'KILN' ) ).
|
||||
cl_abap_unit_assert=>assert_true( xsdbool( lv_names CS 'PIECES' ) ).
|
||||
cl_abap_unit_assert=>assert_true( xsdbool( lv_names CS 'WEIGHT_KG' ) ).
|
||||
cl_abap_unit_assert=>assert_true( xsdbool( lv_names CS 'GLAZED' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD quote_structure.
|
||||
DATA ls_quote TYPE {{p}}if_kiln_quote=>ty_quote.
|
||||
DATA(lo_struct) = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_data( ls_quote ) ).
|
||||
DATA(lt_comp) = lo_struct->get_components( ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 6 act = lines( lt_comp ) ).
|
||||
DATA(lv_names) = REDUCE string( INIT s TYPE string
|
||||
FOR ls IN lt_comp
|
||||
NEXT s = s && ls-name ).
|
||||
cl_abap_unit_assert=>assert_true( xsdbool( lv_names CS 'KILN' ) ).
|
||||
cl_abap_unit_assert=>assert_true( xsdbool( lv_names CS 'BASE' ) ).
|
||||
cl_abap_unit_assert=>assert_true( xsdbool( lv_names CS 'WEIGHT' ) ).
|
||||
cl_abap_unit_assert=>assert_true( xsdbool( lv_names CS 'GLAZE' ) ).
|
||||
cl_abap_unit_assert=>assert_true( xsdbool( lv_names CS 'TOTAL' ) ).
|
||||
cl_abap_unit_assert=>assert_true( xsdbool( lv_names CS 'REASON' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD methods_callable.
|
||||
DATA lo_cut TYPE REF TO {{p}}if_kiln_quote.
|
||||
lo_cut = me.
|
||||
|
||||
DATA ls_load TYPE {{p}}if_kiln_quote=>ty_load.
|
||||
ls_load-kiln = {{p}}if_kiln_quote=>c_kiln-small.
|
||||
ls_load-pieces = 5.
|
||||
ls_load-weight_kg = 10.
|
||||
ls_load-glazed = abap_true.
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_kiln_quote=>c_reason-ok
|
||||
act = lo_cut->check_load( ls_load ) ).
|
||||
|
||||
DATA(ls_quote) = lo_cut->quote( ls_load ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_kiln_quote=>c_reason-ok
|
||||
act = ls_quote-reason ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_kiln_quote=>c_base_small
|
||||
act = lo_cut->kiln_fee( {{p}}if_kiln_quote=>c_kiln-small ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
50
tasks_gen/train/G1921/mutation.json
Normal file
50
tasks_gen/train/G1921/mutation.json
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"task": "G1921",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}IF_KILN_QUOTE",
|
||||
"mutant": "line 2: LENGTH 12 -> LENGTH 11 (length)",
|
||||
"status": "killed",
|
||||
"hidden": "10/11",
|
||||
"failed_tests": [
|
||||
"REASON_TYPE_LENGTH"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}IF_KILN_QUOTE",
|
||||
"mutant": "line 4: LENGTH 7 -> LENGTH 6 (length)",
|
||||
"status": "survived",
|
||||
"hidden": "11/11",
|
||||
"failed_tests": []
|
||||
},
|
||||
{
|
||||
"object": "{{P}}IF_KILN_QUOTE",
|
||||
"mutant": "line 23: VALUE 'SMAL' -> VALUE 'ZMAL' (lit)",
|
||||
"status": "killed",
|
||||
"hidden": "10/11",
|
||||
"failed_tests": [
|
||||
"KILN_CODES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}IF_KILN_QUOTE",
|
||||
"mutant": "line 36: VALUE '25.00' -> VALUE 'Z5.00' (lit)",
|
||||
"status": "invalid",
|
||||
"hidden": "0/0",
|
||||
"failed_tests": []
|
||||
},
|
||||
{
|
||||
"object": "{{P}}IF_KILN_QUOTE",
|
||||
"mutant": "line 42: VALUE 120 -> VALUE 121 (const)",
|
||||
"status": "killed",
|
||||
"hidden": "10/11",
|
||||
"failed_tests": [
|
||||
"LOAD_LIMITS"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 4,
|
||||
"killed": 3,
|
||||
"kill_rate": 0.75,
|
||||
"ok": true
|
||||
}
|
||||
55
tasks_gen/train/G1921/reference/if_kiln_quote.intf.abap
Normal file
55
tasks_gen/train/G1921/reference/if_kiln_quote.intf.abap
Normal file
@@ -0,0 +1,55 @@
|
||||
INTERFACE {{p}}if_kiln_quote PUBLIC.
|
||||
TYPES ty_reason TYPE c LENGTH 12.
|
||||
TYPES ty_kiln TYPE c LENGTH 4.
|
||||
TYPES ty_amount TYPE p LENGTH 7 DECIMALS 2.
|
||||
|
||||
TYPES: BEGIN OF ty_load,
|
||||
kiln TYPE ty_kiln,
|
||||
pieces TYPE i,
|
||||
weight_kg TYPE i,
|
||||
glazed TYPE abap_bool,
|
||||
END OF ty_load.
|
||||
|
||||
TYPES: BEGIN OF ty_quote,
|
||||
kiln TYPE ty_kiln,
|
||||
base TYPE ty_amount,
|
||||
weight TYPE ty_amount,
|
||||
glaze TYPE ty_amount,
|
||||
total TYPE ty_amount,
|
||||
reason TYPE ty_reason,
|
||||
END OF ty_quote.
|
||||
|
||||
CONSTANTS: BEGIN OF c_kiln,
|
||||
small TYPE ty_kiln VALUE 'SMAL',
|
||||
medium TYPE ty_kiln VALUE 'MEDI',
|
||||
large TYPE ty_kiln VALUE 'LARG',
|
||||
END OF c_kiln.
|
||||
|
||||
CONSTANTS: BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
kiln TYPE ty_reason VALUE 'KILN',
|
||||
pieces TYPE ty_reason VALUE 'PIECES',
|
||||
weight TYPE ty_reason VALUE 'WEIGHT',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
c_base_small TYPE ty_amount VALUE '25.00',
|
||||
c_base_medium TYPE ty_amount VALUE '40.00',
|
||||
c_base_large TYPE ty_amount VALUE '60.00',
|
||||
c_weight_rate TYPE ty_amount VALUE '1.50',
|
||||
c_glaze_fee TYPE ty_amount VALUE '8.00',
|
||||
c_max_pieces TYPE i VALUE 40,
|
||||
c_max_weight TYPE i VALUE 120.
|
||||
|
||||
METHODS check_load
|
||||
IMPORTING is_load TYPE ty_load
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS kiln_fee
|
||||
IMPORTING iv_kiln TYPE ty_kiln
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
|
||||
METHODS quote
|
||||
IMPORTING is_load TYPE ty_load
|
||||
RETURNING VALUE(rs_quote) TYPE ty_quote.
|
||||
ENDINTERFACE.
|
||||
98
tasks_gen/train/G1921/reference/if_kiln_quote_test.clas.abap
Normal file
98
tasks_gen/train/G1921/reference/if_kiln_quote_test.clas.abap
Normal file
@@ -0,0 +1,98 @@
|
||||
CLASS {{p}}if_kiln_quote_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_kiln_quote.
|
||||
|
||||
PRIVATE SECTION.
|
||||
METHODS kiln_codes FOR TESTING.
|
||||
METHODS reason_codes FOR TESTING.
|
||||
METHODS fee_values FOR TESTING.
|
||||
METHODS type_lengths FOR TESTING.
|
||||
METHODS methods_callable FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}if_kiln_quote_test IMPLEMENTATION.
|
||||
METHOD {{p}}if_kiln_quote~check_load.
|
||||
rv_reason = {{p}}if_kiln_quote=>c_reason-ok.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_kiln_quote~kiln_fee.
|
||||
rv_fee = {{p}}if_kiln_quote=>c_base_small.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_kiln_quote~quote.
|
||||
rs_quote-kiln = is_load-kiln.
|
||||
rs_quote-reason = {{p}}if_kiln_quote=>c_reason-ok.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD kiln_codes.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'SMAL' act = {{p}}if_kiln_quote=>c_kiln-small ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'MEDI' act = {{p}}if_kiln_quote=>c_kiln-medium ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'LARG' act = {{p}}if_kiln_quote=>c_kiln-large ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reason_codes.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'OK' act = {{p}}if_kiln_quote=>c_reason-ok ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'KILN' act = {{p}}if_kiln_quote=>c_reason-kiln ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'PIECES' act = {{p}}if_kiln_quote=>c_reason-pieces ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'WEIGHT' act = {{p}}if_kiln_quote=>c_reason-weight ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD fee_values.
|
||||
DATA lv_exp TYPE {{p}}if_kiln_quote=>ty_amount.
|
||||
lv_exp = '25.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = {{p}}if_kiln_quote=>c_base_small ).
|
||||
lv_exp = '40.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = {{p}}if_kiln_quote=>c_base_medium ).
|
||||
lv_exp = '60.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = {{p}}if_kiln_quote=>c_base_large ).
|
||||
lv_exp = '1.50'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = {{p}}if_kiln_quote=>c_weight_rate ).
|
||||
lv_exp = '8.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = {{p}}if_kiln_quote=>c_glaze_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 40 act = {{p}}if_kiln_quote=>c_max_pieces ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 120 act = {{p}}if_kiln_quote=>c_max_weight ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD type_lengths.
|
||||
DATA lv_reason TYPE {{p}}if_kiln_quote=>ty_reason.
|
||||
DATA lv_kiln TYPE {{p}}if_kiln_quote=>ty_kiln.
|
||||
DATA lv_amount TYPE {{p}}if_kiln_quote=>ty_amount.
|
||||
DATA lv_src TYPE string.
|
||||
lv_src = 'ABCDEFGHIJKLM'.
|
||||
lv_reason = lv_src.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'ABCDEFGHIJKL' act = lv_reason ).
|
||||
lv_src = 'ABCDE'.
|
||||
lv_kiln = lv_src.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'ABCD' act = lv_kiln ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 2
|
||||
act = cl_abap_typedescr=>describe_by_data( lv_amount )->decimals ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD methods_callable.
|
||||
DATA lo_cut TYPE REF TO {{p}}if_kiln_quote.
|
||||
lo_cut = me.
|
||||
|
||||
DATA ls_load TYPE {{p}}if_kiln_quote=>ty_load.
|
||||
ls_load-kiln = {{p}}if_kiln_quote=>c_kiln-small.
|
||||
ls_load-pieces = 5.
|
||||
ls_load-weight_kg = 10.
|
||||
ls_load-glazed = abap_false.
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_kiln_quote=>c_reason-ok
|
||||
act = lo_cut->check_load( ls_load ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_kiln_quote=>c_base_small
|
||||
act = lo_cut->kiln_fee( {{p}}if_kiln_quote=>c_kiln-small ) ).
|
||||
|
||||
DATA(ls_quote) = lo_cut->quote( ls_load ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_kiln_quote=>c_reason-ok
|
||||
act = ls_quote-reason ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -0,0 +1,53 @@
|
||||
CLASS ltc_kiln_quote_contract DEFINITION FINAL FOR TESTING
|
||||
DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
METHODS kiln_codes FOR TESTING.
|
||||
METHODS reason_codes FOR TESTING.
|
||||
METHODS fee_values FOR TESTING.
|
||||
METHODS type_lengths FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_kiln_quote_contract IMPLEMENTATION.
|
||||
METHOD kiln_codes.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'SMAL' act = {{p}}if_kiln_quote=>c_kiln-small ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'MEDI' act = {{p}}if_kiln_quote=>c_kiln-medium ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'LARG' act = {{p}}if_kiln_quote=>c_kiln-large ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reason_codes.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'OK' act = {{p}}if_kiln_quote=>c_reason-ok ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'KILN' act = {{p}}if_kiln_quote=>c_reason-kiln ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'PIECES' act = {{p}}if_kiln_quote=>c_reason-pieces ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'WEIGHT' act = {{p}}if_kiln_quote=>c_reason-weight ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD fee_values.
|
||||
DATA lv_exp TYPE {{p}}if_kiln_quote=>ty_amount.
|
||||
lv_exp = '25.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = {{p}}if_kiln_quote=>c_base_small ).
|
||||
lv_exp = '40.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = {{p}}if_kiln_quote=>c_base_medium ).
|
||||
lv_exp = '60.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = {{p}}if_kiln_quote=>c_base_large ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 40 act = {{p}}if_kiln_quote=>c_max_pieces ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 120 act = {{p}}if_kiln_quote=>c_max_weight ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD type_lengths.
|
||||
DATA lv_reason TYPE {{p}}if_kiln_quote=>ty_reason.
|
||||
DATA lv_kiln TYPE {{p}}if_kiln_quote=>ty_kiln.
|
||||
DATA lv_amount TYPE {{p}}if_kiln_quote=>ty_amount.
|
||||
DATA lv_src TYPE string.
|
||||
lv_src = 'ABCDEFGHIJKLM'.
|
||||
lv_reason = lv_src.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'ABCDEFGHIJKL' act = lv_reason ).
|
||||
lv_src = 'ABCDE'.
|
||||
lv_kiln = lv_src.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'ABCD' act = lv_kiln ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 2
|
||||
act = cl_abap_typedescr=>describe_by_data( lv_amount )->decimals ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
78
tasks_gen/train/G1921/spec.md
Normal file
78
tasks_gen/train/G1921/spec.md
Normal file
@@ -0,0 +1,78 @@
|
||||
# 1. Goal
|
||||
|
||||
A pottery studio fires the ceramic pieces of its customers in three kilns. The
|
||||
studio has two front ends: a terminal in the workshop and a web shop. Both front
|
||||
ends must use the same interface for the firing quote. Create this interface.
|
||||
|
||||
# 2. Open questions
|
||||
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
|
||||
- The package is $TMP, client 001.
|
||||
- The interface {{P}}IF_KILN_QUOTE does not exist yet.
|
||||
- The interface is the only object of this task. The two front ends are not part
|
||||
of this task.
|
||||
- The interface has no implementation and no test include.
|
||||
|
||||
# 4. Contract
|
||||
|
||||
Create the public interface {{P}}IF_KILN_QUOTE in package $TMP. The interface has
|
||||
exactly these public components.
|
||||
|
||||
Types:
|
||||
- ty_reason: character, length 12.
|
||||
- ty_kiln: character, length 4.
|
||||
- ty_amount: packed number, length 7, 2 decimal places.
|
||||
- ty_load: structure with the components kiln (ty_kiln), pieces (i), weight_kg (i)
|
||||
and glazed (abap_bool), in this order.
|
||||
- ty_quote: structure with the components kiln (ty_kiln), base (ty_amount),
|
||||
weight (ty_amount), glaze (ty_amount), total (ty_amount) and reason (ty_reason),
|
||||
in this order.
|
||||
|
||||
Constants:
|
||||
- c_kiln: structure with the components small, medium and large. Each component
|
||||
has the type ty_kiln.
|
||||
- c_reason: structure with the components ok, kiln, pieces and weight. Each
|
||||
component has the type ty_reason.
|
||||
- c_base_small, c_base_medium, c_base_large, c_weight_rate and c_glaze_fee: each
|
||||
has the type ty_amount.
|
||||
- c_max_pieces and c_max_weight: each has the type i.
|
||||
|
||||
Methods:
|
||||
- check_load: IMPORTING is_load TYPE ty_load, RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
- kiln_fee: IMPORTING iv_kiln TYPE ty_kiln, RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
- quote: IMPORTING is_load TYPE ty_load, RETURNING VALUE(rs_quote) TYPE ty_quote.
|
||||
|
||||
Do not add other public components.
|
||||
|
||||
# 5. Business rules
|
||||
|
||||
1. The kiln codes are SMAL for the small kiln, MEDI for the medium kiln and LARG
|
||||
for the large kiln.
|
||||
2. The reason codes are OK, KILN, PIECES and WEIGHT. OK means that the load is
|
||||
valid. KILN means that the kiln code is not one of the three kiln codes.
|
||||
PIECES means that the number of pieces is less than 1 or more than
|
||||
c_max_pieces. WEIGHT means that the weight is less than 1 kilogram or more
|
||||
than c_max_weight kilograms.
|
||||
3. The base fee of one firing is 25.00 for the small kiln, 40.00 for the medium
|
||||
kiln and 60.00 for the large kiln.
|
||||
4. The weight fee is 1.50 for each kilogram.
|
||||
5. The glaze surcharge is 8.00 for a glazed load and 0.00 for an unglazed load.
|
||||
6. c_max_pieces is 40. c_max_weight is 120.
|
||||
7. All amounts are in EUR and have 2 decimal places.
|
||||
|
||||
# 6. Constraints
|
||||
|
||||
- Release target: 8.16.
|
||||
- Coding standards: Clean ABAP. No comment that restates the code.
|
||||
- Out of scope: the two front ends and every other object. Do not create a global
|
||||
implementation of the interface.
|
||||
|
||||
# 7. Acceptance
|
||||
|
||||
- The interface {{P}}IF_KILN_QUOTE is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write your own ABAP Unit tests in the global test class {{P}}IF_KILN_QUOTE_TEST
|
||||
in package $TMP.
|
||||
47
tasks_gen/train/G1921/task.json
Normal file
47
tasks_gen/train/G1921/task.json
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"id": "G1921",
|
||||
"category": "A",
|
||||
"object_type": "INTF",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [],
|
||||
"contract": [
|
||||
{
|
||||
"type": "INTF",
|
||||
"name": "{{P}}IF_KILN_QUOTE"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T02_HIDDEN",
|
||||
"file": "hidden/t02_hidden.clas.abap",
|
||||
"description": "Contract tests for {{P}}IF_KILN_QUOTE"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "INTF",
|
||||
"name": "{{P}}IF_KILN_QUOTE",
|
||||
"file": "reference/if_kiln_quote.intf.abap",
|
||||
"description": "Kiln quote contract of the pottery studio"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}IF_KILN_QUOTE_TEST",
|
||||
"file": "reference/if_kiln_quote_test.clas.abap",
|
||||
"description": "Own tests for the interface",
|
||||
"testclasses_file": "reference/if_kiln_quote_test.testclasses.abap"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"db_operation_in_loop"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user