Pipeline controller: plan 2 (hard +, error +50 %), backlog throttle, 2 trajectory workers, stop rules, summaries every 50; budget reserve
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
128
tasks_gen/train/G1046/hidden/tree_hidden.clas.abap
Normal file
128
tasks_gen/train/G1046/hidden/tree_hidden.clas.abap
Normal file
@@ -0,0 +1,128 @@
|
||||
CLASS {{p}}tree_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS call
|
||||
IMPORTING
|
||||
iv_species TYPE string
|
||||
iv_height_cm TYPE i
|
||||
iv_near_house TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_warning TYPE abap_bool
|
||||
ev_subrc TYPE sysubrc.
|
||||
METHODS expect_fee
|
||||
IMPORTING
|
||||
iv_species TYPE string
|
||||
iv_height_cm TYPE i
|
||||
iv_near_house TYPE abap_bool
|
||||
iv_expected TYPE decfloat34.
|
||||
METHODS oak_base_fee FOR TESTING.
|
||||
METHODS pine_base_fee FOR TESTING.
|
||||
METHODS birch_base_fee FOR TESTING.
|
||||
METHODS other_species_fee FOR TESTING.
|
||||
METHODS height_surcharge FOR TESTING.
|
||||
METHODS started_metre_counts FOR TESTING.
|
||||
METHODS house_surcharge FOR TESTING.
|
||||
METHODS house_rounding FOR TESTING.
|
||||
METHODS tall_tree_warning FOR TESTING.
|
||||
METHODS no_warning_normal FOR TESTING.
|
||||
METHODS invalid_height FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}tree_hidden IMPLEMENTATION.
|
||||
METHOD call.
|
||||
ev_fee = 0.
|
||||
ev_warning = abap_false.
|
||||
CALL FUNCTION '{{P}}TREE_FEE'
|
||||
EXPORTING
|
||||
iv_species = iv_species
|
||||
iv_height_cm = iv_height_cm
|
||||
iv_near_house = iv_near_house
|
||||
IMPORTING
|
||||
ev_fee = ev_fee
|
||||
ev_warning = ev_warning
|
||||
EXCEPTIONS
|
||||
invalid_height = 1
|
||||
OTHERS = 2.
|
||||
ev_subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD expect_fee.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
call( EXPORTING iv_species = iv_species iv_height_cm = iv_height_cm
|
||||
iv_near_house = iv_near_house
|
||||
IMPORTING ev_fee = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = iv_expected act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD oak_base_fee.
|
||||
expect_fee( EXPORTING iv_species = 'OAK' iv_height_cm = 300
|
||||
iv_near_house = abap_false iv_expected = 200 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD pine_base_fee.
|
||||
expect_fee( EXPORTING iv_species = 'PINE' iv_height_cm = 400
|
||||
iv_near_house = abap_false iv_expected = 150 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD birch_base_fee.
|
||||
expect_fee( EXPORTING iv_species = 'BIRCH' iv_height_cm = 300
|
||||
iv_near_house = abap_false iv_expected = 120 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD other_species_fee.
|
||||
expect_fee( EXPORTING iv_species = 'ELM' iv_height_cm = 300
|
||||
iv_near_house = abap_false iv_expected = 100 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD height_surcharge.
|
||||
expect_fee( EXPORTING iv_species = 'OAK' iv_height_cm = 620
|
||||
iv_near_house = abap_false iv_expected = 250 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD started_metre_counts.
|
||||
expect_fee( EXPORTING iv_species = 'PINE' iv_height_cm = 501
|
||||
iv_near_house = abap_false iv_expected = 175 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD house_surcharge.
|
||||
expect_fee( EXPORTING iv_species = 'OAK' iv_height_cm = 620
|
||||
iv_near_house = abap_true iv_expected = '281.25' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD house_rounding.
|
||||
expect_fee( EXPORTING iv_species = 'ELM' iv_height_cm = 550
|
||||
iv_near_house = abap_true iv_expected = '140.63' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD tall_tree_warning.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_warning TYPE abap_bool.
|
||||
call( EXPORTING iv_species = 'OAK' iv_height_cm = 2500
|
||||
iv_near_house = abap_false
|
||||
IMPORTING ev_fee = lv_fee ev_warning = lv_warning ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1200 act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_true act = lv_warning ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD no_warning_normal.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_warning TYPE abap_bool.
|
||||
call( EXPORTING iv_species = 'OAK' iv_height_cm = 1000
|
||||
iv_near_house = abap_false
|
||||
IMPORTING ev_fee = lv_fee ev_warning = lv_warning ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 325 act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_false act = lv_warning ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_height.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
call( EXPORTING iv_species = 'OAK' iv_height_cm = 0 iv_near_house = abap_false
|
||||
IMPORTING ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_subrc ).
|
||||
call( EXPORTING iv_species = 'OAK' iv_height_cm = -5 iv_near_house = abap_false
|
||||
IMPORTING ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_subrc ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user