Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
56
tasks_gen/train/G1125/faulty/m0_prt_price.func.abap
Normal file
56
tasks_gen/train/G1125/faulty/m0_prt_price.func.abap
Normal file
@@ -0,0 +1,56 @@
|
||||
FUNCTION {{p}}prt_price
|
||||
IMPORTING
|
||||
iv_job_type TYPE string
|
||||
iv_quantity TYPE i
|
||||
iv_express TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
ev_note TYPE string
|
||||
CHANGING
|
||||
cv_price TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_quantity.
|
||||
|
||||
CONSTANTS:
|
||||
lc_price_fl TYPE decfloat34 VALUE '0.05',
|
||||
lc_price_bc TYPE decfloat34 VALUE '0.08',
|
||||
lc_price_po TYPE decfloat34 VALUE '1.15',
|
||||
lc_min_fl TYPE decfloat34 VALUE '10',
|
||||
lc_min_bc TYPE decfloat34 VALUE '5',
|
||||
lc_discount TYPE decfloat34 VALUE '0.9',
|
||||
lc_express TYPE decfloat34 VALUE '1.25'.
|
||||
|
||||
ev_skip = abap_true.
|
||||
ev_note = ''.
|
||||
cv_price = 0.
|
||||
|
||||
IF iv_quantity < 1.
|
||||
RAISE invalid_quantity.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_job_type.
|
||||
WHEN 'FL'.
|
||||
cv_price = round( val = iv_quantity * lc_price_fl dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF cv_price < lc_min_fl.
|
||||
cv_price = lc_min_fl.
|
||||
ENDIF.
|
||||
WHEN 'BC'.
|
||||
cv_price = round( val = iv_quantity * lc_price_bc dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF cv_price < lc_min_bc.
|
||||
cv_price = lc_min_bc.
|
||||
ENDIF.
|
||||
WHEN 'PO'.
|
||||
cv_price = round( val = iv_quantity * lc_price_po dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF iv_quantity > 100.
|
||||
cv_price = round( val = cv_price * lc_discount dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
WHEN OTHERS.
|
||||
ev_skip = abap_true.
|
||||
ev_note = 'MANUAL QUOTE'.
|
||||
ENDCASE.
|
||||
|
||||
IF iv_express = abap_true AND cv_price > 0.
|
||||
cv_price = round( val = cv_price * lc_express dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
56
tasks_gen/train/G1125/faulty/m2_prt_price.func.abap
Normal file
56
tasks_gen/train/G1125/faulty/m2_prt_price.func.abap
Normal file
@@ -0,0 +1,56 @@
|
||||
FUNCTION {{p}}prt_price
|
||||
IMPORTING
|
||||
iv_job_type TYPE string
|
||||
iv_quantity TYPE i
|
||||
iv_express TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
ev_note TYPE string
|
||||
CHANGING
|
||||
cv_price TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_quantity.
|
||||
|
||||
CONSTANTS:
|
||||
lc_price_fl TYPE decfloat34 VALUE '0.05',
|
||||
lc_price_bc TYPE decfloat34 VALUE '0.08',
|
||||
lc_price_po TYPE decfloat34 VALUE '1.15',
|
||||
lc_min_fl TYPE decfloat34 VALUE '10',
|
||||
lc_min_bc TYPE decfloat34 VALUE '5',
|
||||
lc_discount TYPE decfloat34 VALUE '0.9',
|
||||
lc_express TYPE decfloat34 VALUE '1.25'.
|
||||
|
||||
ev_skip = abap_false.
|
||||
ev_note = ''.
|
||||
cv_price = 0.
|
||||
|
||||
IF iv_quantity < 1.
|
||||
RAISE invalid_quantity.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_job_type.
|
||||
WHEN 'FL'.
|
||||
cv_price = round( val = iv_quantity * lc_price_fl dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF cv_price < lc_min_fl.
|
||||
cv_price = lc_min_fl.
|
||||
ENDIF.
|
||||
WHEN 'BC'.
|
||||
cv_price = round( val = iv_quantity * lc_price_bc dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF cv_price < lc_min_bc.
|
||||
cv_price = lc_min_bc.
|
||||
ENDIF.
|
||||
WHEN 'PO'.
|
||||
cv_price = round( val = iv_quantity * lc_price_po dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF iv_quantity <= 100.
|
||||
cv_price = round( val = cv_price * lc_discount dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
WHEN OTHERS.
|
||||
ev_skip = abap_true.
|
||||
ev_note = 'MANUAL QUOTE'.
|
||||
ENDCASE.
|
||||
|
||||
IF iv_express = abap_true AND cv_price > 0.
|
||||
cv_price = round( val = cv_price * lc_express dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
56
tasks_gen/train/G1125/faulty/m3_prt_price.func.abap
Normal file
56
tasks_gen/train/G1125/faulty/m3_prt_price.func.abap
Normal file
@@ -0,0 +1,56 @@
|
||||
FUNCTION {{p}}prt_price
|
||||
IMPORTING
|
||||
iv_job_type TYPE string
|
||||
iv_quantity TYPE i
|
||||
iv_express TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
ev_note TYPE string
|
||||
CHANGING
|
||||
cv_price TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_quantity.
|
||||
|
||||
CONSTANTS:
|
||||
lc_price_fl TYPE decfloat34 VALUE '0.05',
|
||||
lc_price_bc TYPE decfloat34 VALUE '0.08',
|
||||
lc_price_po TYPE decfloat34 VALUE '1.15',
|
||||
lc_min_fl TYPE decfloat34 VALUE '10',
|
||||
lc_min_bc TYPE decfloat34 VALUE '5',
|
||||
lc_discount TYPE decfloat34 VALUE '0.9',
|
||||
lc_express TYPE decfloat34 VALUE '1.25'.
|
||||
|
||||
ev_skip = abap_false.
|
||||
ev_note = ''.
|
||||
cv_price = 0.
|
||||
|
||||
IF iv_quantity < 1.
|
||||
RAISE invalid_quantity.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_job_type.
|
||||
WHEN 'FL'.
|
||||
cv_price = round( val = iv_quantity * lc_price_fl dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF cv_price < lc_min_fl.
|
||||
cv_price = lc_min_fl.
|
||||
ENDIF.
|
||||
WHEN 'BC'.
|
||||
cv_price = round( val = iv_quantity * lc_price_bc dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF cv_price < lc_min_bc.
|
||||
cv_price = lc_min_bc.
|
||||
ENDIF.
|
||||
WHEN 'PO'.
|
||||
cv_price = round( val = iv_quantity * lc_price_po dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF iv_quantity > 100.
|
||||
cv_price = round( val = cv_price * lc_discount dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
WHEN OTHERS.
|
||||
ev_skip = abap_true.
|
||||
ev_note = 'MANUAL QUOTE'.
|
||||
ENDCASE.
|
||||
|
||||
IF iv_express <> abap_true AND cv_price > 0.
|
||||
cv_price = round( val = cv_price * lc_express dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
56
tasks_gen/train/G1125/faulty/m4_prt_price.func.abap
Normal file
56
tasks_gen/train/G1125/faulty/m4_prt_price.func.abap
Normal file
@@ -0,0 +1,56 @@
|
||||
FUNCTION {{p}}prt_price
|
||||
IMPORTING
|
||||
iv_job_type TYPE string
|
||||
iv_quantity TYPE i
|
||||
iv_express TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
ev_note TYPE string
|
||||
CHANGING
|
||||
cv_price TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_quantity.
|
||||
|
||||
CONSTANTS:
|
||||
lc_price_fl TYPE decfloat34 VALUE '0.05',
|
||||
lc_price_bc TYPE decfloat34 VALUE '0.08',
|
||||
lc_price_po TYPE decfloat34 VALUE '1.15',
|
||||
lc_min_fl TYPE decfloat34 VALUE '10',
|
||||
lc_min_bc TYPE decfloat34 VALUE '5',
|
||||
lc_discount TYPE decfloat34 VALUE '0.9',
|
||||
lc_express TYPE decfloat34 VALUE '1.25'.
|
||||
|
||||
ev_skip = abap_false.
|
||||
ev_note = ''.
|
||||
cv_price = 0.
|
||||
|
||||
IF iv_quantity < 1.
|
||||
RAISE invalid_quantity.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_job_type.
|
||||
WHEN 'FL'.
|
||||
cv_price = round( val = iv_quantity * lc_price_fl dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF cv_price < lc_min_fl.
|
||||
cv_price = lc_min_fl.
|
||||
ENDIF.
|
||||
WHEN 'BC'.
|
||||
cv_price = round( val = iv_quantity * lc_price_bc dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF cv_price < lc_min_bc.
|
||||
cv_price = lc_min_bc.
|
||||
ENDIF.
|
||||
WHEN 'PO'.
|
||||
cv_price = round( val = iv_quantity * lc_price_po dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF iv_quantity > 100.
|
||||
cv_price = round( val = cv_price * lc_discount dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
WHEN OTHERS.
|
||||
ev_skip = abap_true.
|
||||
ev_note = 'MANUAL QUOTE'.
|
||||
ENDCASE.
|
||||
|
||||
IF iv_express = abap_true AND cv_price > 0.
|
||||
cv_price = round( val = cv_price / lc_express dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
24
tasks_gen/train/G1125/generation.json
Normal file
24
tasks_gen/train/G1125/generation.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"id": "G1125",
|
||||
"pool": "train",
|
||||
"object_type": "FUNC",
|
||||
"category": "F",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 85.0,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 4,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
121
tasks_gen/train/G1125/hidden/prt_hidden.clas.abap
Normal file
121
tasks_gen/train/G1125/hidden/prt_hidden.clas.abap
Normal file
@@ -0,0 +1,121 @@
|
||||
CLASS {{p}}prt_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS call
|
||||
IMPORTING iv_type TYPE string
|
||||
iv_quantity TYPE i
|
||||
iv_express TYPE abap_bool DEFAULT abap_false
|
||||
iv_price TYPE decfloat34 DEFAULT 0
|
||||
EXPORTING ev_skip TYPE abap_bool
|
||||
ev_note TYPE string
|
||||
ev_price TYPE decfloat34
|
||||
ev_subrc TYPE sysubrc.
|
||||
METHODS flyers_price FOR TESTING.
|
||||
METHODS flyers_minimum FOR TESTING.
|
||||
METHODS cards_price FOR TESTING.
|
||||
METHODS cards_minimum FOR TESTING.
|
||||
METHODS posters_discount FOR TESTING.
|
||||
METHODS posters_no_discount FOR TESTING.
|
||||
METHODS express_surcharge FOR TESTING.
|
||||
METHODS manual_quote FOR TESTING.
|
||||
METHODS invalid_quantity FOR TESTING.
|
||||
METHODS skip_false_for_flyers FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}prt_hidden IMPLEMENTATION.
|
||||
METHOD call.
|
||||
ev_price = iv_price.
|
||||
ev_note = ''.
|
||||
CALL FUNCTION '{{P}}PRT_PRICE'
|
||||
EXPORTING
|
||||
iv_job_type = iv_type
|
||||
iv_quantity = iv_quantity
|
||||
iv_express = iv_express
|
||||
IMPORTING
|
||||
ev_skip = ev_skip
|
||||
ev_note = ev_note
|
||||
CHANGING
|
||||
cv_price = ev_price
|
||||
EXCEPTIONS
|
||||
invalid_quantity = 1
|
||||
OTHERS = 2.
|
||||
ev_subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD flyers_price.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
call( EXPORTING iv_type = `FL` iv_quantity = 400
|
||||
IMPORTING ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '20.00' ) act = lv_price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD flyers_minimum.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
call( EXPORTING iv_type = `FL` iv_quantity = 10
|
||||
IMPORTING ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '10.00' ) act = lv_price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD cards_price.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
call( EXPORTING iv_type = `BC` iv_quantity = 100
|
||||
IMPORTING ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '8.00' ) act = lv_price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD cards_minimum.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
call( EXPORTING iv_type = `BC` iv_quantity = 10
|
||||
IMPORTING ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '5.00' ) act = lv_price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD posters_discount.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
call( EXPORTING iv_type = `PO` iv_quantity = 101
|
||||
IMPORTING ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '104.54' ) act = lv_price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD posters_no_discount.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
call( EXPORTING iv_type = `PO` iv_quantity = 100
|
||||
IMPORTING ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '115.00' ) act = lv_price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD express_surcharge.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
call( EXPORTING iv_type = `FL` iv_quantity = 202 iv_express = abap_true
|
||||
IMPORTING ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '12.63' ) act = lv_price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD manual_quote.
|
||||
DATA lv_skip TYPE abap_bool.
|
||||
DATA lv_note TYPE string.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
call( EXPORTING iv_type = `XX` iv_quantity = 50
|
||||
IMPORTING ev_skip = lv_skip ev_note = lv_note ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_true act = lv_skip ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `MANUAL QUOTE` act = lv_note ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '0.00' ) act = lv_price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_quantity.
|
||||
DATA lv_rc TYPE sysubrc.
|
||||
call( EXPORTING iv_type = `FL` iv_quantity = 0
|
||||
IMPORTING ev_subrc = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD skip_false_for_flyers.
|
||||
DATA lv_skip TYPE abap_bool.
|
||||
DATA lv_note TYPE string.
|
||||
call( EXPORTING iv_type = `FL` iv_quantity = 400
|
||||
IMPORTING ev_skip = lv_skip ev_note = lv_note ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_false act = lv_skip ).
|
||||
cl_abap_unit_assert=>assert_initial( lv_note ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
59
tasks_gen/train/G1125/mutation.json
Normal file
59
tasks_gen/train/G1125/mutation.json
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"task": "G1125",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}PRT_PRICE",
|
||||
"mutant": "line 23: abap_false -> abap_true (bool)",
|
||||
"status": "killed",
|
||||
"hidden": "9/10",
|
||||
"failed_tests": [
|
||||
"SKIP_FALSE_FOR_FLYERS"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}PRT_PRICE",
|
||||
"mutant": "line 43: 2 -> 3 (const)",
|
||||
"status": "survived",
|
||||
"hidden": "10/10",
|
||||
"failed_tests": []
|
||||
},
|
||||
{
|
||||
"object": "{{P}}PRT_PRICE",
|
||||
"mutant": "line 44: > -> <= (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "8/10",
|
||||
"failed_tests": [
|
||||
"POSTERS_DISCOUNT",
|
||||
"POSTERS_NO_DISCOUNT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}PRT_PRICE",
|
||||
"mutant": "line 52: = -> <> (eq)",
|
||||
"status": "killed",
|
||||
"hidden": "3/10",
|
||||
"failed_tests": [
|
||||
"CARDS_MINIMUM",
|
||||
"CARDS_PRICE",
|
||||
"EXPRESS_SURCHARGE",
|
||||
"FLYERS_MINIMUM",
|
||||
"FLYERS_PRICE",
|
||||
"POSTERS_DISCOUNT",
|
||||
"POSTERS_NO_DISCOUNT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}PRT_PRICE",
|
||||
"mutant": "line 53: * -> / (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "9/10",
|
||||
"failed_tests": [
|
||||
"EXPRESS_SURCHARGE"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 4,
|
||||
"kill_rate": 0.8,
|
||||
"ok": true
|
||||
}
|
||||
56
tasks_gen/train/G1125/reference/prt_price.func.abap
Normal file
56
tasks_gen/train/G1125/reference/prt_price.func.abap
Normal file
@@ -0,0 +1,56 @@
|
||||
FUNCTION {{p}}prt_price
|
||||
IMPORTING
|
||||
iv_job_type TYPE string
|
||||
iv_quantity TYPE i
|
||||
iv_express TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
ev_note TYPE string
|
||||
CHANGING
|
||||
cv_price TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_quantity.
|
||||
|
||||
CONSTANTS:
|
||||
lc_price_fl TYPE decfloat34 VALUE '0.05',
|
||||
lc_price_bc TYPE decfloat34 VALUE '0.08',
|
||||
lc_price_po TYPE decfloat34 VALUE '1.15',
|
||||
lc_min_fl TYPE decfloat34 VALUE '10',
|
||||
lc_min_bc TYPE decfloat34 VALUE '5',
|
||||
lc_discount TYPE decfloat34 VALUE '0.9',
|
||||
lc_express TYPE decfloat34 VALUE '1.25'.
|
||||
|
||||
ev_skip = abap_false.
|
||||
ev_note = ''.
|
||||
cv_price = 0.
|
||||
|
||||
IF iv_quantity < 1.
|
||||
RAISE invalid_quantity.
|
||||
ENDIF.
|
||||
|
||||
CASE iv_job_type.
|
||||
WHEN 'FL'.
|
||||
cv_price = round( val = iv_quantity * lc_price_fl dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF cv_price < lc_min_fl.
|
||||
cv_price = lc_min_fl.
|
||||
ENDIF.
|
||||
WHEN 'BC'.
|
||||
cv_price = round( val = iv_quantity * lc_price_bc dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF cv_price < lc_min_bc.
|
||||
cv_price = lc_min_bc.
|
||||
ENDIF.
|
||||
WHEN 'PO'.
|
||||
cv_price = round( val = iv_quantity * lc_price_po dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF iv_quantity > 100.
|
||||
cv_price = round( val = cv_price * lc_discount dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
WHEN OTHERS.
|
||||
ev_skip = abap_true.
|
||||
ev_note = 'MANUAL QUOTE'.
|
||||
ENDCASE.
|
||||
|
||||
IF iv_express = abap_true AND cv_price > 0.
|
||||
cv_price = round( val = cv_price * lc_express dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
ENDIF.
|
||||
|
||||
ENDFUNCTION.
|
||||
107
tasks_gen/train/G1125/reference/prt_test.clas.abap
Normal file
107
tasks_gen/train/G1125/reference/prt_test.clas.abap
Normal file
@@ -0,0 +1,107 @@
|
||||
CLASS {{p}}prt_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS price_of
|
||||
IMPORTING iv_type TYPE string
|
||||
iv_quantity TYPE i
|
||||
iv_express TYPE abap_bool DEFAULT abap_false
|
||||
EXPORTING ev_skip TYPE abap_bool
|
||||
ev_note TYPE string
|
||||
ev_price TYPE decfloat34
|
||||
ev_subrc TYPE sysubrc.
|
||||
METHODS flyers_fee FOR TESTING.
|
||||
METHODS minimum_fee FOR TESTING.
|
||||
METHODS posters_fee FOR TESTING.
|
||||
METHODS express_fee FOR TESTING.
|
||||
METHODS manual_quote FOR TESTING.
|
||||
METHODS invalid_quantity FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}prt_test IMPLEMENTATION.
|
||||
METHOD price_of.
|
||||
ev_skip = abap_false.
|
||||
ev_note = ''.
|
||||
ev_price = 0.
|
||||
CALL FUNCTION '{{P}}PRT_PRICE'
|
||||
EXPORTING
|
||||
iv_job_type = iv_type
|
||||
iv_quantity = iv_quantity
|
||||
iv_express = iv_express
|
||||
IMPORTING
|
||||
ev_skip = ev_skip
|
||||
ev_note = ev_note
|
||||
CHANGING
|
||||
cv_price = ev_price
|
||||
EXCEPTIONS
|
||||
invalid_quantity = 1
|
||||
OTHERS = 2.
|
||||
ev_subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD flyers_fee.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
price_of( EXPORTING iv_type = `FL` iv_quantity = 400
|
||||
IMPORTING ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '20.00' )
|
||||
act = lv_price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD minimum_fee.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
price_of( EXPORTING iv_type = `FL` iv_quantity = 10
|
||||
IMPORTING ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '10.00' )
|
||||
act = lv_price ).
|
||||
price_of( EXPORTING iv_type = `BC` iv_quantity = 10
|
||||
IMPORTING ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '5.00' )
|
||||
act = lv_price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD posters_fee.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
price_of( EXPORTING iv_type = `PO` iv_quantity = 100
|
||||
IMPORTING ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '115.00' )
|
||||
act = lv_price ).
|
||||
price_of( EXPORTING iv_type = `PO` iv_quantity = 101
|
||||
IMPORTING ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '104.54' )
|
||||
act = lv_price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD express_fee.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
price_of( EXPORTING iv_type = `FL` iv_quantity = 202 iv_express = abap_true
|
||||
IMPORTING ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '12.63' )
|
||||
act = lv_price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD manual_quote.
|
||||
DATA lv_skip TYPE abap_bool.
|
||||
DATA lv_note TYPE string.
|
||||
DATA lv_price TYPE decfloat34.
|
||||
price_of( EXPORTING iv_type = `XX` iv_quantity = 50
|
||||
IMPORTING ev_skip = lv_skip ev_note = lv_note ev_price = lv_price ).
|
||||
cl_abap_unit_assert=>assert_true( lv_skip ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `MANUAL QUOTE` act = lv_note ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV decfloat34( '0.00' )
|
||||
act = lv_price ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_quantity.
|
||||
DATA lv_subrc TYPE sysubrc.
|
||||
price_of( EXPORTING iv_type = `FL` iv_quantity = 0
|
||||
IMPORTING ev_subrc = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_subrc ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
18
tasks_gen/train/G1125/seed/prt_sample.func.abap
Normal file
18
tasks_gen/train/G1125/seed/prt_sample.func.abap
Normal file
@@ -0,0 +1,18 @@
|
||||
FUNCTION {{p}}prt_sample
|
||||
IMPORTING
|
||||
iv_job_type TYPE string
|
||||
iv_quantity TYPE i
|
||||
iv_express TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
ev_note TYPE string
|
||||
CHANGING
|
||||
cv_price TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_quantity.
|
||||
|
||||
ev_skip = abap_false.
|
||||
ev_note = ''.
|
||||
cv_price = 0.
|
||||
|
||||
ENDFUNCTION.
|
||||
45
tasks_gen/train/G1125/spec.md
Normal file
45
tasks_gen/train/G1125/spec.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# 1. Goal
|
||||
A print shop prices print jobs. The order desk calls one pricing module for each
|
||||
print job. The pricing module must have the same interface as the sample pricing
|
||||
module, because the order desk calls all pricing modules in the same way.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Function group {{P}}FG_PRT exists in package $TMP.
|
||||
- Function module {{P}}PRT_SAMPLE exists in this group. It is the sample pricing
|
||||
module. Its interface is the interface that all pricing modules must use.
|
||||
|
||||
# 4. Contract
|
||||
- Create the function module {{P}}PRT_PRICE in function group {{P}}FG_PRT.
|
||||
- Use exactly the interface of {{P}}PRT_SAMPLE: the same parameter names, kinds,
|
||||
types, and exceptions.
|
||||
|
||||
# 5. Business rules
|
||||
1. If the quantity is less than 1, raise the exception INVALID_QUANTITY.
|
||||
2. Set the skip flag to false and the note to an empty string, except in rule 7.
|
||||
3. Job type FL (flyers): the price is the quantity multiplied by 0.05, rounded
|
||||
half up to 2 decimals. If the price is less than 10.00, the price is 10.00.
|
||||
4. Job type BC (business cards): the price is the quantity multiplied by 0.08,
|
||||
rounded half up to 2 decimals. If the price is less than 5.00, the price is
|
||||
5.00.
|
||||
5. Job type PO (posters): the price is the quantity multiplied by 1.15, rounded
|
||||
half up to 2 decimals. If the quantity is greater than 100, the price is
|
||||
reduced by 10 %. The reduced price is rounded half up to 2 decimals.
|
||||
6. Express: if the express flag is true and the price is greater than 0, the
|
||||
price is increased by 25 %. The increased price is rounded half up to 2
|
||||
decimals.
|
||||
7. Any other job type: the price is 0, the skip flag is true, and the note is
|
||||
MANUAL QUOTE. Rule 6 does not apply to these job types.
|
||||
8. The changing parameter always contains the final price.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: ABAP Platform 2025 (SAP_BASIS 816).
|
||||
- Coding standards: Clean ABAP.
|
||||
- Out of scope: do not change {{P}}PRT_SAMPLE.
|
||||
|
||||
# 7. Acceptance
|
||||
- The function module is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write ABAP Unit tests for the function module in a global test class.
|
||||
88
tasks_gen/train/G1125/task.json
Normal file
88
tasks_gen/train/G1125/task.json
Normal file
@@ -0,0 +1,88 @@
|
||||
{
|
||||
"id": "G1125",
|
||||
"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_PRT",
|
||||
"description": "Print job pricing"
|
||||
},
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}PRT_SAMPLE",
|
||||
"functionGroup": "{{P}}FG_PRT",
|
||||
"file": "seed/prt_sample.func.abap",
|
||||
"description": "Sample pricing module that defines the interface"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}PRT_PRICE",
|
||||
"functionGroup": "{{P}}FG_PRT",
|
||||
"params": [
|
||||
{
|
||||
"name": "iv_job_type",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "iv_quantity",
|
||||
"type": "i"
|
||||
},
|
||||
{
|
||||
"name": "iv_express",
|
||||
"type": "abap_bool"
|
||||
},
|
||||
{
|
||||
"name": "ev_skip",
|
||||
"type": "abap_bool"
|
||||
},
|
||||
{
|
||||
"name": "ev_note",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "cv_price",
|
||||
"type": "decfloat34"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}PRT_SAMPLE"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}PRT_HIDDEN",
|
||||
"file": "hidden/prt_hidden.clas.abap",
|
||||
"description": "T14 hidden tests"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}PRT_PRICE",
|
||||
"functionGroup": "{{P}}FG_PRT",
|
||||
"file": "reference/prt_price.func.abap",
|
||||
"description": "Print job pricing module"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}PRT_TEST",
|
||||
"file": "reference/prt_test.clas.abap",
|
||||
"description": "T14 own tests"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user