Snapshot: new training tasks (balanced generation), docs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
53
tasks_gen/train/G1953/reference/if_piano_tuning.intf.abap
Normal file
53
tasks_gen/train/G1953/reference/if_piano_tuning.intf.abap
Normal file
@@ -0,0 +1,53 @@
|
||||
INTERFACE {{p}}if_piano_tuning PUBLIC.
|
||||
TYPES:
|
||||
ty_code TYPE c LENGTH 10,
|
||||
ty_model TYPE c LENGTH 4,
|
||||
ty_visit_id TYPE c LENGTH 8,
|
||||
BEGIN OF ty_visit,
|
||||
visit_id TYPE ty_visit_id,
|
||||
model TYPE ty_model,
|
||||
pitch_dev TYPE i,
|
||||
distance_km TYPE i,
|
||||
piano_count TYPE i,
|
||||
END OF ty_visit,
|
||||
tt_visits TYPE STANDARD TABLE OF ty_visit WITH EMPTY KEY,
|
||||
BEGIN OF ty_summary,
|
||||
accepted TYPE i,
|
||||
rejected TYPE i,
|
||||
first_code TYPE ty_code,
|
||||
END OF ty_summary.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_code,
|
||||
ok TYPE ty_code VALUE 'OK',
|
||||
no_visit TYPE ty_code VALUE 'NO_VISIT',
|
||||
model TYPE ty_code VALUE 'MODEL',
|
||||
pitch TYPE ty_code VALUE 'PITCH',
|
||||
distance TYPE ty_code VALUE 'DISTANCE',
|
||||
too_many TYPE ty_code VALUE 'COUNT',
|
||||
END OF c_code,
|
||||
c_max_pitch TYPE i VALUE 25,
|
||||
c_max_distance TYPE i VALUE 60,
|
||||
c_max_pianos TYPE i VALUE 3.
|
||||
|
||||
METHODS check_visit
|
||||
IMPORTING is_visit TYPE ty_visit
|
||||
RETURNING VALUE(rv_code) TYPE ty_code.
|
||||
|
||||
METHODS check_visits
|
||||
IMPORTING it_visits TYPE tt_visits
|
||||
RETURNING VALUE(rv_code) TYPE ty_code.
|
||||
|
||||
METHODS summarise
|
||||
IMPORTING it_visits TYPE tt_visits
|
||||
RETURNING VALUE(rs_summary) TYPE ty_summary.
|
||||
|
||||
METHODS count_blocked
|
||||
IMPORTING it_visits TYPE tt_visits
|
||||
EXPORTING ev_count TYPE i
|
||||
ev_code TYPE ty_code.
|
||||
|
||||
METHODS is_tuning_model
|
||||
IMPORTING iv_model TYPE ty_model
|
||||
RETURNING VALUE(rv_tuning) TYPE abap_bool.
|
||||
ENDINTERFACE.
|
||||
110
tasks_gen/train/G1953/reference/piano_tuning_test.clas.abap
Normal file
110
tasks_gen/train/G1953/reference/piano_tuning_test.clas.abap
Normal file
@@ -0,0 +1,110 @@
|
||||
CLASS {{p}}piano_tuning_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_piano_tuning.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}if_piano_tuning.
|
||||
METHODS setup.
|
||||
METHODS code_values FOR TESTING.
|
||||
METHODS number_values FOR TESTING.
|
||||
METHODS type_lengths FOR TESTING.
|
||||
METHODS visit_structure FOR TESTING.
|
||||
METHODS methods_are_callable FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}piano_tuning_test IMPLEMENTATION.
|
||||
METHOD {{p}}if_piano_tuning~check_visit.
|
||||
rv_code = {{p}}if_piano_tuning=>c_code-ok.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_piano_tuning~check_visits.
|
||||
rv_code = {{p}}if_piano_tuning=>c_code-ok.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_piano_tuning~summarise.
|
||||
rs_summary = VALUE #( accepted = lines( it_visits )
|
||||
first_code = {{p}}if_piano_tuning=>c_code-ok ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_piano_tuning~count_blocked.
|
||||
ev_count = lines( it_visits ).
|
||||
ev_code = {{p}}if_piano_tuning=>c_code-ok.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_piano_tuning~is_tuning_model.
|
||||
rv_tuning = abap_true.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD setup.
|
||||
mo_cut = me.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD code_values.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'OK' act = {{p}}if_piano_tuning=>c_code-ok ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'NO_VISIT' act = {{p}}if_piano_tuning=>c_code-no_visit ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'MODEL' act = {{p}}if_piano_tuning=>c_code-model ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'PITCH' act = {{p}}if_piano_tuning=>c_code-pitch ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'DISTANCE' act = {{p}}if_piano_tuning=>c_code-distance ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'COUNT' act = {{p}}if_piano_tuning=>c_code-too_many ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD number_values.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 25 act = {{p}}if_piano_tuning=>c_max_pitch ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 60 act = {{p}}if_piano_tuning=>c_max_distance ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = {{p}}if_piano_tuning=>c_max_pianos ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD type_lengths.
|
||||
DATA lv_code TYPE {{p}}if_piano_tuning=>ty_code.
|
||||
DATA lv_model TYPE {{p}}if_piano_tuning=>ty_model.
|
||||
DATA lv_visit_id TYPE {{p}}if_piano_tuning=>ty_visit_id.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 10
|
||||
act = cl_abap_typedescr=>describe_by_data( lv_code )->length ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 4
|
||||
act = cl_abap_typedescr=>describe_by_data( lv_model )->length ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 8
|
||||
act = cl_abap_typedescr=>describe_by_data( lv_visit_id )->length ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD visit_structure.
|
||||
DATA ls_visit TYPE {{p}}if_piano_tuning=>ty_visit.
|
||||
DATA lt_visits TYPE {{p}}if_piano_tuning=>tt_visits.
|
||||
ls_visit-visit_id = 'V-000010'.
|
||||
ls_visit-model = 'UPRI'.
|
||||
ls_visit-pitch_dev = 12.
|
||||
ls_visit-distance_km = 30.
|
||||
ls_visit-piano_count = 2.
|
||||
INSERT ls_visit INTO TABLE lt_visits.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_visits ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD methods_are_callable.
|
||||
DATA ls_visit TYPE {{p}}if_piano_tuning=>ty_visit.
|
||||
DATA lt_visits TYPE {{p}}if_piano_tuning=>tt_visits.
|
||||
DATA ls_summary TYPE {{p}}if_piano_tuning=>ty_summary.
|
||||
DATA lv_count TYPE i.
|
||||
DATA lv_code TYPE {{p}}if_piano_tuning=>ty_code.
|
||||
DATA lv_model TYPE {{p}}if_piano_tuning=>ty_model.
|
||||
lv_model = 'UPRI'.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_piano_tuning=>c_code-ok
|
||||
act = mo_cut->check_visit( ls_visit ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = {{p}}if_piano_tuning=>c_code-ok
|
||||
act = mo_cut->check_visits( lt_visits ) ).
|
||||
ls_summary = mo_cut->summarise( lt_visits ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = ls_summary-accepted ).
|
||||
mo_cut->count_blocked(
|
||||
EXPORTING it_visits = lt_visits
|
||||
IMPORTING ev_count = lv_count
|
||||
ev_code = lv_code ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_count ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = abap_true
|
||||
act = mo_cut->is_tuning_model( lv_model ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user