Pipeline controller: plan 2 (hard +, error +50 %), backlog throttle, 2 trajectory workers, stop rules, summaries every 50; budget reserve
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
41
tasks_gen/train/G1006/faulty/m0_auc_premium.func.abap
Normal file
41
tasks_gen/train/G1006/faulty/m0_auc_premium.func.abap
Normal file
@@ -0,0 +1,41 @@
|
||||
FUNCTION {{p}}auc_premium
|
||||
IMPORTING
|
||||
iv_lot_type TYPE string
|
||||
iv_hammer TYPE decfloat34
|
||||
iv_channel TYPE string
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_hammer.
|
||||
|
||||
DATA lv_premium TYPE decfloat34.
|
||||
|
||||
ev_skip = abap_true.
|
||||
IF iv_hammer < 0.
|
||||
RAISE invalid_hammer.
|
||||
ENDIF.
|
||||
IF iv_lot_type = 'C'.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
IF iv_hammer <= 1000.
|
||||
lv_premium = iv_hammer * 20 / 100.
|
||||
ELSEIF iv_hammer <= 10000.
|
||||
lv_premium = 1000 * 20 / 100 + ( iv_hammer - 1000 ) * 12 / 100.
|
||||
ELSE.
|
||||
lv_premium = 1000 * 20 / 100 + 9000 * 12 / 100 + ( iv_hammer - 10000 ) * 6 / 100.
|
||||
ENDIF.
|
||||
IF iv_channel = 'O'.
|
||||
lv_premium = lv_premium * 90 / 100.
|
||||
ENDIF.
|
||||
lv_premium = round( val = lv_premium dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF lv_premium < 5.
|
||||
lv_premium = 5.
|
||||
ELSEIF lv_premium > 5000.
|
||||
lv_premium = 5000.
|
||||
ENDIF.
|
||||
cv_fee = lv_premium.
|
||||
|
||||
ENDFUNCTION.
|
||||
41
tasks_gen/train/G1006/faulty/m1_auc_premium.func.abap
Normal file
41
tasks_gen/train/G1006/faulty/m1_auc_premium.func.abap
Normal file
@@ -0,0 +1,41 @@
|
||||
FUNCTION {{p}}auc_premium
|
||||
IMPORTING
|
||||
iv_lot_type TYPE string
|
||||
iv_hammer TYPE decfloat34
|
||||
iv_channel TYPE string
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_hammer.
|
||||
|
||||
DATA lv_premium TYPE decfloat34.
|
||||
|
||||
ev_skip = abap_false.
|
||||
IF iv_hammer < 0.
|
||||
RAISE invalid_hammer.
|
||||
ENDIF.
|
||||
IF iv_lot_type = 'C'.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
IF iv_hammer <= 1000.
|
||||
lv_premium = iv_hammer * 20 / 100.
|
||||
ELSEIF iv_hammer > 10000.
|
||||
lv_premium = 1000 * 20 / 100 + ( iv_hammer - 1000 ) * 12 / 100.
|
||||
ELSE.
|
||||
lv_premium = 1000 * 20 / 100 + 9000 * 12 / 100 + ( iv_hammer - 10000 ) * 6 / 100.
|
||||
ENDIF.
|
||||
IF iv_channel = 'O'.
|
||||
lv_premium = lv_premium * 90 / 100.
|
||||
ENDIF.
|
||||
lv_premium = round( val = lv_premium dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF lv_premium < 5.
|
||||
lv_premium = 5.
|
||||
ELSEIF lv_premium > 5000.
|
||||
lv_premium = 5000.
|
||||
ENDIF.
|
||||
cv_fee = lv_premium.
|
||||
|
||||
ENDFUNCTION.
|
||||
41
tasks_gen/train/G1006/faulty/m2_auc_premium.func.abap
Normal file
41
tasks_gen/train/G1006/faulty/m2_auc_premium.func.abap
Normal file
@@ -0,0 +1,41 @@
|
||||
FUNCTION {{p}}auc_premium
|
||||
IMPORTING
|
||||
iv_lot_type TYPE string
|
||||
iv_hammer TYPE decfloat34
|
||||
iv_channel TYPE string
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_hammer.
|
||||
|
||||
DATA lv_premium TYPE decfloat34.
|
||||
|
||||
ev_skip = abap_false.
|
||||
IF iv_hammer < 0.
|
||||
RAISE invalid_hammer.
|
||||
ENDIF.
|
||||
IF iv_lot_type = 'C'.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
IF iv_hammer <= 1000.
|
||||
lv_premium = iv_hammer * 20 / 100.
|
||||
ELSEIF iv_hammer <= 10000.
|
||||
lv_premium = 1000 * 20 / 100 + ( iv_hammer - 1000 ) * 12 / 100.
|
||||
ELSE.
|
||||
lv_premium = 1000 * 20 / 100 + 9000 * 12 / 101 + ( iv_hammer - 10000 ) * 6 / 100.
|
||||
ENDIF.
|
||||
IF iv_channel = 'O'.
|
||||
lv_premium = lv_premium * 90 / 100.
|
||||
ENDIF.
|
||||
lv_premium = round( val = lv_premium dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF lv_premium < 5.
|
||||
lv_premium = 5.
|
||||
ELSEIF lv_premium > 5000.
|
||||
lv_premium = 5000.
|
||||
ENDIF.
|
||||
cv_fee = lv_premium.
|
||||
|
||||
ENDFUNCTION.
|
||||
41
tasks_gen/train/G1006/faulty/m3_auc_premium.func.abap
Normal file
41
tasks_gen/train/G1006/faulty/m3_auc_premium.func.abap
Normal file
@@ -0,0 +1,41 @@
|
||||
FUNCTION {{p}}auc_premium
|
||||
IMPORTING
|
||||
iv_lot_type TYPE string
|
||||
iv_hammer TYPE decfloat34
|
||||
iv_channel TYPE string
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_hammer.
|
||||
|
||||
DATA lv_premium TYPE decfloat34.
|
||||
|
||||
ev_skip = abap_false.
|
||||
IF iv_hammer < 0.
|
||||
RAISE invalid_hammer.
|
||||
ENDIF.
|
||||
IF iv_lot_type = 'C'.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
IF iv_hammer <= 1000.
|
||||
lv_premium = iv_hammer * 20 / 100.
|
||||
ELSEIF iv_hammer <= 10000.
|
||||
lv_premium = 1000 * 20 / 100 + ( iv_hammer - 1000 ) * 12 / 100.
|
||||
ELSE.
|
||||
lv_premium = 1000 * 20 / 100 + 9000 * 12 / 100 + ( iv_hammer - 10000 ) * 6 / 100.
|
||||
ENDIF.
|
||||
IF iv_channel <> 'O'.
|
||||
lv_premium = lv_premium * 90 / 100.
|
||||
ENDIF.
|
||||
lv_premium = round( val = lv_premium dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF lv_premium < 5.
|
||||
lv_premium = 5.
|
||||
ELSEIF lv_premium > 5000.
|
||||
lv_premium = 5000.
|
||||
ENDIF.
|
||||
cv_fee = lv_premium.
|
||||
|
||||
ENDFUNCTION.
|
||||
41
tasks_gen/train/G1006/faulty/m4_auc_premium.func.abap
Normal file
41
tasks_gen/train/G1006/faulty/m4_auc_premium.func.abap
Normal file
@@ -0,0 +1,41 @@
|
||||
FUNCTION {{p}}auc_premium
|
||||
IMPORTING
|
||||
iv_lot_type TYPE string
|
||||
iv_hammer TYPE decfloat34
|
||||
iv_channel TYPE string
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_hammer.
|
||||
|
||||
DATA lv_premium TYPE decfloat34.
|
||||
|
||||
ev_skip = abap_false.
|
||||
IF iv_hammer < 0.
|
||||
RAISE invalid_hammer.
|
||||
ENDIF.
|
||||
IF iv_lot_type = 'C'.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
IF iv_hammer <= 1000.
|
||||
lv_premium = iv_hammer * 20 / 100.
|
||||
ELSEIF iv_hammer <= 10000.
|
||||
lv_premium = 1000 * 20 / 100 + ( iv_hammer - 1000 ) * 12 / 100.
|
||||
ELSE.
|
||||
lv_premium = 1000 * 20 / 100 + 9000 * 12 / 100 + ( iv_hammer - 10000 ) * 6 / 100.
|
||||
ENDIF.
|
||||
IF iv_channel = 'O'.
|
||||
lv_premium = lv_premium / 90 / 100.
|
||||
ENDIF.
|
||||
lv_premium = round( val = lv_premium dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF lv_premium < 5.
|
||||
lv_premium = 5.
|
||||
ELSEIF lv_premium > 5000.
|
||||
lv_premium = 5000.
|
||||
ENDIF.
|
||||
cv_fee = lv_premium.
|
||||
|
||||
ENDFUNCTION.
|
||||
60
tasks_gen/train/G1006/generation.json
Normal file
60
tasks_gen/train/G1006/generation.json
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"id": "G1006",
|
||||
"pool": "train",
|
||||
"object_type": "FUNC",
|
||||
"category": "G",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"hidden/t14_hidden.clas.abap line 47: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"hidden/t14_hidden.clas.abap line 53: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"hidden/t14_hidden.clas.abap line 59: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"hidden/t14_hidden.clas.abap line 65: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"hidden/t14_hidden.clas.abap line 71: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"hidden/t14_hidden.clas.abap line 77: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"hidden/t14_hidden.clas.abap line 83: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"hidden/t14_hidden.clas.abap line 89: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"hidden/t14_hidden.clas.abap line 96: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"Too close to task G0150 (similarity spec 0.60, rules 0.63, names 0.25). Choose a different business topic and different object names.",
|
||||
"Too close to task G0151 (similarity spec 0.70, rules 0.63, names 0.33). Choose a different business topic and different object names.",
|
||||
"Too close to task G0173 (similarity spec 0.65, rules 0.62, names 0.33). Choose a different business topic and different object names."
|
||||
],
|
||||
"by_check": {
|
||||
"abaplint": 9,
|
||||
"extra": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"invalid JSON: Invalid \\escape: line 1 column 1374 (char 1373)"
|
||||
],
|
||||
"by_check": {
|
||||
"json": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"hidden/t14_hidden.clas.abap line 82: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"15\"",
|
||||
"hidden/t14_hidden.clas.abap line 83: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"call\"",
|
||||
"hidden/t14_hidden.clas.abap line 83: syntax error for release v702 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"56\""
|
||||
],
|
||||
"by_check": {
|
||||
"abaplint": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
133
tasks_gen/train/G1006/hidden/t14_hidden.clas.abap
Normal file
133
tasks_gen/train/G1006/hidden/t14_hidden.clas.abap
Normal file
@@ -0,0 +1,133 @@
|
||||
CLASS {{p}}t14_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS call
|
||||
IMPORTING iv_lot_type TYPE string
|
||||
iv_hammer TYPE decfloat34
|
||||
iv_channel TYPE string
|
||||
iv_fee TYPE decfloat34 DEFAULT 7
|
||||
EXPORTING ev_skip TYPE abap_bool
|
||||
ev_fee TYPE decfloat34
|
||||
ev_subrc TYPE sysubrc.
|
||||
METHODS band_first FOR TESTING.
|
||||
METHODS band_second FOR TESTING.
|
||||
METHODS band_third FOR TESTING.
|
||||
METHODS online_reduction FOR TESTING.
|
||||
METHODS premium_rounding FOR TESTING.
|
||||
METHODS minimum_premium FOR TESTING.
|
||||
METHODS maximum_premium FOR TESTING.
|
||||
METHODS charity_skips FOR TESTING.
|
||||
METHODS negative_hammer FOR TESTING.
|
||||
METHODS skip_false_for_sale FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t14_hidden IMPLEMENTATION.
|
||||
METHOD call.
|
||||
ev_fee = iv_fee.
|
||||
CALL FUNCTION '{{P}}AUC_PREMIUM'
|
||||
EXPORTING
|
||||
iv_lot_type = iv_lot_type
|
||||
iv_hammer = iv_hammer
|
||||
iv_channel = iv_channel
|
||||
IMPORTING
|
||||
ev_skip = ev_skip
|
||||
CHANGING
|
||||
cv_fee = ev_fee
|
||||
EXCEPTIONS
|
||||
invalid_hammer = 1
|
||||
OTHERS = 2.
|
||||
ev_subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD band_first.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
DATA lv_act TYPE decfloat34.
|
||||
lv_exp = 100.
|
||||
call( EXPORTING iv_lot_type = `S` iv_hammer = 500 iv_channel = `B`
|
||||
IMPORTING ev_fee = lv_act ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_act ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD band_second.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
DATA lv_act TYPE decfloat34.
|
||||
lv_exp = 320.
|
||||
call( EXPORTING iv_lot_type = `S` iv_hammer = 2000 iv_channel = `B`
|
||||
IMPORTING ev_fee = lv_act ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_act ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD band_third.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
DATA lv_act TYPE decfloat34.
|
||||
lv_exp = 1880.
|
||||
call( EXPORTING iv_lot_type = `S` iv_hammer = 20000 iv_channel = `B`
|
||||
IMPORTING ev_fee = lv_act ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_act ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD online_reduction.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
DATA lv_act TYPE decfloat34.
|
||||
lv_exp = 90.
|
||||
call( EXPORTING iv_lot_type = `S` iv_hammer = 500 iv_channel = `O`
|
||||
IMPORTING ev_fee = lv_act ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_act ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD premium_rounding.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
DATA lv_act TYPE decfloat34.
|
||||
DATA lv_hammer TYPE decfloat34.
|
||||
lv_exp = '228.15'.
|
||||
lv_hammer = '1234.56'.
|
||||
call( EXPORTING iv_lot_type = `S` iv_hammer = lv_hammer iv_channel = `B`
|
||||
IMPORTING ev_fee = lv_act ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_act ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD minimum_premium.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
DATA lv_act TYPE decfloat34.
|
||||
lv_exp = 5.
|
||||
call( EXPORTING iv_lot_type = `S` iv_hammer = 10 iv_channel = `B`
|
||||
IMPORTING ev_fee = lv_act ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_act ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD maximum_premium.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
DATA lv_act TYPE decfloat34.
|
||||
lv_exp = 5000.
|
||||
call( EXPORTING iv_lot_type = `S` iv_hammer = 100000 iv_channel = `B`
|
||||
IMPORTING ev_fee = lv_act ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_act ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD charity_skips.
|
||||
DATA lv_skip TYPE abap_bool.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
lv_fee = 7.
|
||||
lv_exp = 7.
|
||||
call( EXPORTING iv_lot_type = `C` iv_hammer = 5000 iv_channel = `B` 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 negative_hammer.
|
||||
DATA lv_rc TYPE sysubrc.
|
||||
call( EXPORTING iv_lot_type = `S` iv_hammer = -1 iv_channel = `B`
|
||||
IMPORTING ev_subrc = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD skip_false_for_sale.
|
||||
DATA lv_skip TYPE abap_bool.
|
||||
call( EXPORTING iv_lot_type = `S` iv_hammer = 500 iv_channel = `B`
|
||||
IMPORTING ev_skip = lv_skip ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_false act = lv_skip ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
60
tasks_gen/train/G1006/mutation.json
Normal file
60
tasks_gen/train/G1006/mutation.json
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"task": "G1006",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}AUC_PREMIUM",
|
||||
"mutant": "line 15: abap_false -> abap_true (bool)",
|
||||
"status": "killed",
|
||||
"hidden": "9/10",
|
||||
"failed_tests": [
|
||||
"SKIP_FALSE_FOR_SALE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}AUC_PREMIUM",
|
||||
"mutant": "line 25: <= -> > (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "7/10",
|
||||
"failed_tests": [
|
||||
"BAND_SECOND",
|
||||
"BAND_THIRD",
|
||||
"PREMIUM_ROUNDING"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}AUC_PREMIUM",
|
||||
"mutant": "line 28: 100 -> 101 (const)",
|
||||
"status": "killed",
|
||||
"hidden": "9/10",
|
||||
"failed_tests": [
|
||||
"BAND_THIRD"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}AUC_PREMIUM",
|
||||
"mutant": "line 30: = -> <> (eq)",
|
||||
"status": "killed",
|
||||
"hidden": "5/10",
|
||||
"failed_tests": [
|
||||
"BAND_FIRST",
|
||||
"BAND_SECOND",
|
||||
"BAND_THIRD",
|
||||
"ONLINE_REDUCTION",
|
||||
"PREMIUM_ROUNDING"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}AUC_PREMIUM",
|
||||
"mutant": "line 31: * -> / (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "9/10",
|
||||
"failed_tests": [
|
||||
"ONLINE_REDUCTION"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
41
tasks_gen/train/G1006/reference/auc_premium.func.abap
Normal file
41
tasks_gen/train/G1006/reference/auc_premium.func.abap
Normal file
@@ -0,0 +1,41 @@
|
||||
FUNCTION {{p}}auc_premium
|
||||
IMPORTING
|
||||
iv_lot_type TYPE string
|
||||
iv_hammer TYPE decfloat34
|
||||
iv_channel TYPE string
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_hammer.
|
||||
|
||||
DATA lv_premium TYPE decfloat34.
|
||||
|
||||
ev_skip = abap_false.
|
||||
IF iv_hammer < 0.
|
||||
RAISE invalid_hammer.
|
||||
ENDIF.
|
||||
IF iv_lot_type = 'C'.
|
||||
ev_skip = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
IF iv_hammer <= 1000.
|
||||
lv_premium = iv_hammer * 20 / 100.
|
||||
ELSEIF iv_hammer <= 10000.
|
||||
lv_premium = 1000 * 20 / 100 + ( iv_hammer - 1000 ) * 12 / 100.
|
||||
ELSE.
|
||||
lv_premium = 1000 * 20 / 100 + 9000 * 12 / 100 + ( iv_hammer - 10000 ) * 6 / 100.
|
||||
ENDIF.
|
||||
IF iv_channel = 'O'.
|
||||
lv_premium = lv_premium * 90 / 100.
|
||||
ENDIF.
|
||||
lv_premium = round( val = lv_premium dec = 2 mode = cl_abap_math=>round_half_up ).
|
||||
IF lv_premium < 5.
|
||||
lv_premium = 5.
|
||||
ELSEIF lv_premium > 5000.
|
||||
lv_premium = 5000.
|
||||
ENDIF.
|
||||
cv_fee = lv_premium.
|
||||
|
||||
ENDFUNCTION.
|
||||
99
tasks_gen/train/G1006/reference/t14_test.clas.abap
Normal file
99
tasks_gen/train/G1006/reference/t14_test.clas.abap
Normal file
@@ -0,0 +1,99 @@
|
||||
CLASS {{p}}t14_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS premium_for
|
||||
IMPORTING iv_lot_type TYPE string
|
||||
iv_hammer TYPE decfloat34
|
||||
iv_channel TYPE string
|
||||
RETURNING VALUE(rv_fee) TYPE decfloat34.
|
||||
METHODS band_premium FOR TESTING.
|
||||
METHODS online_reduction FOR TESTING.
|
||||
METHODS premium_limits FOR TESTING.
|
||||
METHODS charity_lot FOR TESTING.
|
||||
METHODS negative_hammer FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t14_test IMPLEMENTATION.
|
||||
METHOD premium_for.
|
||||
DATA lv_skip TYPE abap_bool.
|
||||
CALL FUNCTION '{{P}}AUC_PREMIUM'
|
||||
EXPORTING
|
||||
iv_lot_type = iv_lot_type
|
||||
iv_hammer = iv_hammer
|
||||
iv_channel = iv_channel
|
||||
IMPORTING
|
||||
ev_skip = lv_skip
|
||||
CHANGING
|
||||
cv_fee = rv_fee
|
||||
EXCEPTIONS
|
||||
invalid_hammer = 1
|
||||
OTHERS = 2.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD band_premium.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
DATA lv_act TYPE decfloat34.
|
||||
lv_exp = 320.
|
||||
lv_act = premium_for( iv_lot_type = `S` iv_hammer = 2000 iv_channel = `B` ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_act ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD online_reduction.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
DATA lv_act TYPE decfloat34.
|
||||
lv_exp = 90.
|
||||
lv_act = premium_for( iv_lot_type = `S` iv_hammer = 500 iv_channel = `O` ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_act ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD premium_limits.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
DATA lv_act TYPE decfloat34.
|
||||
lv_exp = 5.
|
||||
lv_act = premium_for( iv_lot_type = `S` iv_hammer = 10 iv_channel = `B` ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_act ).
|
||||
lv_exp = 5000.
|
||||
lv_act = premium_for( iv_lot_type = `S` iv_hammer = 100000 iv_channel = `B` ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_act ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD charity_lot.
|
||||
DATA lv_skip TYPE abap_bool.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
DATA lv_exp TYPE decfloat34.
|
||||
lv_fee = 7.
|
||||
lv_exp = 7.
|
||||
CALL FUNCTION '{{P}}AUC_PREMIUM'
|
||||
EXPORTING
|
||||
iv_lot_type = `C`
|
||||
iv_hammer = 5000
|
||||
iv_channel = `B`
|
||||
IMPORTING
|
||||
ev_skip = lv_skip
|
||||
CHANGING
|
||||
cv_fee = lv_fee
|
||||
EXCEPTIONS
|
||||
invalid_hammer = 1
|
||||
OTHERS = 2.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
cl_abap_unit_assert=>assert_true( lv_skip ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD negative_hammer.
|
||||
DATA lv_fee TYPE decfloat34.
|
||||
CALL FUNCTION '{{P}}AUC_PREMIUM'
|
||||
EXPORTING
|
||||
iv_lot_type = `S`
|
||||
iv_hammer = -5
|
||||
iv_channel = `B`
|
||||
CHANGING
|
||||
cv_fee = lv_fee
|
||||
EXCEPTIONS
|
||||
invalid_hammer = 1
|
||||
OTHERS = 2.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
15
tasks_gen/train/G1006/seed/auc_sample.func.abap
Normal file
15
tasks_gen/train/G1006/seed/auc_sample.func.abap
Normal file
@@ -0,0 +1,15 @@
|
||||
FUNCTION {{p}}auc_sample
|
||||
IMPORTING
|
||||
iv_lot_type TYPE string
|
||||
iv_hammer TYPE decfloat34
|
||||
iv_channel TYPE string
|
||||
EXPORTING
|
||||
ev_skip TYPE abap_bool
|
||||
CHANGING
|
||||
cv_fee TYPE decfloat34
|
||||
EXCEPTIONS
|
||||
invalid_hammer.
|
||||
|
||||
ev_skip = abap_false.
|
||||
|
||||
ENDFUNCTION.
|
||||
47
tasks_gen/train/G1006/spec.md
Normal file
47
tasks_gen/train/G1006/spec.md
Normal file
@@ -0,0 +1,47 @@
|
||||
# 1. Goal
|
||||
An auction house charges a buyer's premium on each lot that it sells. The
|
||||
auction program calls one premium module for each sold lot. The premium module
|
||||
must use the same interface as the sample module {{P}}AUC_SAMPLE, because the
|
||||
auction program calls all premium modules in the same way.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Function group {{P}}FG_AUCT exists in package $TMP.
|
||||
- Function module {{P}}AUC_SAMPLE exists in this group. It is the sample
|
||||
premium module. Its interface is the interface that all premium modules must
|
||||
use.
|
||||
|
||||
# 4. Contract
|
||||
- Create the function module {{P}}AUC_PREMIUM in function group {{P}}FG_AUCT.
|
||||
- Use exactly the interface of {{P}}AUC_SAMPLE: the same parameter names, kinds,
|
||||
types, and exceptions.
|
||||
- The exception is INVALID_HAMMER.
|
||||
|
||||
# 5. Business rules
|
||||
1. If the hammer price is less than 0, raise the exception INVALID_HAMMER and
|
||||
stop.
|
||||
2. Set the skip flag to false, except in rule 3.
|
||||
3. Lot type C (charity): set the skip flag to true. Leave the fee unchanged and
|
||||
stop.
|
||||
4. For every other lot type, calculate the band premium from the hammer price:
|
||||
- the part of the hammer price up to 1,000.00: 20 %
|
||||
- the part of the hammer price above 1,000.00 up to 10,000.00: 12 %
|
||||
- the part of the hammer price above 10,000.00: 6 %
|
||||
5. Channel O (online): the premium is 90 % of the band premium. For every other
|
||||
channel the premium is the band premium.
|
||||
6. Round the premium of rule 5 half up to 2 decimals.
|
||||
7. The minimum premium is 5.00. The maximum premium is 5,000.00.
|
||||
8. The fee is the premium of rules 4 to 7.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 7.02. The code must run on a 7.02 system. Do not use syntax
|
||||
that was introduced after release 7.02.
|
||||
- Coding standards: Clean ABAP.
|
||||
- Out of scope: do not change {{P}}AUC_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.
|
||||
84
tasks_gen/train/G1006/task.json
Normal file
84
tasks_gen/train/G1006/task.json
Normal file
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"id": "G1006",
|
||||
"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_AUCT",
|
||||
"description": "Buyer's premium modules"
|
||||
},
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}AUC_SAMPLE",
|
||||
"functionGroup": "{{P}}FG_AUCT",
|
||||
"file": "seed/auc_sample.func.abap",
|
||||
"description": "Sample premium module"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}AUC_PREMIUM",
|
||||
"functionGroup": "{{P}}FG_AUCT",
|
||||
"params": [
|
||||
{
|
||||
"name": "iv_lot_type",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "iv_hammer",
|
||||
"type": "decfloat34"
|
||||
},
|
||||
{
|
||||
"name": "iv_channel",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "ev_skip",
|
||||
"type": "abap_bool"
|
||||
},
|
||||
{
|
||||
"name": "cv_fee",
|
||||
"type": "decfloat34"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}AUC_SAMPLE"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T14_HIDDEN",
|
||||
"file": "hidden/t14_hidden.clas.abap",
|
||||
"description": "T14 hidden tests"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}AUC_PREMIUM",
|
||||
"functionGroup": "{{P}}FG_AUCT",
|
||||
"file": "reference/auc_premium.func.abap",
|
||||
"description": "Buyer's premium module"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T14_TEST",
|
||||
"file": "reference/t14_test.clas.abap",
|
||||
"description": "T14 own tests"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"no_new_syntax"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user