- generator: budget floor (2x oracle activations, 3x calls), static checks for CDS $parameters and UNION annotation - harness/mutation.py: deterministic mutants of the reference; hidden tests must fail - G0022 revalidated with harness fixes: oracle 100, null 0 - results in docs/faz1-tasarim.md 11f Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
74 lines
2.6 KiB
ABAP
74 lines
2.6 KiB
ABAP
CLASS {{p}}e01_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
|
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
|
PRIVATE SECTION.
|
|
DATA mo_cut TYPE REF TO {{p}}if_freight_calc.
|
|
METHODS setup.
|
|
METHODS assert_cost
|
|
IMPORTING iv_zone TYPE {{p}}if_freight_calc=>ty_zone
|
|
iv_weight TYPE {{p}}if_freight_calc=>ty_weight
|
|
iv_exp TYPE {{p}}if_freight_calc=>ty_amount.
|
|
METHODS unknown_zone_is_zero FOR TESTING.
|
|
METHODS minimum_applies_after_charge FOR TESTING.
|
|
METHODS weight_charge_rounds_half_up FOR TESTING.
|
|
METHODS all_zones_are_rated FOR TESTING.
|
|
METHODS surcharge_uses_minimum FOR TESTING.
|
|
METHODS heavy_discount_on_total FOR TESTING.
|
|
METHODS no_discount_at_exactly_1000 FOR TESTING.
|
|
METHODS discount_rounds_half_up FOR TESTING.
|
|
METHODS small_weight_uses_minimum FOR TESTING.
|
|
ENDCLASS.
|
|
|
|
|
|
CLASS {{p}}e01_hidden IMPLEMENTATION.
|
|
METHOD setup.
|
|
mo_cut = NEW {{p}}freight_calculator( ).
|
|
ENDMETHOD.
|
|
|
|
METHOD assert_cost.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = iv_exp
|
|
act = mo_cut->calculate( iv_zone = iv_zone iv_weight = iv_weight )
|
|
msg = |zone { iv_zone }, weight { iv_weight }| ).
|
|
ENDMETHOD.
|
|
|
|
METHOD unknown_zone_is_zero.
|
|
assert_cost( iv_zone = 'XX' iv_weight = '500.000' iv_exp = '0.00' ).
|
|
ENDMETHOD.
|
|
|
|
METHOD minimum_applies_after_charge.
|
|
assert_cost( iv_zone = 'DE' iv_weight = '1.000' iv_exp = '26.63' ).
|
|
ENDMETHOD.
|
|
|
|
METHOD weight_charge_rounds_half_up.
|
|
assert_cost( iv_zone = 'CN' iv_weight = '20.004' iv_exp = '54.76' ).
|
|
ENDMETHOD.
|
|
|
|
METHOD all_zones_are_rated.
|
|
assert_cost( iv_zone = 'DE' iv_weight = '100.000' iv_exp = '103.84' ).
|
|
assert_cost( iv_zone = 'FR' iv_weight = '20.000' iv_exp = '39.78' ).
|
|
assert_cost( iv_zone = 'NL' iv_weight = '50.000' iv_exp = '50.11' ).
|
|
assert_cost( iv_zone = 'US' iv_weight = '50.000' iv_exp = '97.65' ).
|
|
assert_cost( iv_zone = 'CN' iv_weight = '100.000' iv_exp = '164.25' ).
|
|
ENDMETHOD.
|
|
|
|
METHOD surcharge_uses_minimum.
|
|
assert_cost( iv_zone = 'NL' iv_weight = '0.000' iv_exp = '21.10' ).
|
|
ENDMETHOD.
|
|
|
|
METHOD heavy_discount_on_total.
|
|
assert_cost( iv_zone = 'DE' iv_weight = '1500.000' iv_exp = '1302.63' ).
|
|
ENDMETHOD.
|
|
|
|
METHOD no_discount_at_exactly_1000.
|
|
assert_cost( iv_zone = 'DE' iv_weight = '1000.000' iv_exp = '918.56' ).
|
|
ENDMETHOD.
|
|
|
|
METHOD discount_rounds_half_up.
|
|
assert_cost( iv_zone = 'DE' iv_weight = '1090.070' iv_exp = '950.10' ).
|
|
ENDMETHOD.
|
|
|
|
METHOD small_weight_uses_minimum.
|
|
assert_cost( iv_zone = 'FR' iv_weight = '5.000' iv_exp = '32.25' ).
|
|
ENDMETHOD.
|
|
ENDCLASS.
|