Stage 2 summary at 50 accepted trajectories

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-05 18:02:52 +02:00
parent 332fb4601d
commit 5bcd1bf9cd
1230 changed files with 77563 additions and 33 deletions

View File

@@ -0,0 +1,129 @@
CLASS {{p}}t31_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS call
IMPORTING
iv_width TYPE i
iv_height TYPE i
iv_glass TYPE string
iv_urgent TYPE abap_bool DEFAULT abap_false
EXPORTING
ev_fee TYPE decfloat34
ev_subrc TYPE sysubrc.
METHODS simple_pane_fee FOR TESTING.
METHODS minimum_fee FOR TESTING.
METHODS safety_pane_fee FOR TESTING.
METHODS insulated_pane_fee FOR TESTING.
METHODS rounding_half_up FOR TESTING.
METHODS urgent_surcharge FOR TESTING.
METHODS urgent_after_minimum FOR TESTING.
METHODS maximum_fee FOR TESTING.
METHODS invalid_size_rejected FOR TESTING.
METHODS invalid_glass_rejected FOR TESTING.
METHODS class_calculates_fee FOR TESTING.
METHODS class_rejects_bad_size FOR TESTING.
ENDCLASS.
CLASS {{p}}t31_hidden IMPLEMENTATION.
METHOD call.
CALL FUNCTION '{{P}}GLAZ_FEE'
EXPORTING
iv_width_mm = iv_width
iv_height_mm = iv_height
iv_glass = iv_glass
iv_urgent = iv_urgent
IMPORTING
ev_fee = ev_fee
EXCEPTIONS
invalid_input = 1
OTHERS = 2.
ev_subrc = sy-subrc.
ENDMETHOD.
METHOD simple_pane_fee.
call( EXPORTING iv_width = 1000 iv_height = 1000 iv_glass = `SIMPLE`
IMPORTING ev_fee = DATA(lv_fee) ev_subrc = DATA(lv_rc) ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '45.00' ) act = lv_fee ).
ENDMETHOD.
METHOD minimum_fee.
call( EXPORTING iv_width = 500 iv_height = 400 iv_glass = `SIMPLE`
IMPORTING ev_fee = DATA(lv_fee) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '35.00' ) act = lv_fee ).
ENDMETHOD.
METHOD safety_pane_fee.
call( EXPORTING iv_width = 1200 iv_height = 800 iv_glass = `SAFETY`
IMPORTING ev_fee = DATA(lv_fee) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '86.40' ) act = lv_fee ).
ENDMETHOD.
METHOD insulated_pane_fee.
call( EXPORTING iv_width = 2000 iv_height = 1500 iv_glass = `INSULATED`
IMPORTING ev_fee = DATA(lv_fee) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '420.00' ) act = lv_fee ).
ENDMETHOD.
METHOD rounding_half_up.
call( EXPORTING iv_width = 1000 iv_height = 1001 iv_glass = `SIMPLE`
IMPORTING ev_fee = DATA(lv_fee) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '45.05' ) act = lv_fee ).
ENDMETHOD.
METHOD urgent_surcharge.
call( EXPORTING iv_width = 1000 iv_height = 1000 iv_glass = `SIMPLE` iv_urgent = abap_true
IMPORTING ev_fee = DATA(lv_fee) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '67.50' ) act = lv_fee ).
ENDMETHOD.
METHOD urgent_after_minimum.
call( EXPORTING iv_width = 500 iv_height = 400 iv_glass = `SIMPLE` iv_urgent = abap_true
IMPORTING ev_fee = DATA(lv_fee) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '52.50' ) act = lv_fee ).
ENDMETHOD.
METHOD maximum_fee.
call( EXPORTING iv_width = 2000 iv_height = 1500 iv_glass = `INSULATED` iv_urgent = abap_true
IMPORTING ev_fee = DATA(lv_fee) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '480.00' ) act = lv_fee ).
ENDMETHOD.
METHOD invalid_size_rejected.
call( EXPORTING iv_width = 0 iv_height = 1000 iv_glass = `SIMPLE`
IMPORTING ev_subrc = DATA(lv_rc) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
call( EXPORTING iv_width = 1000 iv_height = -5 iv_glass = `SIMPLE`
IMPORTING ev_subrc = DATA(lv_rc2) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc2 ).
ENDMETHOD.
METHOD invalid_glass_rejected.
call( EXPORTING iv_width = 1000 iv_height = 1000 iv_glass = `TINTED`
IMPORTING ev_subrc = DATA(lv_rc) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
ENDMETHOD.
METHOD class_calculates_fee.
DATA(lo_calc) = NEW {{p}}glaz_calc( ).
TRY.
DATA(lv_fee) = lo_calc->calculate( iv_width_mm = 1200 iv_height_mm = 800
iv_glass = `SAFETY` iv_urgent = abap_false ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '86.40' ) act = lv_fee ).
CATCH cx_abap_invalid_value.
cl_abap_unit_assert=>fail( msg = `valid input was rejected` ).
ENDTRY.
ENDMETHOD.
METHOD class_rejects_bad_size.
DATA(lo_calc) = NEW {{p}}glaz_calc( ).
TRY.
lo_calc->calculate( iv_width_mm = 1000 iv_height_mm = 0
iv_glass = `SIMPLE` iv_urgent = abap_false ).
cl_abap_unit_assert=>fail( msg = `invalid size was accepted` ).
CATCH cx_abap_invalid_value.
cl_abap_unit_assert=>assert_true( abap_true ).
ENDTRY.
ENDMETHOD.
ENDCLASS.