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:
67
tasks_gen/eval/G0149/reference/scrap_payout.clas.abap
Normal file
67
tasks_gen/eval/G0149/reference/scrap_payout.clas.abap
Normal file
@@ -0,0 +1,67 @@
|
||||
CLASS {{p}}scrap_payout DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_scrap_payout.
|
||||
|
||||
PRIVATE SECTION.
|
||||
TYPES ty_mat_code TYPE c LENGTH 4.
|
||||
TYPES ty_weight TYPE p LENGTH 8 DECIMALS 3.
|
||||
TYPES ty_price TYPE p LENGTH 8 DECIMALS 2.
|
||||
TYPES ty_quantity TYPE p LENGTH 15 DECIMALS 5.
|
||||
|
||||
METHODS payable_weight
|
||||
IMPORTING iv_weight_kg TYPE ty_weight
|
||||
iv_contamination TYPE i
|
||||
RETURNING VALUE(rv_weight) TYPE ty_quantity.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}scrap_payout IMPLEMENTATION.
|
||||
METHOD {{p}}if_scrap_payout~calculate.
|
||||
DATA lv_mat_code TYPE ty_mat_code.
|
||||
lv_mat_code = to_upper( iv_material ).
|
||||
|
||||
DATA lv_price TYPE ty_price.
|
||||
CASE lv_mat_code.
|
||||
WHEN {{p}}if_scrap_payout=>c_material-copper.
|
||||
lv_price = '4.20'.
|
||||
WHEN {{p}}if_scrap_payout=>c_material-aluminium.
|
||||
lv_price = '1.10'.
|
||||
WHEN {{p}}if_scrap_payout=>c_material-steel.
|
||||
lv_price = '0.30'.
|
||||
WHEN {{p}}if_scrap_payout=>c_material-brass.
|
||||
lv_price = '3.00'.
|
||||
WHEN OTHERS.
|
||||
rs_payout = VALUE #( amount = 0
|
||||
reason = {{p}}if_scrap_payout=>c_reason-material ).
|
||||
RETURN.
|
||||
ENDCASE.
|
||||
|
||||
IF iv_weight_kg <= 0.
|
||||
rs_payout = VALUE #( amount = 0
|
||||
reason = {{p}}if_scrap_payout=>c_reason-weight ).
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
IF iv_contamination < 0 OR iv_contamination > 100.
|
||||
rs_payout = VALUE #( amount = 0
|
||||
reason = {{p}}if_scrap_payout=>c_reason-dirty ).
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
DATA lv_payable TYPE ty_quantity.
|
||||
lv_payable = payable_weight( iv_weight_kg = iv_weight_kg
|
||||
iv_contamination = iv_contamination ).
|
||||
|
||||
DATA lv_gross TYPE ty_quantity.
|
||||
lv_gross = lv_payable * lv_price.
|
||||
|
||||
rs_payout = VALUE #( amount = round( val = lv_gross dec = 2 )
|
||||
reason = {{p}}if_scrap_payout=>c_reason-ok ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD payable_weight.
|
||||
DATA lv_remaining TYPE i.
|
||||
lv_remaining = 100 - iv_contamination.
|
||||
rv_weight = iv_weight_kg * lv_remaining / 100.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
84
tasks_gen/eval/G0149/reference/scrap_payout.testclasses.abap
Normal file
84
tasks_gen/eval/G0149/reference/scrap_payout.testclasses.abap
Normal file
@@ -0,0 +1,84 @@
|
||||
CLASS ltc_scrap_payout DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
TYPES ty_amount TYPE p LENGTH 10 DECIMALS 2.
|
||||
|
||||
DATA mo_cut TYPE REF TO {{p}}if_scrap_payout.
|
||||
|
||||
METHODS setup.
|
||||
METHODS assert_payout
|
||||
IMPORTING iv_material TYPE {{p}}if_scrap_payout=>ty_material
|
||||
iv_weight_kg TYPE {{p}}if_scrap_payout=>ty_weight
|
||||
iv_contamination TYPE i
|
||||
iv_amount TYPE ty_amount
|
||||
iv_reason TYPE {{p}}if_scrap_payout=>ty_reason.
|
||||
|
||||
METHODS copper_is_paid FOR TESTING.
|
||||
METHODS contamination_reduces FOR TESTING.
|
||||
METHODS rounding_is_commercial FOR TESTING.
|
||||
METHODS unknown_material_rejected FOR TESTING.
|
||||
METHODS zero_weight_rejected FOR TESTING.
|
||||
METHODS dirty_too_high_rejected FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_scrap_payout IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}scrap_payout( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD assert_payout.
|
||||
DATA(ls_payout) = mo_cut->calculate( iv_material = iv_material
|
||||
iv_weight_kg = iv_weight_kg
|
||||
iv_contamination = iv_contamination ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = iv_amount act = ls_payout-amount ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = iv_reason act = ls_payout-reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD copper_is_paid.
|
||||
assert_payout( iv_material = {{p}}if_scrap_payout=>c_material-copper
|
||||
iv_weight_kg = '100.000'
|
||||
iv_contamination = 0
|
||||
iv_amount = '420.00'
|
||||
iv_reason = {{p}}if_scrap_payout=>c_reason-ok ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD contamination_reduces.
|
||||
assert_payout( iv_material = {{p}}if_scrap_payout=>c_material-aluminium
|
||||
iv_weight_kg = '50.000'
|
||||
iv_contamination = 20
|
||||
iv_amount = '44.00'
|
||||
iv_reason = {{p}}if_scrap_payout=>c_reason-ok ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rounding_is_commercial.
|
||||
assert_payout( iv_material = {{p}}if_scrap_payout=>c_material-brass
|
||||
iv_weight_kg = '0.335'
|
||||
iv_contamination = 0
|
||||
iv_amount = '1.01'
|
||||
iv_reason = {{p}}if_scrap_payout=>c_reason-ok ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_material_rejected.
|
||||
assert_payout( iv_material = 'ZZ'
|
||||
iv_weight_kg = '10.000'
|
||||
iv_contamination = 0
|
||||
iv_amount = '0.00'
|
||||
iv_reason = {{p}}if_scrap_payout=>c_reason-material ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD zero_weight_rejected.
|
||||
assert_payout( iv_material = {{p}}if_scrap_payout=>c_material-copper
|
||||
iv_weight_kg = '0.000'
|
||||
iv_contamination = 0
|
||||
iv_amount = '0.00'
|
||||
iv_reason = {{p}}if_scrap_payout=>c_reason-weight ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dirty_too_high_rejected.
|
||||
assert_payout( iv_material = {{p}}if_scrap_payout=>c_material-copper
|
||||
iv_weight_kg = '100.000'
|
||||
iv_contamination = 150
|
||||
iv_amount = '0.00'
|
||||
iv_reason = {{p}}if_scrap_payout=>c_reason-dirty ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user