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/G1116/faulty/m0_carpet_fee.func.abap
Normal file
55
tasks_gen/train/G1116/faulty/m0_carpet_fee.func.abap
Normal file
@@ -0,0 +1,55 @@
|
||||
FUNCTION {{p}}carpet_fee
|
||||
IMPORTING
|
||||
iv_clean_type TYPE string
|
||||
iv_area_sqm TYPE decfloat34
|
||||
iv_stain TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_note TYPE string
|
||||
EXCEPTIONS
|
||||
invalid_type
|
||||
invalid_area
|
||||
stain_not_allowed
|
||||
area_too_large.
|
||||
|
||||
IF iv_clean_type <> 'CP' AND iv_clean_type <> 'UP' AND iv_clean_type <> 'RU'.
|
||||
RAISE invalid_type.
|
||||
ENDIF.
|
||||
|
||||
IF iv_area_sqm > 0.
|
||||
RAISE invalid_area.
|
||||
ENDIF.
|
||||
|
||||
IF iv_stain = abap_true AND iv_clean_type = 'RU'.
|
||||
RAISE stain_not_allowed.
|
||||
ENDIF.
|
||||
|
||||
IF iv_clean_type = 'CP' AND iv_area_sqm > 100.
|
||||
RAISE area_too_large.
|
||||
ENDIF.
|
||||
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
CASE iv_clean_type.
|
||||
WHEN 'CP'.
|
||||
lv_rate = '3.50'.
|
||||
WHEN 'UP'.
|
||||
lv_rate = '5.00'.
|
||||
WHEN OTHERS.
|
||||
lv_rate = '2.00'.
|
||||
ENDCASE.
|
||||
|
||||
DATA(lv_fee) = iv_area_sqm * lv_rate.
|
||||
IF iv_stain = abap_true.
|
||||
lv_fee = lv_fee + 25.
|
||||
ENDIF.
|
||||
lv_fee = round( val = lv_fee dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
|
||||
IF lv_fee < 40.
|
||||
ev_fee = 40.
|
||||
ev_note = 'MINIMUM FEE APPLIED'.
|
||||
ELSE.
|
||||
ev_fee = lv_fee.
|
||||
ev_note = ''.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
55
tasks_gen/train/G1116/faulty/m1_carpet_fee.func.abap
Normal file
55
tasks_gen/train/G1116/faulty/m1_carpet_fee.func.abap
Normal file
@@ -0,0 +1,55 @@
|
||||
FUNCTION {{p}}carpet_fee
|
||||
IMPORTING
|
||||
iv_clean_type TYPE string
|
||||
iv_area_sqm TYPE decfloat34
|
||||
iv_stain TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_note TYPE string
|
||||
EXCEPTIONS
|
||||
invalid_type
|
||||
invalid_area
|
||||
stain_not_allowed
|
||||
area_too_large.
|
||||
|
||||
IF iv_clean_type <> 'CP' AND iv_clean_type <> 'UP' AND iv_clean_type <> 'RU'.
|
||||
RAISE invalid_type.
|
||||
ENDIF.
|
||||
|
||||
IF iv_area_sqm <= 0.
|
||||
RAISE invalid_area.
|
||||
ENDIF.
|
||||
|
||||
IF iv_stain = abap_true OR iv_clean_type = 'RU'.
|
||||
RAISE stain_not_allowed.
|
||||
ENDIF.
|
||||
|
||||
IF iv_clean_type = 'CP' AND iv_area_sqm > 100.
|
||||
RAISE area_too_large.
|
||||
ENDIF.
|
||||
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
CASE iv_clean_type.
|
||||
WHEN 'CP'.
|
||||
lv_rate = '3.50'.
|
||||
WHEN 'UP'.
|
||||
lv_rate = '5.00'.
|
||||
WHEN OTHERS.
|
||||
lv_rate = '2.00'.
|
||||
ENDCASE.
|
||||
|
||||
DATA(lv_fee) = iv_area_sqm * lv_rate.
|
||||
IF iv_stain = abap_true.
|
||||
lv_fee = lv_fee + 25.
|
||||
ENDIF.
|
||||
lv_fee = round( val = lv_fee dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
|
||||
IF lv_fee < 40.
|
||||
ev_fee = 40.
|
||||
ev_note = 'MINIMUM FEE APPLIED'.
|
||||
ELSE.
|
||||
ev_fee = lv_fee.
|
||||
ev_note = ''.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
55
tasks_gen/train/G1116/faulty/m2_carpet_fee.func.abap
Normal file
55
tasks_gen/train/G1116/faulty/m2_carpet_fee.func.abap
Normal file
@@ -0,0 +1,55 @@
|
||||
FUNCTION {{p}}carpet_fee
|
||||
IMPORTING
|
||||
iv_clean_type TYPE string
|
||||
iv_area_sqm TYPE decfloat34
|
||||
iv_stain TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_note TYPE string
|
||||
EXCEPTIONS
|
||||
invalid_type
|
||||
invalid_area
|
||||
stain_not_allowed
|
||||
area_too_large.
|
||||
|
||||
IF iv_clean_type <> 'CP' AND iv_clean_type <> 'UP' AND iv_clean_type <> 'RU'.
|
||||
RAISE invalid_type.
|
||||
ENDIF.
|
||||
|
||||
IF iv_area_sqm <= 0.
|
||||
RAISE invalid_area.
|
||||
ENDIF.
|
||||
|
||||
IF iv_stain = abap_true AND iv_clean_type = 'RU'.
|
||||
RAISE stain_not_allowed.
|
||||
ENDIF.
|
||||
|
||||
IF iv_clean_type <> 'CP' AND iv_area_sqm > 100.
|
||||
RAISE area_too_large.
|
||||
ENDIF.
|
||||
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
CASE iv_clean_type.
|
||||
WHEN 'CP'.
|
||||
lv_rate = '3.50'.
|
||||
WHEN 'UP'.
|
||||
lv_rate = '5.00'.
|
||||
WHEN OTHERS.
|
||||
lv_rate = '2.00'.
|
||||
ENDCASE.
|
||||
|
||||
DATA(lv_fee) = iv_area_sqm * lv_rate.
|
||||
IF iv_stain = abap_true.
|
||||
lv_fee = lv_fee + 25.
|
||||
ENDIF.
|
||||
lv_fee = round( val = lv_fee dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
|
||||
IF lv_fee < 40.
|
||||
ev_fee = 40.
|
||||
ev_note = 'MINIMUM FEE APPLIED'.
|
||||
ELSE.
|
||||
ev_fee = lv_fee.
|
||||
ev_note = ''.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
55
tasks_gen/train/G1116/faulty/m3_carpet_fee.func.abap
Normal file
55
tasks_gen/train/G1116/faulty/m3_carpet_fee.func.abap
Normal file
@@ -0,0 +1,55 @@
|
||||
FUNCTION {{p}}carpet_fee
|
||||
IMPORTING
|
||||
iv_clean_type TYPE string
|
||||
iv_area_sqm TYPE decfloat34
|
||||
iv_stain TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_note TYPE string
|
||||
EXCEPTIONS
|
||||
invalid_type
|
||||
invalid_area
|
||||
stain_not_allowed
|
||||
area_too_large.
|
||||
|
||||
IF iv_clean_type <> 'CP' AND iv_clean_type <> 'UP' AND iv_clean_type <> 'RU'.
|
||||
RAISE invalid_type.
|
||||
ENDIF.
|
||||
|
||||
IF iv_area_sqm <= 0.
|
||||
RAISE invalid_area.
|
||||
ENDIF.
|
||||
|
||||
IF iv_stain = abap_true AND iv_clean_type = 'RU'.
|
||||
RAISE stain_not_allowed.
|
||||
ENDIF.
|
||||
|
||||
IF iv_clean_type = 'CP' AND iv_area_sqm > 100.
|
||||
RAISE area_too_large.
|
||||
ENDIF.
|
||||
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
CASE iv_clean_type.
|
||||
WHEN 'CP'.
|
||||
lv_rate = '3.50'.
|
||||
WHEN 'UP'.
|
||||
lv_rate = '5.00'.
|
||||
WHEN OTHERS.
|
||||
lv_rate = '2.00'.
|
||||
ENDCASE.
|
||||
|
||||
DATA(lv_fee) = iv_area_sqm * lv_rate.
|
||||
IF iv_stain = abap_false.
|
||||
lv_fee = lv_fee + 25.
|
||||
ENDIF.
|
||||
lv_fee = round( val = lv_fee dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
|
||||
IF lv_fee < 40.
|
||||
ev_fee = 40.
|
||||
ev_note = 'MINIMUM FEE APPLIED'.
|
||||
ELSE.
|
||||
ev_fee = lv_fee.
|
||||
ev_note = ''.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
55
tasks_gen/train/G1116/faulty/m4_carpet_fee.func.abap
Normal file
55
tasks_gen/train/G1116/faulty/m4_carpet_fee.func.abap
Normal file
@@ -0,0 +1,55 @@
|
||||
FUNCTION {{p}}carpet_fee
|
||||
IMPORTING
|
||||
iv_clean_type TYPE string
|
||||
iv_area_sqm TYPE decfloat34
|
||||
iv_stain TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_note TYPE string
|
||||
EXCEPTIONS
|
||||
invalid_type
|
||||
invalid_area
|
||||
stain_not_allowed
|
||||
area_too_large.
|
||||
|
||||
IF iv_clean_type <> 'CP' AND iv_clean_type <> 'UP' AND iv_clean_type <> 'RU'.
|
||||
RAISE invalid_type.
|
||||
ENDIF.
|
||||
|
||||
IF iv_area_sqm <= 0.
|
||||
RAISE invalid_area.
|
||||
ENDIF.
|
||||
|
||||
IF iv_stain = abap_true AND iv_clean_type = 'RU'.
|
||||
RAISE stain_not_allowed.
|
||||
ENDIF.
|
||||
|
||||
IF iv_clean_type = 'CP' AND iv_area_sqm > 100.
|
||||
RAISE area_too_large.
|
||||
ENDIF.
|
||||
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
CASE iv_clean_type.
|
||||
WHEN 'CP'.
|
||||
lv_rate = '3.50'.
|
||||
WHEN 'UP'.
|
||||
lv_rate = '5.00'.
|
||||
WHEN OTHERS.
|
||||
lv_rate = '2.00'.
|
||||
ENDCASE.
|
||||
|
||||
DATA(lv_fee) = iv_area_sqm * lv_rate.
|
||||
IF iv_stain = abap_true.
|
||||
lv_fee = lv_fee - 25.
|
||||
ENDIF.
|
||||
lv_fee = round( val = lv_fee dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
|
||||
IF lv_fee < 40.
|
||||
ev_fee = 40.
|
||||
ev_note = 'MINIMUM FEE APPLIED'.
|
||||
ELSE.
|
||||
ev_fee = lv_fee.
|
||||
ev_note = ''.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
19
tasks_gen/train/G1116/generation.json
Normal file
19
tasks_gen/train/G1116/generation.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"id": "G1116",
|
||||
"pool": "train",
|
||||
"object_type": "FUNC",
|
||||
"category": "D",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
134
tasks_gen/train/G1116/hidden/t42_hidden.clas.abap
Normal file
134
tasks_gen/train/G1116/hidden/t42_hidden.clas.abap
Normal file
@@ -0,0 +1,134 @@
|
||||
CLASS {{p}}t42_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS call
|
||||
IMPORTING
|
||||
iv_type TYPE string
|
||||
iv_area TYPE decfloat34
|
||||
iv_stain TYPE abap_bool DEFAULT abap_false
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_note TYPE string
|
||||
ev_subrc TYPE sysubrc.
|
||||
METHODS carpet_rate FOR TESTING.
|
||||
METHODS upholstery_stain FOR TESTING.
|
||||
METHODS rug_rate FOR TESTING.
|
||||
METHODS minimum_fee_note FOR TESTING.
|
||||
METHODS rounding_half_up FOR TESTING.
|
||||
METHODS invalid_type FOR TESTING.
|
||||
METHODS invalid_area FOR TESTING.
|
||||
METHODS stain_not_allowed FOR TESTING.
|
||||
METHODS area_too_large FOR TESTING.
|
||||
METHODS type_checked_first FOR TESTING.
|
||||
METHODS area_before_stain FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t42_hidden IMPLEMENTATION.
|
||||
METHOD call.
|
||||
CALL FUNCTION '{{P}}CARPET_FEE'
|
||||
EXPORTING
|
||||
iv_clean_type = iv_type
|
||||
iv_area_sqm = iv_area
|
||||
iv_stain = iv_stain
|
||||
IMPORTING
|
||||
ev_fee = ev_fee
|
||||
ev_note = ev_note
|
||||
EXCEPTIONS
|
||||
invalid_type = 1
|
||||
invalid_area = 2
|
||||
stain_not_allowed = 3
|
||||
area_too_large = 4
|
||||
OTHERS = 5.
|
||||
ev_subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD carpet_rate.
|
||||
call( EXPORTING iv_type = `CP` iv_area = 20
|
||||
IMPORTING ev_fee = DATA(lv_fee) ev_note = DATA(lv_note) ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '70.00' ) act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_initial( act = lv_note ).
|
||||
|
||||
call( EXPORTING iv_type = `CP` iv_area = 100
|
||||
IMPORTING ev_fee = lv_fee ev_subrc = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '350.00' ) act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD upholstery_stain.
|
||||
call( EXPORTING iv_type = `UP` iv_area = 10 iv_stain = abap_true
|
||||
IMPORTING ev_fee = DATA(lv_fee) ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '75.00' ) act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rug_rate.
|
||||
call( EXPORTING iv_type = `RU` iv_area = 25
|
||||
IMPORTING ev_fee = DATA(lv_fee) ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '50.00' ) act = lv_fee ).
|
||||
|
||||
call( EXPORTING iv_type = `RU` iv_area = 200
|
||||
IMPORTING ev_fee = lv_fee ev_subrc = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '400.00' ) act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD minimum_fee_note.
|
||||
call( EXPORTING iv_type = `CP` iv_area = 5
|
||||
IMPORTING ev_fee = DATA(lv_fee) ev_note = DATA(lv_note) ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '40.00' ) act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `MINIMUM FEE APPLIED` act = lv_note ).
|
||||
|
||||
call( EXPORTING iv_type = `UP` iv_area = 8
|
||||
IMPORTING ev_fee = lv_fee ev_note = lv_note ev_subrc = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '40.00' ) act = lv_fee ).
|
||||
cl_abap_unit_assert=>assert_initial( act = lv_note ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rounding_half_up.
|
||||
call( EXPORTING iv_type = `CP` iv_area = '12.57'
|
||||
IMPORTING ev_fee = DATA(lv_fee) ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '44.00' ) act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_type.
|
||||
call( EXPORTING iv_type = `XX` iv_area = 10
|
||||
IMPORTING ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_area.
|
||||
call( EXPORTING iv_type = `CP` iv_area = 0
|
||||
IMPORTING ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_rc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD stain_not_allowed.
|
||||
call( EXPORTING iv_type = `RU` iv_area = 10 iv_stain = abap_true
|
||||
IMPORTING ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = lv_rc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD area_too_large.
|
||||
call( EXPORTING iv_type = `CP` iv_area = '100.01'
|
||||
IMPORTING ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4 act = lv_rc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD type_checked_first.
|
||||
call( EXPORTING iv_type = `XX` iv_area = -5
|
||||
IMPORTING ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD area_before_stain.
|
||||
call( EXPORTING iv_type = `RU` iv_area = -5 iv_stain = abap_true
|
||||
IMPORTING ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_rc ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
68
tasks_gen/train/G1116/mutation.json
Normal file
68
tasks_gen/train/G1116/mutation.json
Normal file
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"task": "G1116",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}CARPET_FEE",
|
||||
"mutant": "line 19: <= -> > (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "2/11",
|
||||
"failed_tests": [
|
||||
"AREA_BEFORE_STAIN",
|
||||
"AREA_TOO_LARGE",
|
||||
"CARPET_RATE",
|
||||
"INVALID_AREA",
|
||||
"MINIMUM_FEE_NOTE",
|
||||
"ROUNDING_HALF_UP",
|
||||
"RUG_RATE",
|
||||
"STAIN_NOT_ALLOWED",
|
||||
"UPHOLSTERY_STAIN"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}CARPET_FEE",
|
||||
"mutant": "line 23: AND -> OR (logic)",
|
||||
"status": "killed",
|
||||
"hidden": "9/11",
|
||||
"failed_tests": [
|
||||
"RUG_RATE",
|
||||
"UPHOLSTERY_STAIN"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}CARPET_FEE",
|
||||
"mutant": "line 27: = -> <> (eq)",
|
||||
"status": "killed",
|
||||
"hidden": "9/11",
|
||||
"failed_tests": [
|
||||
"AREA_TOO_LARGE",
|
||||
"RUG_RATE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}CARPET_FEE",
|
||||
"mutant": "line 42: abap_true -> abap_false (bool)",
|
||||
"status": "killed",
|
||||
"hidden": "6/11",
|
||||
"failed_tests": [
|
||||
"CARPET_RATE",
|
||||
"MINIMUM_FEE_NOTE",
|
||||
"ROUNDING_HALF_UP",
|
||||
"RUG_RATE",
|
||||
"UPHOLSTERY_STAIN"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}CARPET_FEE",
|
||||
"mutant": "line 43: + -> - (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "10/11",
|
||||
"failed_tests": [
|
||||
"UPHOLSTERY_STAIN"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
55
tasks_gen/train/G1116/reference/carpet_fee.func.abap
Normal file
55
tasks_gen/train/G1116/reference/carpet_fee.func.abap
Normal file
@@ -0,0 +1,55 @@
|
||||
FUNCTION {{p}}carpet_fee
|
||||
IMPORTING
|
||||
iv_clean_type TYPE string
|
||||
iv_area_sqm TYPE decfloat34
|
||||
iv_stain TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_note TYPE string
|
||||
EXCEPTIONS
|
||||
invalid_type
|
||||
invalid_area
|
||||
stain_not_allowed
|
||||
area_too_large.
|
||||
|
||||
IF iv_clean_type <> 'CP' AND iv_clean_type <> 'UP' AND iv_clean_type <> 'RU'.
|
||||
RAISE invalid_type.
|
||||
ENDIF.
|
||||
|
||||
IF iv_area_sqm <= 0.
|
||||
RAISE invalid_area.
|
||||
ENDIF.
|
||||
|
||||
IF iv_stain = abap_true AND iv_clean_type = 'RU'.
|
||||
RAISE stain_not_allowed.
|
||||
ENDIF.
|
||||
|
||||
IF iv_clean_type = 'CP' AND iv_area_sqm > 100.
|
||||
RAISE area_too_large.
|
||||
ENDIF.
|
||||
|
||||
DATA lv_rate TYPE decfloat34.
|
||||
CASE iv_clean_type.
|
||||
WHEN 'CP'.
|
||||
lv_rate = '3.50'.
|
||||
WHEN 'UP'.
|
||||
lv_rate = '5.00'.
|
||||
WHEN OTHERS.
|
||||
lv_rate = '2.00'.
|
||||
ENDCASE.
|
||||
|
||||
DATA(lv_fee) = iv_area_sqm * lv_rate.
|
||||
IF iv_stain = abap_true.
|
||||
lv_fee = lv_fee + 25.
|
||||
ENDIF.
|
||||
lv_fee = round( val = lv_fee dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
|
||||
IF lv_fee < 40.
|
||||
ev_fee = 40.
|
||||
ev_note = 'MINIMUM FEE APPLIED'.
|
||||
ELSE.
|
||||
ev_fee = lv_fee.
|
||||
ev_note = ''.
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
114
tasks_gen/train/G1116/reference/t42_test.clas.abap
Normal file
114
tasks_gen/train/G1116/reference/t42_test.clas.abap
Normal file
@@ -0,0 +1,114 @@
|
||||
CLASS {{p}}t42_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS fee_for
|
||||
IMPORTING
|
||||
iv_type TYPE string
|
||||
iv_area TYPE decfloat34
|
||||
iv_stain TYPE abap_bool DEFAULT abap_false
|
||||
RETURNING
|
||||
VALUE(rv_fee) TYPE decfloat34.
|
||||
METHODS carpet_fee FOR TESTING.
|
||||
METHODS minimum_fee FOR TESTING.
|
||||
METHODS stain_surcharge FOR TESTING.
|
||||
METHODS invalid_type FOR TESTING.
|
||||
METHODS invalid_area FOR TESTING.
|
||||
METHODS stain_not_allowed FOR TESTING.
|
||||
METHODS area_too_large FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t42_test IMPLEMENTATION.
|
||||
METHOD fee_for.
|
||||
DATA lv_note TYPE string.
|
||||
CALL FUNCTION '{{P}}CARPET_FEE'
|
||||
EXPORTING
|
||||
iv_clean_type = iv_type
|
||||
iv_area_sqm = iv_area
|
||||
iv_stain = iv_stain
|
||||
IMPORTING
|
||||
ev_fee = rv_fee
|
||||
ev_note = lv_note
|
||||
EXCEPTIONS
|
||||
OTHERS = 1.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD carpet_fee.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '70.00' )
|
||||
act = fee_for( iv_type = `CP` iv_area = 20 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD minimum_fee.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '40.00' )
|
||||
act = fee_for( iv_type = `CP` iv_area = 5 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD stain_surcharge.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '75.00' )
|
||||
act = fee_for( iv_type = `UP` iv_area = 10 iv_stain = abap_true ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_type.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
CALL FUNCTION '{{P}}CARPET_FEE'
|
||||
EXPORTING
|
||||
iv_clean_type = `XX`
|
||||
iv_area_sqm = 10
|
||||
iv_stain = abap_false
|
||||
IMPORTING
|
||||
ev_fee = lv_fee
|
||||
EXCEPTIONS
|
||||
invalid_type = 1
|
||||
OTHERS = 2.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_area.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
CALL FUNCTION '{{P}}CARPET_FEE'
|
||||
EXPORTING
|
||||
iv_clean_type = `CP`
|
||||
iv_area_sqm = 0
|
||||
iv_stain = abap_false
|
||||
IMPORTING
|
||||
ev_fee = lv_fee
|
||||
EXCEPTIONS
|
||||
invalid_area = 2
|
||||
OTHERS = 3.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = sy-subrc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD stain_not_allowed.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
CALL FUNCTION '{{P}}CARPET_FEE'
|
||||
EXPORTING
|
||||
iv_clean_type = `RU`
|
||||
iv_area_sqm = 10
|
||||
iv_stain = abap_true
|
||||
IMPORTING
|
||||
ev_fee = lv_fee
|
||||
EXCEPTIONS
|
||||
stain_not_allowed = 3
|
||||
OTHERS = 4.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = sy-subrc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD area_too_large.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
CALL FUNCTION '{{P}}CARPET_FEE'
|
||||
EXPORTING
|
||||
iv_clean_type = `CP`
|
||||
iv_area_sqm = '120.5'
|
||||
iv_stain = abap_false
|
||||
IMPORTING
|
||||
ev_fee = lv_fee
|
||||
EXCEPTIONS
|
||||
area_too_large = 4
|
||||
OTHERS = 5.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4 act = sy-subrc ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
20
tasks_gen/train/G1116/seed/carpet_sample.func.abap
Normal file
20
tasks_gen/train/G1116/seed/carpet_sample.func.abap
Normal file
@@ -0,0 +1,20 @@
|
||||
FUNCTION {{p}}carpet_sample
|
||||
IMPORTING
|
||||
iv_clean_type TYPE string
|
||||
iv_area_sqm TYPE decfloat34
|
||||
iv_stain TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_fee TYPE decfloat34
|
||||
ev_note TYPE string
|
||||
EXCEPTIONS
|
||||
invalid_type
|
||||
invalid_area
|
||||
stain_not_allowed
|
||||
area_too_large.
|
||||
|
||||
" Sample module. It shows the interface that the pricing modules of the
|
||||
" group use. The calculation of the fee is not part of this sample.
|
||||
ev_fee = 0.
|
||||
ev_note = ''.
|
||||
|
||||
ENDFUNCTION.
|
||||
62
tasks_gen/train/G1116/spec.md
Normal file
62
tasks_gen/train/G1116/spec.md
Normal file
@@ -0,0 +1,62 @@
|
||||
# 1. Goal
|
||||
Calculate the fee of a cleaning job for a carpet cleaning company. The order
|
||||
desk calls one function module for each cleaning job. The function module
|
||||
checks the job data, calculates the fee, and returns a note for the order desk.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Function group {{P}}FG_CARPET exists in package $TMP.
|
||||
- Function module {{P}}CARPET_SAMPLE exists in this group. It shows the
|
||||
interface that the pricing modules of the group use.
|
||||
- The order desk calls the pricing module for each cleaning job.
|
||||
|
||||
# 4. Contract
|
||||
Create the function module {{P}}CARPET_FEE in function group {{P}}FG_CARPET.
|
||||
Use exactly the interface of {{P}}CARPET_SAMPLE:
|
||||
- Importing parameters:
|
||||
- iv_clean_type TYPE string
|
||||
- iv_area_sqm TYPE decfloat34
|
||||
- iv_stain TYPE abap_bool
|
||||
- Exporting parameters:
|
||||
- ev_fee TYPE decfloat34
|
||||
- ev_note TYPE string
|
||||
- Exceptions:
|
||||
- invalid_type
|
||||
- invalid_area
|
||||
- stain_not_allowed
|
||||
- area_too_large
|
||||
|
||||
# 5. Business rules
|
||||
1. Check the job data in this order: cleaning type, area, stain option, carpet
|
||||
size limit. Raise only the first exception that applies.
|
||||
2. The cleaning type is 'CP' (carpet), 'UP' (upholstery) or 'RU' (rug). For
|
||||
any other value, raise invalid_type.
|
||||
3. The area must be greater than 0. For an area of 0 or less, raise
|
||||
invalid_area.
|
||||
4. A stain treatment is possible for 'CP' and 'UP' only. If iv_stain is true
|
||||
and the cleaning type is 'RU', raise stain_not_allowed.
|
||||
5. A carpet with an area greater than 100 square metres needs a site visit. If
|
||||
the cleaning type is 'CP' and the area is greater than 100, raise
|
||||
area_too_large.
|
||||
6. The base rate for each square metre is 3.50 for 'CP', 5.00 for 'UP' and 2.00
|
||||
for 'RU'.
|
||||
7. A stain treatment adds 25.00 to the fee.
|
||||
8. The fee is the base amount plus the surcharge, rounded half up to 2 decimal
|
||||
places.
|
||||
9. The minimum fee is 40.00. If the fee from rule 8 is less than 40.00, the fee
|
||||
is 40.00 and the note is 'MINIMUM FEE APPLIED'. In all other cases the note
|
||||
is empty.
|
||||
10. If an exception is raised, the fee and the note are not set.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 7.58.
|
||||
- Coding standards: Clean ABAP. Keep the function module short and readable.
|
||||
- Out of scope: do not change {{P}}CARPET_SAMPLE. Do not create database
|
||||
tables.
|
||||
|
||||
# 7. Acceptance
|
||||
- The function module {{P}}CARPET_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/G1116/task.json
Normal file
84
tasks_gen/train/G1116/task.json
Normal file
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"id": "G1116",
|
||||
"category": "D",
|
||||
"object_type": "FUNC",
|
||||
"difficulty": 2,
|
||||
"release_target": "v758",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "FUGR",
|
||||
"name": "{{P}}FG_CARPET",
|
||||
"description": "Carpet cleaning pricing"
|
||||
},
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}CARPET_SAMPLE",
|
||||
"functionGroup": "{{P}}FG_CARPET",
|
||||
"file": "seed/carpet_sample.func.abap",
|
||||
"description": "Sample pricing module that shows the interface of the group"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}CARPET_FEE",
|
||||
"functionGroup": "{{P}}FG_CARPET",
|
||||
"params": [
|
||||
{
|
||||
"name": "iv_clean_type",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "iv_area_sqm",
|
||||
"type": "decfloat34"
|
||||
},
|
||||
{
|
||||
"name": "iv_stain",
|
||||
"type": "abap_bool"
|
||||
},
|
||||
{
|
||||
"name": "ev_fee",
|
||||
"type": "decfloat34"
|
||||
},
|
||||
{
|
||||
"name": "ev_note",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}CARPET_SAMPLE"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T42_HIDDEN",
|
||||
"file": "hidden/t42_hidden.clas.abap",
|
||||
"description": "T42 hidden tests"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}CARPET_FEE",
|
||||
"functionGroup": "{{P}}FG_CARPET",
|
||||
"file": "reference/carpet_fee.func.abap",
|
||||
"description": "Carpet cleaning fee module"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T42_TEST",
|
||||
"file": "reference/t42_test.clas.abap",
|
||||
"description": "T42 own tests"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user