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,93 @@
CLASS {{p}}sewer_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS fee_for
IMPORTING
iv_litres TYPE i
iv_km TYPE i DEFAULT 0
RETURNING VALUE(rv_fee) TYPE decfloat34.
METHODS base_fee FOR TESTING.
METHODS volume_steps FOR TESTING.
METHODS travel_fee FOR TESTING.
METHODS fee_cap FOR TESTING.
METHODS mains_sewer FOR TESTING.
METHODS invalid_litres FOR TESTING.
ENDCLASS.
CLASS {{p}}sewer_test IMPLEMENTATION.
METHOD fee_for.
DATA lv_skip TYPE abap_bool.
CALL FUNCTION '{{P}}SEWER_FEE'
EXPORTING
iv_tank_litres = iv_litres
iv_distance_km = iv_km
iv_mains_sewer = abap_false
IMPORTING
ev_skip = lv_skip
CHANGING
cv_fee = rv_fee
EXCEPTIONS
invalid_litres = 1
OTHERS = 2.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
ENDMETHOD.
METHOD base_fee.
cl_abap_unit_assert=>assert_equals(
exp = CONV decfloat34( 75 )
act = fee_for( iv_litres = 1000 ) ).
ENDMETHOD.
METHOD volume_steps.
cl_abap_unit_assert=>assert_equals(
exp = CONV decfloat34( 95 )
act = fee_for( iv_litres = 1500 ) ).
cl_abap_unit_assert=>assert_equals(
exp = CONV decfloat34( 115 )
act = fee_for( iv_litres = 1501 ) ).
ENDMETHOD.
METHOD travel_fee.
cl_abap_unit_assert=>assert_equals(
exp = CONV decfloat34( 90 )
act = fee_for( iv_litres = 1000 iv_km = 10 ) ).
ENDMETHOD.
METHOD fee_cap.
cl_abap_unit_assert=>assert_equals(
exp = CONV decfloat34( 900 )
act = fee_for( iv_litres = 30000 ) ).
ENDMETHOD.
METHOD mains_sewer.
DATA lv_fee TYPE decfloat34 VALUE 7.
DATA lv_skip TYPE abap_bool.
CALL FUNCTION '{{P}}SEWER_FEE'
EXPORTING
iv_tank_litres = 2000
iv_distance_km = 20
iv_mains_sewer = abap_true
IMPORTING
ev_skip = lv_skip
CHANGING
cv_fee = lv_fee.
cl_abap_unit_assert=>assert_true( lv_skip ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 7 ) act = lv_fee ).
ENDMETHOD.
METHOD invalid_litres.
DATA lv_fee TYPE decfloat34.
CALL FUNCTION '{{P}}SEWER_FEE'
EXPORTING
iv_tank_litres = 0
iv_distance_km = 0
iv_mains_sewer = abap_false
CHANGING
cv_fee = lv_fee
EXCEPTIONS
invalid_litres = 1
OTHERS = 2.
cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ).
ENDMETHOD.
ENDCLASS.