Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
55
tasks_gen/train/G1086/faulty/m0_wood_fee.func.abap
Normal file
55
tasks_gen/train/G1086/faulty/m0_wood_fee.func.abap
Normal file
@@ -0,0 +1,55 @@
|
||||
FUNCTION {{p}}wood_fee
|
||||
IMPORTING
|
||||
iv_wood_type TYPE string
|
||||
iv_volume TYPE decfloat34
|
||||
iv_distance TYPE i
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_volume
|
||||
invalid_distance.
|
||||
|
||||
CONSTANTS lc_charge TYPE decfloat34 VALUE '0.45'.
|
||||
CONSTANTS lc_minimum TYPE decfloat34 VALUE '80'.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_km TYPE decfloat34.
|
||||
|
||||
IF iv_volume <= 0.
|
||||
RAISE invalid_volume.
|
||||
ENDIF.
|
||||
IF iv_distance >= 0.
|
||||
RAISE invalid_distance.
|
||||
ENDIF.
|
||||
|
||||
ev_skip = abap_false.
|
||||
IF iv_wood_type = 'MX'.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_wood_type.
|
||||
WHEN 'BE'.
|
||||
lv_price = 120.
|
||||
WHEN 'OK'.
|
||||
lv_price = 150.
|
||||
WHEN 'SP'.
|
||||
lv_price = 90.
|
||||
WHEN OTHERS.
|
||||
lv_price = 0.
|
||||
ENDCASE.
|
||||
|
||||
lv_fee = iv_volume * lv_price.
|
||||
IF iv_distance > 20.
|
||||
lv_km = iv_distance - 20.
|
||||
lv_fee = lv_fee + lv_km * lc_charge.
|
||||
ENDIF.
|
||||
|
||||
cv_fee = round( val = lv_fee dec = 2 ).
|
||||
IF cv_fee < lc_minimum.
|
||||
cv_fee = lc_minimum.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
55
tasks_gen/train/G1086/faulty/m1_wood_fee.func.abap
Normal file
55
tasks_gen/train/G1086/faulty/m1_wood_fee.func.abap
Normal file
@@ -0,0 +1,55 @@
|
||||
FUNCTION {{p}}wood_fee
|
||||
IMPORTING
|
||||
iv_wood_type TYPE string
|
||||
iv_volume TYPE decfloat34
|
||||
iv_distance TYPE i
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_volume
|
||||
invalid_distance.
|
||||
|
||||
CONSTANTS lc_charge TYPE decfloat34 VALUE '0.45'.
|
||||
CONSTANTS lc_minimum TYPE decfloat34 VALUE '80'.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_km TYPE decfloat34.
|
||||
|
||||
IF iv_volume <= 0.
|
||||
RAISE invalid_volume.
|
||||
ENDIF.
|
||||
IF iv_distance < 0.
|
||||
RAISE invalid_distance.
|
||||
ENDIF.
|
||||
|
||||
ev_skip = abap_false.
|
||||
IF iv_wood_type <> 'MX'.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_wood_type.
|
||||
WHEN 'BE'.
|
||||
lv_price = 120.
|
||||
WHEN 'OK'.
|
||||
lv_price = 150.
|
||||
WHEN 'SP'.
|
||||
lv_price = 90.
|
||||
WHEN OTHERS.
|
||||
lv_price = 0.
|
||||
ENDCASE.
|
||||
|
||||
lv_fee = iv_volume * lv_price.
|
||||
IF iv_distance > 20.
|
||||
lv_km = iv_distance - 20.
|
||||
lv_fee = lv_fee + lv_km * lc_charge.
|
||||
ENDIF.
|
||||
|
||||
cv_fee = round( val = lv_fee dec = 2 ).
|
||||
IF cv_fee < lc_minimum.
|
||||
cv_fee = lc_minimum.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
55
tasks_gen/train/G1086/faulty/m2_wood_fee.func.abap
Normal file
55
tasks_gen/train/G1086/faulty/m2_wood_fee.func.abap
Normal file
@@ -0,0 +1,55 @@
|
||||
FUNCTION {{p}}wood_fee
|
||||
IMPORTING
|
||||
iv_wood_type TYPE string
|
||||
iv_volume TYPE decfloat34
|
||||
iv_distance TYPE i
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_volume
|
||||
invalid_distance.
|
||||
|
||||
CONSTANTS lc_charge TYPE decfloat34 VALUE '0.45'.
|
||||
CONSTANTS lc_minimum TYPE decfloat34 VALUE '80'.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_km TYPE decfloat34.
|
||||
|
||||
IF iv_volume <= 0.
|
||||
RAISE invalid_volume.
|
||||
ENDIF.
|
||||
IF iv_distance < 0.
|
||||
RAISE invalid_distance.
|
||||
ENDIF.
|
||||
|
||||
ev_skip = abap_false.
|
||||
IF iv_wood_type = 'MX'.
|
||||
ev_skip = abap_false.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_wood_type.
|
||||
WHEN 'BE'.
|
||||
lv_price = 120.
|
||||
WHEN 'OK'.
|
||||
lv_price = 150.
|
||||
WHEN 'SP'.
|
||||
lv_price = 90.
|
||||
WHEN OTHERS.
|
||||
lv_price = 0.
|
||||
ENDCASE.
|
||||
|
||||
lv_fee = iv_volume * lv_price.
|
||||
IF iv_distance > 20.
|
||||
lv_km = iv_distance - 20.
|
||||
lv_fee = lv_fee + lv_km * lc_charge.
|
||||
ENDIF.
|
||||
|
||||
cv_fee = round( val = lv_fee dec = 2 ).
|
||||
IF cv_fee < lc_minimum.
|
||||
cv_fee = lc_minimum.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
55
tasks_gen/train/G1086/faulty/m3_wood_fee.func.abap
Normal file
55
tasks_gen/train/G1086/faulty/m3_wood_fee.func.abap
Normal file
@@ -0,0 +1,55 @@
|
||||
FUNCTION {{p}}wood_fee
|
||||
IMPORTING
|
||||
iv_wood_type TYPE string
|
||||
iv_volume TYPE decfloat34
|
||||
iv_distance TYPE i
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_volume
|
||||
invalid_distance.
|
||||
|
||||
CONSTANTS lc_charge TYPE decfloat34 VALUE '0.45'.
|
||||
CONSTANTS lc_minimum TYPE decfloat34 VALUE '80'.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_km TYPE decfloat34.
|
||||
|
||||
IF iv_volume <= 0.
|
||||
RAISE invalid_volume.
|
||||
ENDIF.
|
||||
IF iv_distance < 0.
|
||||
RAISE invalid_distance.
|
||||
ENDIF.
|
||||
|
||||
ev_skip = abap_false.
|
||||
IF iv_wood_type = 'MX'.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_wood_type.
|
||||
WHEN 'BE'.
|
||||
lv_price = 120.
|
||||
WHEN 'OK'.
|
||||
lv_price = 150.
|
||||
WHEN 'SP'.
|
||||
lv_price = 90.
|
||||
WHEN OTHERS.
|
||||
lv_price = 0.
|
||||
ENDCASE.
|
||||
|
||||
lv_fee = iv_volume * lv_price.
|
||||
IF iv_distance > 20.
|
||||
lv_km = iv_distance - 20.
|
||||
lv_fee = lv_fee + lv_km / lc_charge.
|
||||
ENDIF.
|
||||
|
||||
cv_fee = round( val = lv_fee dec = 2 ).
|
||||
IF cv_fee < lc_minimum.
|
||||
cv_fee = lc_minimum.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
55
tasks_gen/train/G1086/faulty/m4_wood_fee.func.abap
Normal file
55
tasks_gen/train/G1086/faulty/m4_wood_fee.func.abap
Normal file
@@ -0,0 +1,55 @@
|
||||
FUNCTION {{p}}wood_fee
|
||||
IMPORTING
|
||||
iv_wood_type TYPE string
|
||||
iv_volume TYPE decfloat34
|
||||
iv_distance TYPE i
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_volume
|
||||
invalid_distance.
|
||||
|
||||
CONSTANTS lc_charge TYPE decfloat34 VALUE '0.45'.
|
||||
CONSTANTS lc_minimum TYPE decfloat34 VALUE '80'.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_km TYPE decfloat34.
|
||||
|
||||
IF iv_volume <= 0.
|
||||
RAISE invalid_volume.
|
||||
ENDIF.
|
||||
IF iv_distance < 0.
|
||||
RAISE invalid_distance.
|
||||
ENDIF.
|
||||
|
||||
ev_skip = abap_false.
|
||||
IF iv_wood_type = 'MX'.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_wood_type.
|
||||
WHEN 'BE'.
|
||||
lv_price = 120.
|
||||
WHEN 'OK'.
|
||||
lv_price = 150.
|
||||
WHEN 'SP'.
|
||||
lv_price = 90.
|
||||
WHEN OTHERS.
|
||||
lv_price = 0.
|
||||
ENDCASE.
|
||||
|
||||
lv_fee = iv_volume * lv_price.
|
||||
IF iv_distance > 20.
|
||||
lv_km = iv_distance - 20.
|
||||
lv_fee = lv_fee + lv_km * lc_charge.
|
||||
ENDIF.
|
||||
|
||||
cv_fee = round( val = lv_fee dec = 3 ).
|
||||
IF cv_fee < lc_minimum.
|
||||
cv_fee = lc_minimum.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
19
tasks_gen/train/G1086/generation.json
Normal file
19
tasks_gen/train/G1086/generation.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"id": "G1086",
|
||||
"pool": "train",
|
||||
"object_type": "FUNC",
|
||||
"category": "G",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
132
tasks_gen/train/G1086/hidden/wood_hidden.clas.abap
Normal file
132
tasks_gen/train/G1086/hidden/wood_hidden.clas.abap
Normal file
@@ -0,0 +1,132 @@
|
||||
CLASS {{p}}wood_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS fee_of
|
||||
IMPORTING iv_type TYPE string
|
||||
iv_volume TYPE decfloat34
|
||||
iv_distance TYPE i DEFAULT 0
|
||||
iv_fee TYPE decfloat34 DEFAULT 7
|
||||
EXPORTING ev_skip TYPE abap_bool
|
||||
ev_fee TYPE decfloat34
|
||||
ev_subrc TYPE sysubrc.
|
||||
METHODS beech_price FOR TESTING.
|
||||
METHODS type_prices FOR TESTING.
|
||||
METHODS delivery_charge FOR TESTING.
|
||||
METHODS no_charge_at_20 FOR TESTING.
|
||||
METHODS minimum_fee FOR TESTING.
|
||||
METHODS rounding_half_up FOR TESTING.
|
||||
METHODS unknown_type_minimum FOR TESTING.
|
||||
METHODS mixed_skips FOR TESTING.
|
||||
METHODS skip_false_for_beech FOR TESTING.
|
||||
METHODS invalid_volume FOR TESTING.
|
||||
METHODS invalid_distance FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}wood_hidden IMPLEMENTATION.
|
||||
METHOD fee_of.
|
||||
ev_fee = iv_fee.
|
||||
CALL FUNCTION '{{P}}WOOD_FEE'
|
||||
EXPORTING
|
||||
iv_wood_type = iv_type
|
||||
iv_volume = iv_volume
|
||||
iv_distance = iv_distance
|
||||
IMPORTING
|
||||
ev_skip = ev_skip
|
||||
CHANGING
|
||||
cv_fee = ev_fee
|
||||
EXCEPTIONS
|
||||
invalid_volume = 1
|
||||
invalid_distance = 2
|
||||
OTHERS = 3.
|
||||
ev_subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD beech_price.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
lv_exp = '240'.
|
||||
fee_of( EXPORTING iv_type = 'BE' iv_volume = '2' IMPORTING ev_fee = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD type_prices.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
lv_exp = '150'.
|
||||
fee_of( EXPORTING iv_type = 'OK' iv_volume = '1' IMPORTING ev_fee = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_fee ).
|
||||
lv_exp = '180'.
|
||||
fee_of( EXPORTING iv_type = 'SP' iv_volume = '2' IMPORTING ev_fee = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD delivery_charge.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
lv_exp = '244.50'.
|
||||
fee_of( EXPORTING iv_type = 'BE' iv_volume = '2' iv_distance = 30 IMPORTING ev_fee = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD no_charge_at_20.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
lv_exp = '240'.
|
||||
fee_of( EXPORTING iv_type = 'BE' iv_volume = '2' iv_distance = 20 IMPORTING ev_fee = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD minimum_fee.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
lv_exp = '80'.
|
||||
fee_of( EXPORTING iv_type = 'SP' iv_volume = '0.5' IMPORTING ev_fee = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rounding_half_up.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
lv_exp = '100.13'.
|
||||
fee_of( EXPORTING iv_type = 'SP' iv_volume = '1.1125' IMPORTING ev_fee = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_type_minimum.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
lv_exp = '80'.
|
||||
fee_of( EXPORTING iv_type = 'XX' iv_volume = '2' IMPORTING ev_fee = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD mixed_skips.
|
||||
DATA lv_skip TYPE abap_bool.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
lv_exp = '7'.
|
||||
fee_of( EXPORTING iv_type = 'MX' iv_volume = '2' iv_distance = 10 iv_fee = '7'
|
||||
IMPORTING ev_skip = lv_skip ev_fee = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_true act = lv_skip ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD skip_false_for_beech.
|
||||
DATA lv_skip TYPE abap_bool.
|
||||
fee_of( EXPORTING iv_type = 'BE' iv_volume = '2' IMPORTING ev_skip = lv_skip ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_false act = lv_skip ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_volume.
|
||||
DATA lv_rc TYPE sysubrc.
|
||||
fee_of( EXPORTING iv_type = 'BE' iv_volume = '0' IMPORTING ev_subrc = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_distance.
|
||||
DATA lv_rc TYPE sysubrc.
|
||||
fee_of( EXPORTING iv_type = 'BE' iv_volume = '2' iv_distance = -1 IMPORTING ev_subrc = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_rc ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
70
tasks_gen/train/G1086/mutation.json
Normal file
70
tasks_gen/train/G1086/mutation.json
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"task": "G1086",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}WOOD_FEE",
|
||||
"mutant": "line 23: < -> >= (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "2/11",
|
||||
"failed_tests": [
|
||||
"BEECH_PRICE",
|
||||
"DELIVERY_CHARGE",
|
||||
"INVALID_DISTANCE",
|
||||
"MINIMUM_FEE",
|
||||
"MIXED_SKIPS",
|
||||
"NO_CHARGE_AT_20",
|
||||
"ROUNDING_HALF_UP",
|
||||
"TYPE_PRICES",
|
||||
"UNKNOWN_TYPE_MINIMUM"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}WOOD_FEE",
|
||||
"mutant": "line 28: = -> <> (eq)",
|
||||
"status": "killed",
|
||||
"hidden": "2/11",
|
||||
"failed_tests": [
|
||||
"BEECH_PRICE",
|
||||
"DELIVERY_CHARGE",
|
||||
"MINIMUM_FEE",
|
||||
"MIXED_SKIPS",
|
||||
"NO_CHARGE_AT_20",
|
||||
"ROUNDING_HALF_UP",
|
||||
"SKIP_FALSE_FOR_BEECH",
|
||||
"TYPE_PRICES",
|
||||
"UNKNOWN_TYPE_MINIMUM"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}WOOD_FEE",
|
||||
"mutant": "line 29: abap_true -> abap_false (bool)",
|
||||
"status": "killed",
|
||||
"hidden": "10/11",
|
||||
"failed_tests": [
|
||||
"MIXED_SKIPS"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}WOOD_FEE",
|
||||
"mutant": "line 47: * -> / (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "10/11",
|
||||
"failed_tests": [
|
||||
"DELIVERY_CHARGE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}WOOD_FEE",
|
||||
"mutant": "line 50: 2 -> 3 (const)",
|
||||
"status": "killed",
|
||||
"hidden": "10/11",
|
||||
"failed_tests": [
|
||||
"ROUNDING_HALF_UP"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
55
tasks_gen/train/G1086/reference/wood_fee.func.abap
Normal file
55
tasks_gen/train/G1086/reference/wood_fee.func.abap
Normal file
@@ -0,0 +1,55 @@
|
||||
FUNCTION {{p}}wood_fee
|
||||
IMPORTING
|
||||
iv_wood_type TYPE string
|
||||
iv_volume TYPE decfloat34
|
||||
iv_distance TYPE i
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_volume
|
||||
invalid_distance.
|
||||
|
||||
CONSTANTS lc_charge TYPE decfloat34 VALUE '0.45'.
|
||||
CONSTANTS lc_minimum TYPE decfloat34 VALUE '80'.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_km TYPE decfloat34.
|
||||
|
||||
IF iv_volume <= 0.
|
||||
RAISE invalid_volume.
|
||||
ENDIF.
|
||||
IF iv_distance < 0.
|
||||
RAISE invalid_distance.
|
||||
ENDIF.
|
||||
|
||||
ev_skip = abap_false.
|
||||
IF iv_wood_type = 'MX'.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_wood_type.
|
||||
WHEN 'BE'.
|
||||
lv_price = 120.
|
||||
WHEN 'OK'.
|
||||
lv_price = 150.
|
||||
WHEN 'SP'.
|
||||
lv_price = 90.
|
||||
WHEN OTHERS.
|
||||
lv_price = 0.
|
||||
ENDCASE.
|
||||
|
||||
lv_fee = iv_volume * lv_price.
|
||||
IF iv_distance > 20.
|
||||
lv_km = iv_distance - 20.
|
||||
lv_fee = lv_fee + lv_km * lc_charge.
|
||||
ENDIF.
|
||||
|
||||
cv_fee = round( val = lv_fee dec = 2 ).
|
||||
IF cv_fee < lc_minimum.
|
||||
cv_fee = lc_minimum.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
88
tasks_gen/train/G1086/reference/wood_test.clas.abap
Normal file
88
tasks_gen/train/G1086/reference/wood_test.clas.abap
Normal file
@@ -0,0 +1,88 @@
|
||||
CLASS {{p}}wood_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS fee_for
|
||||
IMPORTING iv_type TYPE string
|
||||
iv_volume TYPE decfloat34
|
||||
iv_distance TYPE i DEFAULT 0
|
||||
RETURNING VALUE(rv_fee) TYPE decfloat34.
|
||||
METHODS beech_fee FOR TESTING.
|
||||
METHODS delivery_charge FOR TESTING.
|
||||
METHODS minimum_fee FOR TESTING.
|
||||
METHODS mixed_skips FOR TESTING.
|
||||
METHODS invalid_volume FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}wood_test IMPLEMENTATION.
|
||||
METHOD fee_for.
|
||||
DATA lv_skip TYPE abap_bool.
|
||||
CALL FUNCTION '{{P}}WOOD_FEE'
|
||||
EXPORTING
|
||||
iv_wood_type = iv_type
|
||||
iv_volume = iv_volume
|
||||
iv_distance = iv_distance
|
||||
IMPORTING
|
||||
ev_skip = lv_skip
|
||||
CHANGING
|
||||
cv_fee = rv_fee
|
||||
EXCEPTIONS
|
||||
invalid_volume = 1
|
||||
invalid_distance = 2
|
||||
OTHERS = 3.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD beech_fee.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
lv_exp = '240'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = fee_for( iv_type = 'BE' iv_volume = '2' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD delivery_charge.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
lv_exp = '244.50'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = fee_for( iv_type = 'BE' iv_volume = '2' iv_distance = 30 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD minimum_fee.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
lv_exp = '80'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = fee_for( iv_type = 'SP' iv_volume = '0.5' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD mixed_skips.
|
||||
DATA lv_skip TYPE abap_bool.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
lv_exp = '7'.
|
||||
lv_fee = '7'.
|
||||
CALL FUNCTION '{{P}}WOOD_FEE'
|
||||
EXPORTING
|
||||
iv_wood_type = 'MX'
|
||||
iv_volume = '2'
|
||||
iv_distance = 10
|
||||
IMPORTING
|
||||
ev_skip = lv_skip
|
||||
CHANGING
|
||||
cv_fee = lv_fee.
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_true act = lv_skip ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_volume.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
CALL FUNCTION '{{P}}WOOD_FEE'
|
||||
EXPORTING
|
||||
iv_wood_type = 'BE'
|
||||
iv_volume = '0'
|
||||
iv_distance = 0
|
||||
CHANGING
|
||||
cv_fee = lv_fee
|
||||
EXCEPTIONS
|
||||
invalid_volume = 1
|
||||
invalid_distance = 2
|
||||
OTHERS = 3.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
16
tasks_gen/train/G1086/seed/wood_sample.func.abap
Normal file
16
tasks_gen/train/G1086/seed/wood_sample.func.abap
Normal file
@@ -0,0 +1,16 @@
|
||||
FUNCTION {{p}}wood_sample
|
||||
IMPORTING
|
||||
iv_wood_type TYPE string
|
||||
iv_volume TYPE decfloat34
|
||||
iv_distance TYPE i
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_volume
|
||||
invalid_distance.
|
||||
|
||||
ev_skip = abap_false.
|
||||
|
||||
ENDFUNCTION.
|
||||
45
tasks_gen/train/G1086/spec.md
Normal file
45
tasks_gen/train/G1086/spec.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# 1. Goal
|
||||
Calculate the price of a firewood delivery for a firewood merchant. The order
|
||||
program calls one function module for each delivery order. The function module
|
||||
must have the same interface as the sample function module, because the order
|
||||
program calls all function modules in the same way.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Function group {{P}}FG_WOOD exists in package $TMP.
|
||||
- Function module {{P}}WOOD_SAMPLE exists in this group. It is the sample
|
||||
function module. Its interface is the interface that all function modules of
|
||||
the order program must use.
|
||||
|
||||
# 4. Contract
|
||||
- Create the function module {{P}}WOOD_FEE in function group {{P}}FG_WOOD.
|
||||
- Use exactly the interface of {{P}}WOOD_SAMPLE: the same parameter names, the
|
||||
same parameter kinds, the same types, and the same exceptions.
|
||||
|
||||
# 5. Business rules
|
||||
Apply the rules in this order.
|
||||
1. If iv_volume is less than or equal to 0, raise INVALID_VOLUME.
|
||||
2. If iv_distance is less than 0, raise INVALID_DISTANCE.
|
||||
3. Set ev_skip to false, except in rule 4.
|
||||
4. If iv_wood_type is 'MX', set ev_skip to true and do not change cv_fee.
|
||||
5. The price for one cubic metre is 120.00 for wood type 'BE', 150.00 for wood
|
||||
type 'OK', and 90.00 for wood type 'SP'. For every other wood type the price
|
||||
for one cubic metre is 0.
|
||||
6. The wood price is iv_volume multiplied by the price for one cubic metre.
|
||||
7. If iv_distance is greater than 20, the delivery charge is 0.45 for each
|
||||
kilometre above 20. Otherwise the delivery charge is 0.
|
||||
8. The fee is the wood price plus the delivery charge, rounded half up to two
|
||||
decimals.
|
||||
9. If the fee is less than 80.00, the fee is 80.00.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 7.02. Use only syntax that release 7.02 supports.
|
||||
- Coding standard: Clean ABAP. Keep every method below 40 statements.
|
||||
- Out of scope: do not change {{P}}WOOD_SAMPLE.
|
||||
|
||||
# 7. Acceptance
|
||||
- The function module {{P}}WOOD_FEE is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write ABAP Unit tests for the function module in a global test class.
|
||||
84
tasks_gen/train/G1086/task.json
Normal file
84
tasks_gen/train/G1086/task.json
Normal file
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"id": "G1086",
|
||||
"category": "G",
|
||||
"object_type": "FUNC",
|
||||
"difficulty": 2,
|
||||
"release_target": "v702",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "FUGR",
|
||||
"name": "{{P}}FG_WOOD",
|
||||
"description": "Function group for firewood delivery fees"
|
||||
},
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}WOOD_SAMPLE",
|
||||
"functionGroup": "{{P}}FG_WOOD",
|
||||
"file": "seed/wood_sample.func.abap",
|
||||
"description": "Sample function module. Its interface is the interface of all order modules."
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}WOOD_FEE",
|
||||
"functionGroup": "{{P}}FG_WOOD",
|
||||
"params": [
|
||||
{
|
||||
"name": "iv_wood_type",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "iv_volume",
|
||||
"type": "decfloat34"
|
||||
},
|
||||
{
|
||||
"name": "iv_distance",
|
||||
"type": "i"
|
||||
},
|
||||
{
|
||||
"name": "ev_skip",
|
||||
"type": "abap_bool"
|
||||
},
|
||||
{
|
||||
"name": "cv_fee",
|
||||
"type": "decfloat34"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}WOOD_SAMPLE"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}WOOD_HIDDEN",
|
||||
"file": "hidden/wood_hidden.clas.abap",
|
||||
"description": "T14 hidden tests"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}WOOD_FEE",
|
||||
"functionGroup": "{{P}}FG_WOOD",
|
||||
"file": "reference/wood_fee.func.abap",
|
||||
"description": "Firewood delivery fee"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}WOOD_TEST",
|
||||
"file": "reference/wood_test.clas.abap",
|
||||
"description": "T14 own tests"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user