Step F first pass: 81/92 accepted; budget floor 60 calls; rejected slots moved for regeneration

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
Kral
2026-10-03 12:10:52 +02:00
parent d3250acfb8
commit 39769afce8
741 changed files with 40573 additions and 317 deletions

View File

@@ -0,0 +1,40 @@
FUNCTION {{p}}sort_bin
IMPORTING
iv_size_code TYPE string
iv_weight_kg TYPE decfloat34
EXPORTING
ev_bin TYPE i
ev_fee TYPE decfloat34
EXCEPTIONS
invalid_weight
overweight.
IF iv_weight_kg <= 0.
RAISE invalid_weight.
ENDIF.
IF iv_weight_kg > '31.5'.
RAISE overweight.
ENDIF.
CASE iv_size_code.
WHEN 'S'.
ev_bin = 1.
ev_fee = '1.50'.
WHEN 'M'.
ev_bin = 2.
ev_fee = '2.00'.
WHEN 'L'.
ev_bin = 3.
ev_fee = '3.00'.
WHEN 'XL'.
ev_bin = 4.
ev_fee = '5.00'.
WHEN OTHERS.
" The specification does not define this case. The assumption here is
" that the sorting centre rejects the parcel.
ev_bin = 0.
ev_fee = 0.
ENDCASE.
ENDFUNCTION.

View File

@@ -0,0 +1,62 @@
CLASS {{p}}sort_bin_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS call
IMPORTING
iv_code TYPE string
iv_weight TYPE decfloat34
EXPORTING
ev_bin TYPE i
ev_fee TYPE decfloat34
ev_subrc TYPE sysubrc.
METHODS small_parcel FOR TESTING.
METHODS extra_large_parcel FOR TESTING.
METHODS overweight_rejected FOR TESTING.
METHODS zero_weight_rejected FOR TESTING.
ENDCLASS.
CLASS {{p}}sort_bin_test IMPLEMENTATION.
METHOD call.
CALL FUNCTION '{{P}}SORT_BIN'
EXPORTING
iv_size_code = iv_code
iv_weight_kg = iv_weight
IMPORTING
ev_bin = ev_bin
ev_fee = ev_fee
EXCEPTIONS
invalid_weight = 1
overweight = 2
OTHERS = 3.
ev_subrc = sy-subrc.
ENDMETHOD.
METHOD small_parcel.
call( EXPORTING iv_code = `S` iv_weight = '2.5'
IMPORTING ev_bin = DATA(lv_bin) ev_fee = DATA(lv_fee) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_bin ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '1.50' ) act = lv_fee ).
ENDMETHOD.
METHOD extra_large_parcel.
call( EXPORTING iv_code = `XL` iv_weight = '30'
IMPORTING ev_bin = DATA(lv_bin) ev_fee = DATA(lv_fee) ).
cl_abap_unit_assert=>assert_equals( exp = 4 act = lv_bin ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '5.00' ) act = lv_fee ).
ENDMETHOD.
METHOD overweight_rejected.
call( EXPORTING iv_code = `M` iv_weight = '32'
IMPORTING ev_subrc = DATA(lv_rc) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_rc ).
ENDMETHOD.
METHOD zero_weight_rejected.
call( EXPORTING iv_code = `S` iv_weight = 0
IMPORTING ev_subrc = DATA(lv_rc) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
ENDMETHOD.
ENDCLASS.