Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
53
tasks_gen/train/G1097/faulty/m0_weld_fee.func.abap
Normal file
53
tasks_gen/train/G1097/faulty/m0_weld_fee.func.abap
Normal file
@@ -0,0 +1,53 @@
|
||||
FUNCTION {{p}}weld_fee
|
||||
IMPORTING
|
||||
iv_material TYPE string
|
||||
iv_seam_cm TYPE decfloat34
|
||||
iv_express TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_length.
|
||||
|
||||
IF iv_seam_cm >= 0.
|
||||
RAISE invalid_length.
|
||||
ENDIF.
|
||||
|
||||
ev_skip = abap_false.
|
||||
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
CASE iv_material.
|
||||
WHEN 'ST'.
|
||||
lv_rate = 12.
|
||||
WHEN 'SS'.
|
||||
lv_rate = 20.
|
||||
WHEN 'AL'.
|
||||
IF iv_seam_cm > 50.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
lv_rate = 28.
|
||||
WHEN OTHERS.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDCASE.
|
||||
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
lv_fee = round( val = iv_seam_cm * lv_rate dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
|
||||
IF iv_seam_cm > 200.
|
||||
lv_fee = round( val = lv_fee * 9 / 10 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
IF iv_express = abap_true.
|
||||
lv_fee = round( val = lv_fee * 125 / 100 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
IF lv_fee < 40.
|
||||
lv_fee = 40.
|
||||
ENDIF.
|
||||
|
||||
cv_fee = lv_fee.
|
||||
|
||||
ENDFUNCTION.
|
||||
53
tasks_gen/train/G1097/faulty/m1_weld_fee.func.abap
Normal file
53
tasks_gen/train/G1097/faulty/m1_weld_fee.func.abap
Normal file
@@ -0,0 +1,53 @@
|
||||
FUNCTION {{p}}weld_fee
|
||||
IMPORTING
|
||||
iv_material TYPE string
|
||||
iv_seam_cm TYPE decfloat34
|
||||
iv_express TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_length.
|
||||
|
||||
IF iv_seam_cm < 0.
|
||||
RAISE invalid_length.
|
||||
ENDIF.
|
||||
|
||||
ev_skip = abap_false.
|
||||
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
CASE iv_material.
|
||||
WHEN 'ST'.
|
||||
lv_rate = 12.
|
||||
WHEN 'SS'.
|
||||
lv_rate = 20.
|
||||
WHEN 'AL'.
|
||||
IF iv_seam_cm > 50.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
lv_rate = 28.
|
||||
WHEN OTHERS.
|
||||
ev_skip = abap_false.
|
||||
RETURN.
|
||||
ENDCASE.
|
||||
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
lv_fee = round( val = iv_seam_cm * lv_rate dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
|
||||
IF iv_seam_cm > 200.
|
||||
lv_fee = round( val = lv_fee * 9 / 10 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
IF iv_express = abap_true.
|
||||
lv_fee = round( val = lv_fee * 125 / 100 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
IF lv_fee < 40.
|
||||
lv_fee = 40.
|
||||
ENDIF.
|
||||
|
||||
cv_fee = lv_fee.
|
||||
|
||||
ENDFUNCTION.
|
||||
53
tasks_gen/train/G1097/faulty/m2_weld_fee.func.abap
Normal file
53
tasks_gen/train/G1097/faulty/m2_weld_fee.func.abap
Normal file
@@ -0,0 +1,53 @@
|
||||
FUNCTION {{p}}weld_fee
|
||||
IMPORTING
|
||||
iv_material TYPE string
|
||||
iv_seam_cm TYPE decfloat34
|
||||
iv_express TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_length.
|
||||
|
||||
IF iv_seam_cm < 0.
|
||||
RAISE invalid_length.
|
||||
ENDIF.
|
||||
|
||||
ev_skip = abap_false.
|
||||
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
CASE iv_material.
|
||||
WHEN 'ST'.
|
||||
lv_rate = 12.
|
||||
WHEN 'SS'.
|
||||
lv_rate = 20.
|
||||
WHEN 'AL'.
|
||||
IF iv_seam_cm > 50.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
lv_rate = 28.
|
||||
WHEN OTHERS.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDCASE.
|
||||
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
lv_fee = round( val = iv_seam_cm / lv_rate dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
|
||||
IF iv_seam_cm > 200.
|
||||
lv_fee = round( val = lv_fee * 9 / 10 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
IF iv_express = abap_true.
|
||||
lv_fee = round( val = lv_fee * 125 / 100 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
IF lv_fee < 40.
|
||||
lv_fee = 40.
|
||||
ENDIF.
|
||||
|
||||
cv_fee = lv_fee.
|
||||
|
||||
ENDFUNCTION.
|
||||
53
tasks_gen/train/G1097/faulty/m4_weld_fee.func.abap
Normal file
53
tasks_gen/train/G1097/faulty/m4_weld_fee.func.abap
Normal file
@@ -0,0 +1,53 @@
|
||||
FUNCTION {{p}}weld_fee
|
||||
IMPORTING
|
||||
iv_material TYPE string
|
||||
iv_seam_cm TYPE decfloat34
|
||||
iv_express TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_length.
|
||||
|
||||
IF iv_seam_cm < 0.
|
||||
RAISE invalid_length.
|
||||
ENDIF.
|
||||
|
||||
ev_skip = abap_false.
|
||||
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
CASE iv_material.
|
||||
WHEN 'ST'.
|
||||
lv_rate = 12.
|
||||
WHEN 'SS'.
|
||||
lv_rate = 20.
|
||||
WHEN 'AL'.
|
||||
IF iv_seam_cm > 50.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
lv_rate = 28.
|
||||
WHEN OTHERS.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDCASE.
|
||||
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
lv_fee = round( val = iv_seam_cm * lv_rate dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
|
||||
IF iv_seam_cm > 200.
|
||||
lv_fee = round( val = lv_fee * 9 / 10 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
IF iv_express <> abap_true.
|
||||
lv_fee = round( val = lv_fee * 125 / 100 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
IF lv_fee < 40.
|
||||
lv_fee = 40.
|
||||
ENDIF.
|
||||
|
||||
cv_fee = lv_fee.
|
||||
|
||||
ENDFUNCTION.
|
||||
19
tasks_gen/train/G1097/generation.json
Normal file
19
tasks_gen/train/G1097/generation.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"id": "G1097",
|
||||
"pool": "train",
|
||||
"object_type": "FUNC",
|
||||
"category": "F",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 4,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
112
tasks_gen/train/G1097/hidden/t14_hidden.clas.abap
Normal file
112
tasks_gen/train/G1097/hidden/t14_hidden.clas.abap
Normal file
@@ -0,0 +1,112 @@
|
||||
CLASS {{p}}t14_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS call
|
||||
IMPORTING iv_material TYPE string
|
||||
iv_seam_cm TYPE decfloat34
|
||||
iv_express TYPE abap_bool DEFAULT abap_false
|
||||
iv_fee TYPE decfloat34 DEFAULT 7
|
||||
EXPORTING ev_skip TYPE abap_bool
|
||||
ev_fee TYPE decfloat34
|
||||
ev_subrc TYPE sysubrc.
|
||||
METHODS rejects_negative_len FOR TESTING.
|
||||
METHODS steel_rate FOR TESTING.
|
||||
METHODS stainless_rate FOR TESTING.
|
||||
METHODS alu_short_charged FOR TESTING.
|
||||
METHODS alu_long_skipped FOR TESTING.
|
||||
METHODS unknown_mat_skipped FOR TESTING.
|
||||
METHODS discount_over_200cm FOR TESTING.
|
||||
METHODS express_surcharge FOR TESTING.
|
||||
METHODS minimum_charge FOR TESTING.
|
||||
METHODS rounding_two_decimals FOR TESTING.
|
||||
METHODS skip_false_for_steel FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t14_hidden IMPLEMENTATION.
|
||||
METHOD call.
|
||||
ev_fee = iv_fee.
|
||||
CALL FUNCTION '{{P}}WELD_FEE'
|
||||
EXPORTING
|
||||
iv_material = iv_material
|
||||
iv_seam_cm = iv_seam_cm
|
||||
iv_express = iv_express
|
||||
IMPORTING
|
||||
ev_skip = ev_skip
|
||||
CHANGING
|
||||
cv_fee = ev_fee
|
||||
EXCEPTIONS
|
||||
invalid_length = 1
|
||||
OTHERS = 2.
|
||||
ev_subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_negative_len.
|
||||
call( EXPORTING iv_material = `ST` iv_seam_cm = -1
|
||||
IMPORTING ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD steel_rate.
|
||||
call( EXPORTING iv_material = `ST` iv_seam_cm = 10
|
||||
IMPORTING ev_fee = DATA(lv_fee) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 120 ) act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD stainless_rate.
|
||||
call( EXPORTING iv_material = `SS` iv_seam_cm = 10
|
||||
IMPORTING ev_fee = DATA(lv_fee) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 200 ) act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD alu_short_charged.
|
||||
call( EXPORTING iv_material = `AL` iv_seam_cm = 30
|
||||
IMPORTING ev_fee = DATA(lv_fee) ev_skip = DATA(lv_skip) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 840 ) act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_false act = lv_skip ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD alu_long_skipped.
|
||||
call( EXPORTING iv_material = `AL` iv_seam_cm = 60 iv_fee = 7
|
||||
IMPORTING ev_fee = DATA(lv_fee) ev_skip = DATA(lv_skip) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_true act = lv_skip ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 7 ) act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_mat_skipped.
|
||||
call( EXPORTING iv_material = `TI` iv_seam_cm = 10 iv_fee = 5
|
||||
IMPORTING ev_fee = DATA(lv_fee) ev_skip = DATA(lv_skip) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_true act = lv_skip ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 5 ) act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount_over_200cm.
|
||||
call( EXPORTING iv_material = `ST` iv_seam_cm = 250
|
||||
IMPORTING ev_fee = DATA(lv_fee) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 2700 ) act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD express_surcharge.
|
||||
call( EXPORTING iv_material = `ST` iv_seam_cm = 10 iv_express = abap_true
|
||||
IMPORTING ev_fee = DATA(lv_fee) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 150 ) act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD minimum_charge.
|
||||
call( EXPORTING iv_material = `ST` iv_seam_cm = 2
|
||||
IMPORTING ev_fee = DATA(lv_fee) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 40 ) act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rounding_two_decimals.
|
||||
call( EXPORTING iv_material = `ST` iv_seam_cm = '10.00125'
|
||||
IMPORTING ev_fee = DATA(lv_fee) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '120.02' ) act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD skip_false_for_steel.
|
||||
call( EXPORTING iv_material = `ST` iv_seam_cm = 10
|
||||
IMPORTING ev_skip = DATA(lv_skip) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_false act = lv_skip ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
71
tasks_gen/train/G1097/mutation.json
Normal file
71
tasks_gen/train/G1097/mutation.json
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"task": "G1097",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}WELD_FEE",
|
||||
"mutant": "line 13: < -> >= (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "1/11",
|
||||
"failed_tests": [
|
||||
"ALU_LONG_SKIPPED",
|
||||
"ALU_SHORT_CHARGED",
|
||||
"DISCOUNT_OVER_200CM",
|
||||
"EXPRESS_SURCHARGE",
|
||||
"MINIMUM_CHARGE",
|
||||
"REJECTS_NEGATIVE_LEN",
|
||||
"ROUNDING_TWO_DECIMALS",
|
||||
"STAINLESS_RATE",
|
||||
"STEEL_RATE",
|
||||
"UNKNOWN_MAT_SKIPPED"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}WELD_FEE",
|
||||
"mutant": "line 32: abap_true -> abap_false (bool)",
|
||||
"status": "killed",
|
||||
"hidden": "10/11",
|
||||
"failed_tests": [
|
||||
"UNKNOWN_MAT_SKIPPED"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}WELD_FEE",
|
||||
"mutant": "line 37: * -> / (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "5/11",
|
||||
"failed_tests": [
|
||||
"ALU_SHORT_CHARGED",
|
||||
"DISCOUNT_OVER_200CM",
|
||||
"EXPRESS_SURCHARGE",
|
||||
"ROUNDING_TWO_DECIMALS",
|
||||
"STAINLESS_RATE",
|
||||
"STEEL_RATE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}WELD_FEE",
|
||||
"mutant": "line 40: 2 -> 3 (const)",
|
||||
"status": "survived",
|
||||
"hidden": "11/11",
|
||||
"failed_tests": []
|
||||
},
|
||||
{
|
||||
"object": "{{P}}WELD_FEE",
|
||||
"mutant": "line 43: = -> <> (eq)",
|
||||
"status": "killed",
|
||||
"hidden": "5/11",
|
||||
"failed_tests": [
|
||||
"ALU_SHORT_CHARGED",
|
||||
"DISCOUNT_OVER_200CM",
|
||||
"EXPRESS_SURCHARGE",
|
||||
"ROUNDING_TWO_DECIMALS",
|
||||
"STAINLESS_RATE",
|
||||
"STEEL_RATE"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 4,
|
||||
"kill_rate": 0.8,
|
||||
"ok": true
|
||||
}
|
||||
61
tasks_gen/train/G1097/reference/t14_test.clas.abap
Normal file
61
tasks_gen/train/G1097/reference/t14_test.clas.abap
Normal file
@@ -0,0 +1,61 @@
|
||||
CLASS {{p}}t14_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS fee_for
|
||||
IMPORTING iv_material TYPE string
|
||||
iv_seam_cm TYPE decfloat34
|
||||
iv_express TYPE abap_bool DEFAULT abap_false
|
||||
RETURNING VALUE(rv_fee) TYPE decfloat34.
|
||||
METHODS steel_charge FOR TESTING.
|
||||
METHODS stainless_charge FOR TESTING.
|
||||
METHODS aluminium_charge FOR TESTING.
|
||||
METHODS express_and_discount FOR TESTING.
|
||||
METHODS minimum_charge FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t14_test IMPLEMENTATION.
|
||||
METHOD fee_for.
|
||||
CALL FUNCTION '{{P}}WELD_FEE'
|
||||
EXPORTING
|
||||
iv_material = iv_material
|
||||
iv_seam_cm = iv_seam_cm
|
||||
iv_express = iv_express
|
||||
CHANGING
|
||||
cv_fee = rv_fee
|
||||
EXCEPTIONS
|
||||
invalid_length = 1
|
||||
OTHERS = 2.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD steel_charge.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( 120 )
|
||||
act = fee_for( iv_material = `ST` iv_seam_cm = 10 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD stainless_charge.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( 200 )
|
||||
act = fee_for( iv_material = `SS` iv_seam_cm = 10 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD aluminium_charge.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( 840 )
|
||||
act = fee_for( iv_material = `AL` iv_seam_cm = 30 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD express_and_discount.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( 3375 )
|
||||
act = fee_for( iv_material = `ST` iv_seam_cm = 250 iv_express = abap_true ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD minimum_charge.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( 40 )
|
||||
act = fee_for( iv_material = `ST` iv_seam_cm = 2 ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
53
tasks_gen/train/G1097/reference/weld_fee.func.abap
Normal file
53
tasks_gen/train/G1097/reference/weld_fee.func.abap
Normal file
@@ -0,0 +1,53 @@
|
||||
FUNCTION {{p}}weld_fee
|
||||
IMPORTING
|
||||
iv_material TYPE string
|
||||
iv_seam_cm TYPE decfloat34
|
||||
iv_express TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_length.
|
||||
|
||||
IF iv_seam_cm < 0.
|
||||
RAISE invalid_length.
|
||||
ENDIF.
|
||||
|
||||
ev_skip = abap_false.
|
||||
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
CASE iv_material.
|
||||
WHEN 'ST'.
|
||||
lv_rate = 12.
|
||||
WHEN 'SS'.
|
||||
lv_rate = 20.
|
||||
WHEN 'AL'.
|
||||
IF iv_seam_cm > 50.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
lv_rate = 28.
|
||||
WHEN OTHERS.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDCASE.
|
||||
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
lv_fee = round( val = iv_seam_cm * lv_rate dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
|
||||
IF iv_seam_cm > 200.
|
||||
lv_fee = round( val = lv_fee * 9 / 10 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
IF iv_express = abap_true.
|
||||
lv_fee = round( val = lv_fee * 125 / 100 dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
IF lv_fee < 40.
|
||||
lv_fee = 40.
|
||||
ENDIF.
|
||||
|
||||
cv_fee = lv_fee.
|
||||
|
||||
ENDFUNCTION.
|
||||
15
tasks_gen/train/G1097/seed/weld_sample.func.abap
Normal file
15
tasks_gen/train/G1097/seed/weld_sample.func.abap
Normal file
@@ -0,0 +1,15 @@
|
||||
FUNCTION {{p}}weld_sample
|
||||
IMPORTING
|
||||
iv_material TYPE string
|
||||
iv_seam_cm TYPE decfloat34
|
||||
iv_express TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_length.
|
||||
|
||||
ev_skip = abap_false.
|
||||
|
||||
ENDFUNCTION.
|
||||
48
tasks_gen/train/G1097/spec.md
Normal file
48
tasks_gen/train/G1097/spec.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# 1. Goal
|
||||
A mobile welding shop repairs metal parts. For each weld seam of a repair order,
|
||||
the order desk calls one event module. The event module calculates the charge of
|
||||
the seam. The event module must have the same interface as the sample event
|
||||
module, because the order desk calls all event modules in the same way.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Function group {{P}}FG_WELD exists in package $TMP.
|
||||
- Function module {{P}}WELD_SAMPLE exists in this group. It is the sample event
|
||||
module. Its interface is the interface that all event modules must use.
|
||||
|
||||
# 4. Contract
|
||||
- Create the function module {{P}}WELD_FEE in function group {{P}}FG_WELD.
|
||||
- Use exactly the interface of {{P}}WELD_SAMPLE: the same parameter names, kinds,
|
||||
types, and exceptions.
|
||||
|
||||
# 5. Business rules
|
||||
1. If the seam length is less than 0, raise the exception INVALID_LENGTH.
|
||||
2. Set the skip flag to false.
|
||||
3. Material ST (steel): the rate is 12.00 per centimetre.
|
||||
4. Material SS (stainless steel): the rate is 20.00 per centimetre.
|
||||
5. Material AL (aluminium): the rate is 28.00 per centimetre. The shop welds an
|
||||
aluminium seam only if the seam is at most 50 cm long.
|
||||
6. If the material is AL and the seam is longer than 50 cm, set the skip flag to
|
||||
true and stop. Do not change the charge.
|
||||
7. For all other materials, set the skip flag to true and stop. Do not change the
|
||||
charge.
|
||||
8. The charge is the rate multiplied by the seam length, rounded half up to 2
|
||||
decimals.
|
||||
9. If the seam is longer than 200 cm, the charge gets a discount of 10 %. Round
|
||||
the result half up to 2 decimals.
|
||||
10. If the express flag is true, the charge gets a surcharge of 25 %. Round the
|
||||
result half up to 2 decimals.
|
||||
11. Apply rule 9 before rule 10.
|
||||
12. The minimum charge is 40.00. If the charge is less than 40.00, use 40.00.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16.
|
||||
- Coding standards: Clean ABAP. Keep every method below 40 statements.
|
||||
- Out of scope: do not change {{P}}WELD_SAMPLE.
|
||||
|
||||
# 7. Acceptance
|
||||
- The function module {{P}}WELD_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/G1097/task.json
Normal file
84
tasks_gen/train/G1097/task.json
Normal file
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"id": "G1097",
|
||||
"category": "F",
|
||||
"object_type": "FUNC",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "FUGR",
|
||||
"name": "{{P}}FG_WELD",
|
||||
"description": "Welding charge events"
|
||||
},
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}WELD_SAMPLE",
|
||||
"functionGroup": "{{P}}FG_WELD",
|
||||
"file": "seed/weld_sample.func.abap",
|
||||
"description": "Sample event module"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}WELD_FEE",
|
||||
"functionGroup": "{{P}}FG_WELD",
|
||||
"params": [
|
||||
{
|
||||
"name": "iv_material",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "iv_seam_cm",
|
||||
"type": "decfloat34"
|
||||
},
|
||||
{
|
||||
"name": "iv_express",
|
||||
"type": "abap_bool"
|
||||
},
|
||||
{
|
||||
"name": "ev_skip",
|
||||
"type": "abap_bool"
|
||||
},
|
||||
{
|
||||
"name": "cv_fee",
|
||||
"type": "decfloat34"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}WELD_SAMPLE"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T14_HIDDEN",
|
||||
"file": "hidden/t14_hidden.clas.abap",
|
||||
"description": "T14 hidden tests"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}WELD_FEE",
|
||||
"functionGroup": "{{P}}FG_WELD",
|
||||
"file": "reference/weld_fee.func.abap",
|
||||
"description": "Welding charge event module"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T14_TEST",
|
||||
"file": "reference/t14_test.clas.abap",
|
||||
"description": "T14 own tests"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user