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,28 @@
CLASS {{p}}cx_grain DEFINITION PUBLIC FINAL CREATE PUBLIC INHERITING FROM cx_static_check.
PUBLIC SECTION.
DATA mv_reason TYPE string READ-ONLY.
DATA mv_text TYPE string READ-ONLY.
METHODS constructor IMPORTING iv_reason TYPE string.
ENDCLASS.
CLASS {{p}}cx_grain IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
mv_reason = iv_reason.
CASE iv_reason.
WHEN 'WEIGHT'.
mv_text = 'Weight must be greater than zero'.
WHEN 'SUPPLIER'.
mv_text = 'Supplier is not filled'.
WHEN 'GRAIN_TYPE'.
mv_text = 'Grain type is not supported'.
WHEN 'MOISTURE_RANGE'.
mv_text = 'Moisture is outside the range 0 to 100'.
WHEN 'MOISTURE'.
mv_text = 'Moisture is above the limit of the grain type'.
WHEN OTHERS.
mv_text = 'Unknown reason'.
ENDCASE.
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,55 @@
FUNCTION {{p}}grain_check
IMPORTING
iv_grain_type TYPE string
iv_weight_kg TYPE decfloat34
iv_moisture_pct TYPE decfloat34
iv_supplier TYPE string
EXPORTING
ev_accepted TYPE abap_bool
ev_drying_cost TYPE decfloat34
RAISING
{{p}}cx_grain.
CONSTANTS lc_rate TYPE decfloat34 VALUE '0.75'.
ev_accepted = abap_false.
ev_drying_cost = 0.
IF iv_weight_kg <= 0.
RAISE EXCEPTION TYPE {{p}}cx_grain EXPORTING iv_reason = 'WEIGHT'.
ENDIF.
IF iv_supplier IS INITIAL.
RAISE EXCEPTION TYPE {{p}}cx_grain EXPORTING iv_reason = 'SUPPLIER'.
ENDIF.
DATA lv_max_moisture TYPE decfloat34.
CASE iv_grain_type.
WHEN 'WHEAT'.
lv_max_moisture = '14.5'.
WHEN 'BARLEY'.
lv_max_moisture = '14.0'.
WHEN 'RYE'.
lv_max_moisture = '15.0'.
WHEN OTHERS.
RAISE EXCEPTION TYPE {{p}}cx_grain EXPORTING iv_reason = 'GRAIN_TYPE'.
ENDCASE.
IF iv_moisture_pct < 0 OR iv_moisture_pct > 100.
RAISE EXCEPTION TYPE {{p}}cx_grain EXPORTING iv_reason = 'MOISTURE_RANGE'.
ENDIF.
IF iv_moisture_pct > lv_max_moisture.
RAISE EXCEPTION TYPE {{p}}cx_grain EXPORTING iv_reason = 'MOISTURE'.
ENDIF.
DATA(lv_target) = lv_max_moisture - 2.
IF iv_moisture_pct > lv_target.
ev_drying_cost = round( val = iv_weight_kg * ( iv_moisture_pct - lv_target ) * lc_rate
dec = 2
mode = cl_abap_math=>round_half_up ).
ENDIF.
ev_accepted = abap_true.
ENDFUNCTION.

View File

@@ -0,0 +1,69 @@
CLASS {{p}}t14_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS reason_for
IMPORTING
iv_grain_type TYPE string
iv_weight_kg TYPE decfloat34
iv_moisture_pct TYPE decfloat34
iv_supplier TYPE string
RETURNING VALUE(rv_reason) TYPE string.
METHODS valid_delivery FOR TESTING.
METHODS weight_rule FOR TESTING.
METHODS grain_rules FOR TESTING.
METHODS drying_cost FOR TESTING.
ENDCLASS.
CLASS {{p}}t14_test IMPLEMENTATION.
METHOD reason_for.
rv_reason = ``.
TRY.
CALL FUNCTION '{{P}}GRAIN_CHECK'
EXPORTING
iv_grain_type = iv_grain_type
iv_weight_kg = iv_weight_kg
iv_moisture_pct = iv_moisture_pct
iv_supplier = iv_supplier.
CATCH {{p}}cx_grain INTO DATA(lo_ex).
rv_reason = lo_ex->mv_reason.
ENDTRY.
ENDMETHOD.
METHOD valid_delivery.
cl_abap_unit_assert=>assert_initial(
act = reason_for( iv_grain_type = 'RYE' iv_weight_kg = 500 iv_moisture_pct = '13.0' iv_supplier = 'S9' ) ).
ENDMETHOD.
METHOD weight_rule.
cl_abap_unit_assert=>assert_equals(
exp = 'WEIGHT'
act = reason_for( iv_grain_type = 'WHEAT' iv_weight_kg = 0 iv_moisture_pct = '12.0' iv_supplier = 'S1' ) ).
ENDMETHOD.
METHOD grain_rules.
cl_abap_unit_assert=>assert_equals(
exp = 'GRAIN_TYPE'
act = reason_for( iv_grain_type = 'MAIZE' iv_weight_kg = 10 iv_moisture_pct = '12.0' iv_supplier = 'S1' ) ).
cl_abap_unit_assert=>assert_equals(
exp = 'MOISTURE'
act = reason_for( iv_grain_type = 'RYE' iv_weight_kg = 10 iv_moisture_pct = '15.5' iv_supplier = 'S1' ) ).
ENDMETHOD.
METHOD drying_cost.
DATA lv_cost TYPE decfloat34.
TRY.
CALL FUNCTION '{{P}}GRAIN_CHECK'
EXPORTING
iv_grain_type = 'BARLEY'
iv_weight_kg = 200
iv_moisture_pct = '14.0'
iv_supplier = 'S1'
IMPORTING
ev_drying_cost = lv_cost.
CATCH {{p}}cx_grain.
cl_abap_unit_assert=>fail( msg = 'no exception expected' ).
ENDTRY.
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '300' ) act = lv_cost ).
ENDMETHOD.
ENDCLASS.