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,76 @@
CLASS {{p}}water_bill_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
TYPES ty_amount TYPE p LENGTH 8 DECIMALS 2.
DATA mo_cut TYPE REF TO {{p}}water_bill.
METHODS setup.
METHODS assert_bill
IMPORTING iv_consumption TYPE i
iv_days TYPE i
iv_expected TYPE ty_amount.
METHODS zero_consumption FOR TESTING.
METHODS first_tier_only FOR TESTING.
METHODS second_tier FOR TESTING.
METHODS tier_boundary_50 FOR TESTING.
METHODS third_tier FOR TESTING.
METHODS sewage_rounding FOR TESTING.
METHODS standing_charge_only FOR TESTING.
METHODS below_minimum FOR TESTING.
METHODS large_consumption FOR TESTING.
ENDCLASS.
CLASS {{p}}water_bill_test IMPLEMENTATION.
METHOD setup.
mo_cut = NEW {{p}}water_bill( ).
ENDMETHOD.
METHOD assert_bill.
DATA(lv_actual) = CONV ty_amount( mo_cut->calculate( iv_consumption = iv_consumption
iv_days = iv_days ) ).
cl_abap_unit_assert=>assert_equals(
exp = iv_expected
act = lv_actual
msg = |consumption { iv_consumption } cbm, { iv_days } days| ).
ENDMETHOD.
METHOD zero_consumption.
assert_bill( iv_consumption = 0 iv_days = 30 iv_expected = '35.00' ).
ENDMETHOD.
METHOD first_tier_only.
assert_bill( iv_consumption = 20 iv_days = 1 iv_expected = '68.91' ).
ENDMETHOD.
METHOD second_tier.
assert_bill( iv_consumption = 30 iv_days = 1 iv_expected = '114.55' ).
ENDMETHOD.
METHOD tier_boundary_50.
assert_bill( iv_consumption = 50 iv_days = 1 iv_expected = '205.83' ).
ENDMETHOD.
METHOD third_tier.
assert_bill( iv_consumption = 60 iv_days = 1 iv_expected = '264.51' ).
ENDMETHOD.
METHOD sewage_rounding.
assert_bill( iv_consumption = 22 iv_days = 1 iv_expected = '78.04' ).
ENDMETHOD.
METHOD standing_charge_only.
assert_bill( iv_consumption = 0 iv_days = 100 iv_expected = '45.00' ).
ENDMETHOD.
METHOD below_minimum.
assert_bill( iv_consumption = 4 iv_days = 30 iv_expected = '35.00' ).
ENDMETHOD.
METHOD large_consumption.
assert_bill( iv_consumption = 120 iv_days = 90 iv_expected = '656.64' ).
ENDMETHOD.
ENDCLASS.