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/faulty/m0_scrap_payout.clas.abap
Normal file
67
tasks_gen/eval/G0149/faulty/m0_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.
|
||||
67
tasks_gen/eval/G0149/faulty/m1_scrap_payout.clas.abap
Normal file
67
tasks_gen/eval/G0149/faulty/m1_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.
|
||||
67
tasks_gen/eval/G0149/faulty/m2_scrap_payout.clas.abap
Normal file
67
tasks_gen/eval/G0149/faulty/m2_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.
|
||||
67
tasks_gen/eval/G0149/faulty/m4_scrap_payout.clas.abap
Normal file
67
tasks_gen/eval/G0149/faulty/m4_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.
|
||||
28
tasks_gen/eval/G0149/generation.json
Normal file
28
tasks_gen/eval/G0149/generation.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"id": "G0149",
|
||||
"pool": "eval",
|
||||
"object_type": "CLAS",
|
||||
"category": "F",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"reference/scrap_payout.clas.abap line 16: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"METHODS\""
|
||||
],
|
||||
"by_check": {
|
||||
"abaplint": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 4,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
130
tasks_gen/eval/G0149/hidden/t_f01_hidden.clas.abap
Normal file
130
tasks_gen/eval/G0149/hidden/t_f01_hidden.clas.abap
Normal file
@@ -0,0 +1,130 @@
|
||||
CLASS {{p}}t_f01_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
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 check
|
||||
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_clean FOR TESTING.
|
||||
METHODS copper_contaminated FOR TESTING.
|
||||
METHODS steel_clean FOR TESTING.
|
||||
METHODS brass_half_dirty FOR TESTING.
|
||||
METHODS rounds_amount FOR TESTING.
|
||||
METHODS rounds_half_up FOR TESTING.
|
||||
METHODS material_lower_case FOR TESTING.
|
||||
METHODS unknown_material FOR TESTING.
|
||||
METHODS zero_weight FOR TESTING.
|
||||
METHODS dirty_too_high FOR TESTING.
|
||||
METHODS fully_contaminated FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t_f01_hidden IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}scrap_payout( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check.
|
||||
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_clean.
|
||||
check( 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 copper_contaminated.
|
||||
check( iv_material = {{p}}if_scrap_payout=>c_material-copper
|
||||
iv_weight_kg = '250.500'
|
||||
iv_contamination = 20
|
||||
iv_amount = '841.68'
|
||||
iv_reason = {{p}}if_scrap_payout=>c_reason-ok ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD steel_clean.
|
||||
check( iv_material = {{p}}if_scrap_payout=>c_material-steel
|
||||
iv_weight_kg = '1000.000'
|
||||
iv_contamination = 0
|
||||
iv_amount = '300.00'
|
||||
iv_reason = {{p}}if_scrap_payout=>c_reason-ok ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD brass_half_dirty.
|
||||
check( iv_material = {{p}}if_scrap_payout=>c_material-brass
|
||||
iv_weight_kg = '10.000'
|
||||
iv_contamination = 50
|
||||
iv_amount = '15.00'
|
||||
iv_reason = {{p}}if_scrap_payout=>c_reason-ok ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rounds_amount.
|
||||
check( iv_material = {{p}}if_scrap_payout=>c_material-aluminium
|
||||
iv_weight_kg = '3.333'
|
||||
iv_contamination = 0
|
||||
iv_amount = '3.67'
|
||||
iv_reason = {{p}}if_scrap_payout=>c_reason-ok ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rounds_half_up.
|
||||
check( 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 material_lower_case.
|
||||
check( iv_material = 'cu'
|
||||
iv_weight_kg = '100.000'
|
||||
iv_contamination = 0
|
||||
iv_amount = '420.00'
|
||||
iv_reason = {{p}}if_scrap_payout=>c_reason-ok ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_material.
|
||||
check( iv_material = 'XX'
|
||||
iv_weight_kg = '100.000'
|
||||
iv_contamination = 0
|
||||
iv_amount = '0.00'
|
||||
iv_reason = {{p}}if_scrap_payout=>c_reason-material ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD zero_weight.
|
||||
check( 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.
|
||||
check( iv_material = {{p}}if_scrap_payout=>c_material-copper
|
||||
iv_weight_kg = '100.000'
|
||||
iv_contamination = 101
|
||||
iv_amount = '0.00'
|
||||
iv_reason = {{p}}if_scrap_payout=>c_reason-dirty ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD fully_contaminated.
|
||||
check( iv_material = {{p}}if_scrap_payout=>c_material-copper
|
||||
iv_weight_kg = '100.000'
|
||||
iv_contamination = 100
|
||||
iv_amount = '0.00'
|
||||
iv_reason = {{p}}if_scrap_payout=>c_reason-ok ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
80
tasks_gen/eval/G0149/mutation.json
Normal file
80
tasks_gen/eval/G0149/mutation.json
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"task": "G0149",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}SCRAP_PAYOUT",
|
||||
"mutant": "line 45: < -> >= (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "3/11",
|
||||
"failed_tests": [
|
||||
"BRASS_HALF_DIRTY",
|
||||
"COPPER_CLEAN",
|
||||
"COPPER_CONTAMINATED",
|
||||
"FULLY_CONTAMINATED",
|
||||
"MATERIAL_LOWER_CASE",
|
||||
"ROUNDS_AMOUNT",
|
||||
"ROUNDS_HALF_UP",
|
||||
"STEEL_CLEAN"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}SCRAP_PAYOUT",
|
||||
"mutant": "line 45: > -> <= (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "2/11",
|
||||
"failed_tests": [
|
||||
"BRASS_HALF_DIRTY",
|
||||
"COPPER_CLEAN",
|
||||
"COPPER_CONTAMINATED",
|
||||
"DIRTY_TOO_HIGH",
|
||||
"FULLY_CONTAMINATED",
|
||||
"MATERIAL_LOWER_CASE",
|
||||
"ROUNDS_AMOUNT",
|
||||
"ROUNDS_HALF_UP",
|
||||
"STEEL_CLEAN"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}SCRAP_PAYOUT",
|
||||
"mutant": "line 56: * -> / (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "4/11",
|
||||
"failed_tests": [
|
||||
"BRASS_HALF_DIRTY",
|
||||
"COPPER_CLEAN",
|
||||
"COPPER_CONTAMINATED",
|
||||
"MATERIAL_LOWER_CASE",
|
||||
"ROUNDS_AMOUNT",
|
||||
"ROUNDS_HALF_UP",
|
||||
"STEEL_CLEAN"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}SCRAP_PAYOUT",
|
||||
"mutant": "line 58: 2 -> 3 (const)",
|
||||
"status": "survived",
|
||||
"hidden": "11/11",
|
||||
"failed_tests": []
|
||||
},
|
||||
{
|
||||
"object": "{{P}}SCRAP_PAYOUT",
|
||||
"mutant": "line 65: * -> / (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "3/11",
|
||||
"failed_tests": [
|
||||
"BRASS_HALF_DIRTY",
|
||||
"COPPER_CLEAN",
|
||||
"COPPER_CONTAMINATED",
|
||||
"FULLY_CONTAMINATED",
|
||||
"MATERIAL_LOWER_CASE",
|
||||
"ROUNDS_AMOUNT",
|
||||
"ROUNDS_HALF_UP",
|
||||
"STEEL_CLEAN"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 4,
|
||||
"kill_rate": 0.8,
|
||||
"ok": true
|
||||
}
|
||||
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.
|
||||
33
tasks_gen/eval/G0149/seed/if_scrap_payout.intf.abap
Normal file
33
tasks_gen/eval/G0149/seed/if_scrap_payout.intf.abap
Normal file
@@ -0,0 +1,33 @@
|
||||
INTERFACE {{p}}if_scrap_payout PUBLIC.
|
||||
TYPES ty_material TYPE c LENGTH 4.
|
||||
TYPES ty_reason TYPE c LENGTH 10.
|
||||
TYPES ty_weight TYPE p LENGTH 8 DECIMALS 3.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_payout,
|
||||
amount TYPE p LENGTH 10 DECIMALS 2,
|
||||
reason TYPE ty_reason,
|
||||
END OF ty_payout.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_material,
|
||||
copper TYPE ty_material VALUE 'CU',
|
||||
aluminium TYPE ty_material VALUE 'AL',
|
||||
steel TYPE ty_material VALUE 'ST',
|
||||
brass TYPE ty_material VALUE 'BR',
|
||||
END OF c_material.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
material TYPE ty_reason VALUE 'MATERIAL',
|
||||
weight TYPE ty_reason VALUE 'WEIGHT',
|
||||
dirty TYPE ty_reason VALUE 'DIRTY',
|
||||
END OF c_reason.
|
||||
|
||||
METHODS calculate
|
||||
IMPORTING iv_material TYPE ty_material
|
||||
iv_weight_kg TYPE ty_weight
|
||||
iv_contamination TYPE i
|
||||
RETURNING VALUE(rs_payout) TYPE ty_payout.
|
||||
ENDINTERFACE.
|
||||
51
tasks_gen/eval/G0149/spec.md
Normal file
51
tasks_gen/eval/G0149/spec.md
Normal file
@@ -0,0 +1,51 @@
|
||||
# 1. Goal
|
||||
A scrapyard buys scrap metal from customers. A weighing program calls one
|
||||
calculation to get the payout for a delivery. The payout has an amount and a
|
||||
reason code.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The interface {{P}}IF_SCRAP_PAYOUT exists in package $TMP. It is active.
|
||||
- The interface defines one method, the material codes, the reason codes, and the
|
||||
structure of the result.
|
||||
- Read the interface {{P}}IF_SCRAP_PAYOUT in package $TMP. This specification does
|
||||
not repeat the signature of the interface.
|
||||
|
||||
# 4. Contract
|
||||
- Create the class {{P}}SCRAP_PAYOUT in package $TMP.
|
||||
- The class is public and final.
|
||||
- The class implements the interface {{P}}IF_SCRAP_PAYOUT.
|
||||
- The class has a public constructor without parameters.
|
||||
- Do not add other public methods.
|
||||
|
||||
# 5. Business rules
|
||||
Apply the rules in this sequence. Stop at the first rule that fails.
|
||||
|
||||
1. Convert the material code to upper case. The result must be one of the material
|
||||
codes in the constant structure {{P}}IF_SCRAP_PAYOUT=>C_MATERIAL. If not, return
|
||||
the reason MATERIAL and the amount 0.
|
||||
2. The weight in kilograms must be greater than 0. If not, return the reason WEIGHT
|
||||
and the amount 0.
|
||||
3. The contamination in percent must be between 0 and 100. If not, return the reason
|
||||
DIRTY and the amount 0.
|
||||
4. The base price per kilogram is 4.20 for copper, 1.10 for aluminium, 0.30 for
|
||||
steel, and 3.00 for brass.
|
||||
5. The payable weight is the weight multiplied by the difference between 100 and the
|
||||
contamination, divided by 100.
|
||||
6. The amount is the payable weight multiplied by the base price of the material.
|
||||
Round the amount to 2 decimal places.
|
||||
7. Return the reason OK and the amount.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: SAP_BASIS 816.
|
||||
- Coding standards: Clean ABAP. Keep every method below 40 statements. Do not use
|
||||
global variables. Pass large parameters by reference. Do not write comments that
|
||||
restate the code.
|
||||
- Out of scope: do not change the interface {{P}}IF_SCRAP_PAYOUT.
|
||||
|
||||
# 7. Acceptance
|
||||
- The class {{P}}SCRAP_PAYOUT is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write your own ABAP Unit tests for the class.
|
||||
51
tasks_gen/eval/G0149/task.json
Normal file
51
tasks_gen/eval/G0149/task.json
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"id": "G0149",
|
||||
"category": "F",
|
||||
"object_type": "CLAS",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "INTF",
|
||||
"name": "{{P}}IF_SCRAP_PAYOUT",
|
||||
"file": "seed/if_scrap_payout.intf.abap",
|
||||
"description": "Scrap payout contract: material codes, reason codes, result structure and the method signature"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}SCRAP_PAYOUT",
|
||||
"implements": "{{P}}IF_SCRAP_PAYOUT"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}IF_SCRAP_PAYOUT"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T_F01_HIDDEN",
|
||||
"file": "hidden/t_f01_hidden.clas.abap",
|
||||
"description": "Hidden tests for the scrap payout calculation"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}SCRAP_PAYOUT",
|
||||
"file": "reference/scrap_payout.clas.abap",
|
||||
"description": "Scrap payout calculation",
|
||||
"testclasses_file": "reference/scrap_payout.testclasses.abap"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"db_operation_in_loop"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user