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/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.
|
||||
Reference in New Issue
Block a user