Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
19
tasks_gen/train/G1056/reference/cx_tyre_error.clas.abap
Normal file
19
tasks_gen/train/G1056/reference/cx_tyre_error.clas.abap
Normal file
@@ -0,0 +1,19 @@
|
||||
CLASS {{p}}cx_tyre_error DEFINITION
|
||||
PUBLIC
|
||||
INHERITING FROM cx_static_check
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
METHODS constructor
|
||||
IMPORTING iv_text TYPE string.
|
||||
|
||||
DATA mv_text TYPE string READ-ONLY.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_tyre_error IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( ).
|
||||
mv_text = iv_text.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
16
tasks_gen/train/G1056/reference/cx_tyre_load.clas.abap
Normal file
16
tasks_gen/train/G1056/reference/cx_tyre_load.clas.abap
Normal file
@@ -0,0 +1,16 @@
|
||||
CLASS {{p}}cx_tyre_load DEFINITION
|
||||
PUBLIC
|
||||
INHERITING FROM {{p}}cx_tyre_error
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
METHODS constructor.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_tyre_load IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( iv_text = 'Load index is too low' ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
16
tasks_gen/train/G1056/reference/cx_tyre_qty.clas.abap
Normal file
16
tasks_gen/train/G1056/reference/cx_tyre_qty.clas.abap
Normal file
@@ -0,0 +1,16 @@
|
||||
CLASS {{p}}cx_tyre_qty DEFINITION
|
||||
PUBLIC
|
||||
INHERITING FROM {{p}}cx_tyre_error
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
METHODS constructor.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_tyre_qty IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( iv_text = 'Quantity must be between 1 and 4' ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
16
tasks_gen/train/G1056/reference/cx_tyre_size.clas.abap
Normal file
16
tasks_gen/train/G1056/reference/cx_tyre_size.clas.abap
Normal file
@@ -0,0 +1,16 @@
|
||||
CLASS {{p}}cx_tyre_size DEFINITION
|
||||
PUBLIC
|
||||
INHERITING FROM {{p}}cx_tyre_error
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
METHODS constructor.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_tyre_size IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( iv_text = 'Tyre size does not match the vehicle' ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
16
tasks_gen/train/G1056/reference/cx_tyre_speed.clas.abap
Normal file
16
tasks_gen/train/G1056/reference/cx_tyre_speed.clas.abap
Normal file
@@ -0,0 +1,16 @@
|
||||
CLASS {{p}}cx_tyre_speed DEFINITION
|
||||
PUBLIC
|
||||
INHERITING FROM {{p}}cx_tyre_error
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
METHODS constructor.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_tyre_speed IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( iv_text = 'Speed rating is too low' ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
72
tasks_gen/train/G1056/reference/tyre_checker.clas.abap
Normal file
72
tasks_gen/train/G1056/reference/tyre_checker.clas.abap
Normal file
@@ -0,0 +1,72 @@
|
||||
CLASS {{p}}tyre_checker DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
METHODS constructor
|
||||
IMPORTING is_vehicle TYPE {{p}}if_tyre_order=>ty_vehicle.
|
||||
|
||||
METHODS check_order
|
||||
IMPORTING is_order TYPE {{p}}if_tyre_order=>ty_order
|
||||
RAISING {{p}}cx_tyre_qty
|
||||
{{p}}cx_tyre_size
|
||||
{{p}}cx_tyre_load
|
||||
{{p}}cx_tyre_speed.
|
||||
|
||||
PRIVATE SECTION.
|
||||
DATA ms_vehicle TYPE {{p}}if_tyre_order=>ty_vehicle.
|
||||
|
||||
METHODS check_qty
|
||||
IMPORTING is_order TYPE {{p}}if_tyre_order=>ty_order
|
||||
RAISING {{p}}cx_tyre_qty.
|
||||
METHODS check_size
|
||||
IMPORTING is_order TYPE {{p}}if_tyre_order=>ty_order
|
||||
RAISING {{p}}cx_tyre_size.
|
||||
METHODS check_load
|
||||
IMPORTING is_order TYPE {{p}}if_tyre_order=>ty_order
|
||||
RAISING {{p}}cx_tyre_load.
|
||||
METHODS check_speed
|
||||
IMPORTING is_order TYPE {{p}}if_tyre_order=>ty_order
|
||||
RAISING {{p}}cx_tyre_speed.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}tyre_checker IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
ms_vehicle = is_vehicle.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_order.
|
||||
check_qty( is_order ).
|
||||
check_size( is_order ).
|
||||
check_load( is_order ).
|
||||
check_speed( is_order ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_qty.
|
||||
IF is_order-qty < 1 OR is_order-qty > 4.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_tyre_qty.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_size.
|
||||
IF is_order-width_mm <> ms_vehicle-width_mm
|
||||
OR is_order-profile_pct <> ms_vehicle-profile_pct
|
||||
OR is_order-rim_inch <> ms_vehicle-rim_inch.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_tyre_size.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_load.
|
||||
IF is_order-load_index < ms_vehicle-load_index.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_tyre_load.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_speed.
|
||||
IF is_order-speed_kmh < ms_vehicle-speed_kmh.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_tyre_speed.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -0,0 +1,96 @@
|
||||
CLASS ltc_tyre_checker DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}tyre_checker.
|
||||
|
||||
METHODS setup.
|
||||
METHODS accepts_valid_order FOR TESTING.
|
||||
METHODS rejects_bad_qty FOR TESTING.
|
||||
METHODS rejects_wrong_size FOR TESTING.
|
||||
METHODS rejects_low_load FOR TESTING.
|
||||
METHODS rejects_low_speed FOR TESTING.
|
||||
METHODS reports_qty_message FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_tyre_checker IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}tyre_checker(
|
||||
is_vehicle = VALUE #( width_mm = 205 profile_pct = 55 rim_inch = 16
|
||||
load_index = 91 speed_kmh = 240 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD accepts_valid_order.
|
||||
TRY.
|
||||
mo_cut->check_order(
|
||||
is_order = VALUE #( width_mm = 205 profile_pct = 55 rim_inch = 16
|
||||
load_index = 91 speed_kmh = 240 qty = 4 ) ).
|
||||
CATCH {{p}}cx_tyre_error INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>fail( |Unexpected exception: { lo_error->mv_text }| ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_bad_qty.
|
||||
TRY.
|
||||
mo_cut->check_order(
|
||||
is_order = VALUE #( width_mm = 205 profile_pct = 55 rim_inch = 16
|
||||
load_index = 91 speed_kmh = 240 qty = 0 ) ).
|
||||
cl_abap_unit_assert=>fail( `An exception is expected` ).
|
||||
CATCH {{p}}cx_tyre_error INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Quantity must be between 1 and 4`
|
||||
act = lo_error->mv_text ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_wrong_size.
|
||||
TRY.
|
||||
mo_cut->check_order(
|
||||
is_order = VALUE #( width_mm = 205 profile_pct = 60 rim_inch = 16
|
||||
load_index = 91 speed_kmh = 240 qty = 2 ) ).
|
||||
cl_abap_unit_assert=>fail( `An exception is expected` ).
|
||||
CATCH {{p}}cx_tyre_error INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Tyre size does not match the vehicle`
|
||||
act = lo_error->mv_text ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_low_load.
|
||||
TRY.
|
||||
mo_cut->check_order(
|
||||
is_order = VALUE #( width_mm = 205 profile_pct = 55 rim_inch = 16
|
||||
load_index = 90 speed_kmh = 240 qty = 2 ) ).
|
||||
cl_abap_unit_assert=>fail( `An exception is expected` ).
|
||||
CATCH {{p}}cx_tyre_error INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Load index is too low`
|
||||
act = lo_error->mv_text ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_low_speed.
|
||||
TRY.
|
||||
mo_cut->check_order(
|
||||
is_order = VALUE #( width_mm = 205 profile_pct = 55 rim_inch = 16
|
||||
load_index = 91 speed_kmh = 230 qty = 2 ) ).
|
||||
cl_abap_unit_assert=>fail( `An exception is expected` ).
|
||||
CATCH {{p}}cx_tyre_error INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Speed rating is too low`
|
||||
act = lo_error->mv_text ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reports_qty_message.
|
||||
TRY.
|
||||
mo_cut->check_order(
|
||||
is_order = VALUE #( width_mm = 205 profile_pct = 55 rim_inch = 16
|
||||
load_index = 91 speed_kmh = 240 qty = 5 ) ).
|
||||
cl_abap_unit_assert=>fail( `An exception is expected` ).
|
||||
CATCH {{p}}cx_tyre_error INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Quantity must be between 1 and 4`
|
||||
act = lo_error->mv_text ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user