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:
Kral
2026-10-05 13:35:54 +02:00
parent 1c4667a0fc
commit 13360292dd
781 changed files with 50211 additions and 22 deletions

View File

@@ -0,0 +1,48 @@
FUNCTION {{p}}ad_price
IMPORTING
iv_lines TYPE i
iv_insertions TYPE i
iv_photo TYPE abap_bool
EXPORTING
ev_price TYPE decfloat34
EXCEPTIONS
invalid_lines
invalid_insertions.
CONSTANTS lc_line_rate TYPE decfloat34 VALUE '12.45'.
CONSTANTS lc_photo_fee TYPE decfloat34 VALUE '25.00'.
CONSTANTS lc_min_price TYPE decfloat34 VALUE '20.00'.
DATA lv_price TYPE decfloat34.
DATA lv_discount TYPE decfloat34.
IF iv_lines < 1.
RAISE invalid_lines.
ENDIF.
IF iv_insertions >= 1.
RAISE invalid_insertions.
ENDIF.
lv_price = iv_lines * lc_line_rate.
IF iv_photo = abap_true.
lv_price = lv_price + lc_photo_fee.
ENDIF.
lv_discount = 0.
IF iv_insertions >= 6.
lv_discount = 20.
ELSEIF iv_insertions >= 3.
lv_discount = 10.
ENDIF.
lv_price = lv_price * ( 100 - lv_discount ) / 100.
lv_price = round( val = lv_price dec = 2 ).
IF lv_price < lc_min_price.
lv_price = lc_min_price.
ENDIF.
ev_price = lv_price.
ENDFUNCTION.

View File

@@ -0,0 +1,48 @@
FUNCTION {{p}}ad_price
IMPORTING
iv_lines TYPE i
iv_insertions TYPE i
iv_photo TYPE abap_bool
EXPORTING
ev_price TYPE decfloat34
EXCEPTIONS
invalid_lines
invalid_insertions.
CONSTANTS lc_line_rate TYPE decfloat34 VALUE '12.45'.
CONSTANTS lc_photo_fee TYPE decfloat34 VALUE '25.00'.
CONSTANTS lc_min_price TYPE decfloat34 VALUE '20.00'.
DATA lv_price TYPE decfloat34.
DATA lv_discount TYPE decfloat34.
IF iv_lines < 1.
RAISE invalid_lines.
ENDIF.
IF iv_insertions < 1.
RAISE invalid_insertions.
ENDIF.
lv_price = iv_lines / lc_line_rate.
IF iv_photo = abap_true.
lv_price = lv_price + lc_photo_fee.
ENDIF.
lv_discount = 0.
IF iv_insertions >= 6.
lv_discount = 20.
ELSEIF iv_insertions >= 3.
lv_discount = 10.
ENDIF.
lv_price = lv_price * ( 100 - lv_discount ) / 100.
lv_price = round( val = lv_price dec = 2 ).
IF lv_price < lc_min_price.
lv_price = lc_min_price.
ENDIF.
ev_price = lv_price.
ENDFUNCTION.

View File

@@ -0,0 +1,48 @@
FUNCTION {{p}}ad_price
IMPORTING
iv_lines TYPE i
iv_insertions TYPE i
iv_photo TYPE abap_bool
EXPORTING
ev_price TYPE decfloat34
EXCEPTIONS
invalid_lines
invalid_insertions.
CONSTANTS lc_line_rate TYPE decfloat34 VALUE '12.45'.
CONSTANTS lc_photo_fee TYPE decfloat34 VALUE '25.00'.
CONSTANTS lc_min_price TYPE decfloat34 VALUE '20.00'.
DATA lv_price TYPE decfloat34.
DATA lv_discount TYPE decfloat34.
IF iv_lines < 1.
RAISE invalid_lines.
ENDIF.
IF iv_insertions < 1.
RAISE invalid_insertions.
ENDIF.
lv_price = iv_lines * lc_line_rate.
IF iv_photo <> abap_true.
lv_price = lv_price + lc_photo_fee.
ENDIF.
lv_discount = 0.
IF iv_insertions >= 6.
lv_discount = 20.
ELSEIF iv_insertions >= 3.
lv_discount = 10.
ENDIF.
lv_price = lv_price * ( 100 - lv_discount ) / 100.
lv_price = round( val = lv_price dec = 2 ).
IF lv_price < lc_min_price.
lv_price = lc_min_price.
ENDIF.
ev_price = lv_price.
ENDFUNCTION.

View File

@@ -0,0 +1,48 @@
FUNCTION {{p}}ad_price
IMPORTING
iv_lines TYPE i
iv_insertions TYPE i
iv_photo TYPE abap_bool
EXPORTING
ev_price TYPE decfloat34
EXCEPTIONS
invalid_lines
invalid_insertions.
CONSTANTS lc_line_rate TYPE decfloat34 VALUE '12.45'.
CONSTANTS lc_photo_fee TYPE decfloat34 VALUE '25.00'.
CONSTANTS lc_min_price TYPE decfloat34 VALUE '20.00'.
DATA lv_price TYPE decfloat34.
DATA lv_discount TYPE decfloat34.
IF iv_lines < 1.
RAISE invalid_lines.
ENDIF.
IF iv_insertions < 1.
RAISE invalid_insertions.
ENDIF.
lv_price = iv_lines * lc_line_rate.
IF iv_photo = abap_true.
lv_price = lv_price + lc_photo_fee.
ENDIF.
lv_discount = 0.
IF iv_insertions >= 6.
lv_discount = 20.
ELSEIF iv_insertions >= 3.
lv_discount = 10.
ENDIF.
lv_price = lv_price * ( 100 + lv_discount ) / 100.
lv_price = round( val = lv_price dec = 2 ).
IF lv_price < lc_min_price.
lv_price = lc_min_price.
ENDIF.
ev_price = lv_price.
ENDFUNCTION.

View File

@@ -0,0 +1,48 @@
FUNCTION {{p}}ad_price
IMPORTING
iv_lines TYPE i
iv_insertions TYPE i
iv_photo TYPE abap_bool
EXPORTING
ev_price TYPE decfloat34
EXCEPTIONS
invalid_lines
invalid_insertions.
CONSTANTS lc_line_rate TYPE decfloat34 VALUE '12.45'.
CONSTANTS lc_photo_fee TYPE decfloat34 VALUE '25.00'.
CONSTANTS lc_min_price TYPE decfloat34 VALUE '20.00'.
DATA lv_price TYPE decfloat34.
DATA lv_discount TYPE decfloat34.
IF iv_lines < 1.
RAISE invalid_lines.
ENDIF.
IF iv_insertions < 1.
RAISE invalid_insertions.
ENDIF.
lv_price = iv_lines * lc_line_rate.
IF iv_photo = abap_true.
lv_price = lv_price + lc_photo_fee.
ENDIF.
lv_discount = 0.
IF iv_insertions >= 6.
lv_discount = 20.
ELSEIF iv_insertions >= 3.
lv_discount = 10.
ENDIF.
lv_price = lv_price * ( 100 - lv_discount ) / 100.
lv_price = round( val = lv_price dec = 3 ).
IF lv_price < lc_min_price.
lv_price = lc_min_price.
ENDIF.
ev_price = lv_price.
ENDFUNCTION.

View File

@@ -0,0 +1,52 @@
{
"id": "G1018",
"pool": "train",
"object_type": "FUNC",
"category": "G",
"attempts": [
{
"stage": "bundle",
"errors": [
"reference/ad_test.clas.abap line 40: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"assert_price\"",
"reference/ad_test.clas.abap line 40: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"90\"",
"reference/ad_test.clas.abap line 45: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"assert_price\"",
"reference/ad_test.clas.abap line 45: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"80\"",
"reference/ad_test.clas.abap line 50: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"assert_price\"",
"reference/ad_test.clas.abap line 50: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"00\"",
"hidden/ad_hidden.clas.abap line 51: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"assert_price\"",
"hidden/ad_hidden.clas.abap line 51: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"90\"",
"hidden/ad_hidden.clas.abap line 57: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"assert_price\"",
"hidden/ad_hidden.clas.abap line 57: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"90\"",
"hidden/ad_hidden.clas.abap line 63: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"assert_price\"",
"hidden/ad_hidden.clas.abap line 63: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"00\"",
"hidden/ad_hidden.clas.abap line 69: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"assert_price\"",
"hidden/ad_hidden.clas.abap line 69: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"00\"",
"hidden/ad_hidden.clas.abap line 75: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"assert_price\"",
"hidden/ad_hidden.clas.abap line 75: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"82\"",
"hidden/ad_hidden.clas.abap line 81: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"assert_price\"",
"hidden/ad_hidden.clas.abap line 81: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"84\"",
"hidden/ad_hidden.clas.abap line 87: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"assert_price\"",
"hidden/ad_hidden.clas.abap line 87: syntax error for release v740sp05 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"62\""
],
"by_check": {
"abaplint": 20
}
},
{
"stage": "validate",
"oracle": 85.0,
"null": 0
},
{
"stage": "validate",
"oracle": 100.0,
"null": 0,
"mutation": {
"valid": 5,
"killed": 5,
"ok": true
}
}
],
"accepted": true
}

View File

@@ -0,0 +1,125 @@
CLASS {{p}}ad_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
CONSTANTS lc_price_2490 TYPE decfloat34 VALUE '24.90'.
CONSTANTS lc_price_4990 TYPE decfloat34 VALUE '49.90'.
CONSTANTS lc_price_2000 TYPE decfloat34 VALUE '20.00'.
CONSTANTS lc_price_4482 TYPE decfloat34 VALUE '44.82'.
CONSTANTS lc_price_3984 TYPE decfloat34 VALUE '39.84'.
CONSTANTS lc_price_3362 TYPE decfloat34 VALUE '33.62'.
CONSTANTS lc_price_6980 TYPE decfloat34 VALUE '69.80'.
METHODS call
IMPORTING iv_lines TYPE i
iv_insertions TYPE i
iv_photo TYPE abap_bool DEFAULT abap_false
EXPORTING ev_price TYPE decfloat34
ev_subrc TYPE sysubrc.
METHODS assert_price
IMPORTING iv_expected TYPE decfloat34
iv_actual TYPE decfloat34.
METHODS two_lines_one_run FOR TESTING.
METHODS photo_surcharge FOR TESTING.
METHODS minimum_charge FOR TESTING.
METHODS minimum_after_disc FOR TESTING.
METHODS discount_ten_percent FOR TESTING.
METHODS discount_twenty_pct FOR TESTING.
METHODS rounding_half_up FOR TESTING.
METHODS photo_with_discount FOR TESTING.
METHODS rejects_zero_lines FOR TESTING.
METHODS rejects_zero_runs FOR TESTING.
ENDCLASS.
CLASS {{p}}ad_hidden IMPLEMENTATION.
METHOD call.
ev_price = 0.
CALL FUNCTION '{{P}}AD_PRICE'
EXPORTING
iv_lines = iv_lines
iv_insertions = iv_insertions
iv_photo = iv_photo
IMPORTING
ev_price = ev_price
EXCEPTIONS
invalid_lines = 1
invalid_insertions = 2
OTHERS = 3.
ev_subrc = sy-subrc.
ENDMETHOD.
METHOD assert_price.
cl_abap_unit_assert=>assert_equals( exp = iv_expected act = iv_actual ).
ENDMETHOD.
METHOD two_lines_one_run.
DATA lv_price TYPE decfloat34.
DATA lv_rc TYPE sysubrc.
call( EXPORTING iv_lines = 2 iv_insertions = 1
IMPORTING ev_price = lv_price ev_subrc = lv_rc ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
assert_price( iv_expected = lc_price_2490 iv_actual = lv_price ).
ENDMETHOD.
METHOD photo_surcharge.
DATA lv_price TYPE decfloat34.
call( EXPORTING iv_lines = 2 iv_insertions = 1 iv_photo = abap_true
IMPORTING ev_price = lv_price ).
assert_price( iv_expected = lc_price_4990 iv_actual = lv_price ).
ENDMETHOD.
METHOD minimum_charge.
DATA lv_price TYPE decfloat34.
call( EXPORTING iv_lines = 1 iv_insertions = 1
IMPORTING ev_price = lv_price ).
assert_price( iv_expected = lc_price_2000 iv_actual = lv_price ).
ENDMETHOD.
METHOD minimum_after_disc.
DATA lv_price TYPE decfloat34.
call( EXPORTING iv_lines = 2 iv_insertions = 6
IMPORTING ev_price = lv_price ).
assert_price( iv_expected = lc_price_2000 iv_actual = lv_price ).
ENDMETHOD.
METHOD discount_ten_percent.
DATA lv_price TYPE decfloat34.
call( EXPORTING iv_lines = 4 iv_insertions = 3
IMPORTING ev_price = lv_price ).
assert_price( iv_expected = lc_price_4482 iv_actual = lv_price ).
ENDMETHOD.
METHOD discount_twenty_pct.
DATA lv_price TYPE decfloat34.
call( EXPORTING iv_lines = 4 iv_insertions = 6
IMPORTING ev_price = lv_price ).
assert_price( iv_expected = lc_price_3984 iv_actual = lv_price ).
ENDMETHOD.
METHOD rounding_half_up.
DATA lv_price TYPE decfloat34.
call( EXPORTING iv_lines = 3 iv_insertions = 3
IMPORTING ev_price = lv_price ).
assert_price( iv_expected = lc_price_3362 iv_actual = lv_price ).
ENDMETHOD.
METHOD photo_with_discount.
DATA lv_price TYPE decfloat34.
call( EXPORTING iv_lines = 5 iv_insertions = 6 iv_photo = abap_true
IMPORTING ev_price = lv_price ).
assert_price( iv_expected = lc_price_6980 iv_actual = lv_price ).
ENDMETHOD.
METHOD rejects_zero_lines.
DATA lv_rc TYPE sysubrc.
call( EXPORTING iv_lines = 0 iv_insertions = 1
IMPORTING ev_subrc = lv_rc ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
ENDMETHOD.
METHOD rejects_zero_runs.
DATA lv_rc TYPE sysubrc.
call( EXPORTING iv_lines = 2 iv_insertions = 0
IMPORTING ev_subrc = lv_rc ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_rc ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,78 @@
{
"task": "G1018",
"mutants": [
{
"object": "{{P}}AD_PRICE",
"mutant": "line 23: < -> >= (rel)",
"status": "killed",
"hidden": "1/10",
"failed_tests": [
"DISCOUNT_TEN_PERCENT",
"DISCOUNT_TWENTY_PCT",
"MINIMUM_AFTER_DISC",
"MINIMUM_CHARGE",
"PHOTO_SURCHARGE",
"PHOTO_WITH_DISCOUNT",
"REJECTS_ZERO_RUNS",
"ROUNDING_HALF_UP",
"TWO_LINES_ONE_RUN"
]
},
{
"object": "{{P}}AD_PRICE",
"mutant": "line 27: * -> / (arith)",
"status": "killed",
"hidden": "4/10",
"failed_tests": [
"DISCOUNT_TEN_PERCENT",
"DISCOUNT_TWENTY_PCT",
"PHOTO_SURCHARGE",
"PHOTO_WITH_DISCOUNT",
"ROUNDING_HALF_UP",
"TWO_LINES_ONE_RUN"
]
},
{
"object": "{{P}}AD_PRICE",
"mutant": "line 28: = -> <> (eq)",
"status": "killed",
"hidden": "2/10",
"failed_tests": [
"DISCOUNT_TEN_PERCENT",
"DISCOUNT_TWENTY_PCT",
"MINIMUM_AFTER_DISC",
"MINIMUM_CHARGE",
"PHOTO_SURCHARGE",
"PHOTO_WITH_DISCOUNT",
"ROUNDING_HALF_UP",
"TWO_LINES_ONE_RUN"
]
},
{
"object": "{{P}}AD_PRICE",
"mutant": "line 39: - -> + (arith)",
"status": "killed",
"hidden": "5/10",
"failed_tests": [
"DISCOUNT_TEN_PERCENT",
"DISCOUNT_TWENTY_PCT",
"MINIMUM_AFTER_DISC",
"PHOTO_WITH_DISCOUNT",
"ROUNDING_HALF_UP"
]
},
{
"object": "{{P}}AD_PRICE",
"mutant": "line 40: 2 -> 3 (const)",
"status": "killed",
"hidden": "9/10",
"failed_tests": [
"ROUNDING_HALF_UP"
]
}
],
"valid": 5,
"killed": 5,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,48 @@
FUNCTION {{p}}ad_price
IMPORTING
iv_lines TYPE i
iv_insertions TYPE i
iv_photo TYPE abap_bool
EXPORTING
ev_price TYPE decfloat34
EXCEPTIONS
invalid_lines
invalid_insertions.
CONSTANTS lc_line_rate TYPE decfloat34 VALUE '12.45'.
CONSTANTS lc_photo_fee TYPE decfloat34 VALUE '25.00'.
CONSTANTS lc_min_price TYPE decfloat34 VALUE '20.00'.
DATA lv_price TYPE decfloat34.
DATA lv_discount TYPE decfloat34.
IF iv_lines < 1.
RAISE invalid_lines.
ENDIF.
IF iv_insertions < 1.
RAISE invalid_insertions.
ENDIF.
lv_price = iv_lines * lc_line_rate.
IF iv_photo = abap_true.
lv_price = lv_price + lc_photo_fee.
ENDIF.
lv_discount = 0.
IF iv_insertions >= 6.
lv_discount = 20.
ELSEIF iv_insertions >= 3.
lv_discount = 10.
ENDIF.
lv_price = lv_price * ( 100 - lv_discount ) / 100.
lv_price = round( val = lv_price dec = 2 ).
IF lv_price < lc_min_price.
lv_price = lc_min_price.
ENDIF.
ev_price = lv_price.
ENDFUNCTION.

View File

@@ -0,0 +1,92 @@
CLASS {{p}}ad_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
CONSTANTS lc_price_2490 TYPE decfloat34 VALUE '24.90'.
CONSTANTS lc_price_4980 TYPE decfloat34 VALUE '49.80'.
CONSTANTS lc_price_4482 TYPE decfloat34 VALUE '44.82'.
CONSTANTS lc_price_6980 TYPE decfloat34 VALUE '69.80'.
CONSTANTS lc_price_2000 TYPE decfloat34 VALUE '20.00'.
METHODS call
IMPORTING iv_lines TYPE i
iv_insertions TYPE i
iv_photo TYPE abap_bool DEFAULT abap_false
EXPORTING ev_price TYPE decfloat34
ev_subrc TYPE sysubrc.
METHODS assert_price
IMPORTING iv_expected TYPE decfloat34
iv_actual TYPE decfloat34.
METHODS line_price FOR TESTING.
METHODS no_discount_short FOR TESTING.
METHODS discount_ten_pct FOR TESTING.
METHODS photo_and_discount FOR TESTING.
METHODS minimum_price FOR TESTING.
METHODS invalid_input FOR TESTING.
ENDCLASS.
CLASS {{p}}ad_test IMPLEMENTATION.
METHOD call.
ev_price = 0.
CALL FUNCTION '{{P}}AD_PRICE'
EXPORTING
iv_lines = iv_lines
iv_insertions = iv_insertions
iv_photo = iv_photo
IMPORTING
ev_price = ev_price
EXCEPTIONS
invalid_lines = 1
invalid_insertions = 2
OTHERS = 3.
ev_subrc = sy-subrc.
ENDMETHOD.
METHOD assert_price.
cl_abap_unit_assert=>assert_equals( exp = iv_expected act = iv_actual ).
ENDMETHOD.
METHOD line_price.
DATA lv_price TYPE decfloat34.
DATA lv_rc TYPE sysubrc.
call( EXPORTING iv_lines = 2 iv_insertions = 1
IMPORTING ev_price = lv_price ev_subrc = lv_rc ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
assert_price( iv_expected = lc_price_2490 iv_actual = lv_price ).
ENDMETHOD.
METHOD no_discount_short.
DATA lv_price TYPE decfloat34.
call( EXPORTING iv_lines = 4 iv_insertions = 2
IMPORTING ev_price = lv_price ).
assert_price( iv_expected = lc_price_4980 iv_actual = lv_price ).
ENDMETHOD.
METHOD discount_ten_pct.
DATA lv_price TYPE decfloat34.
call( EXPORTING iv_lines = 4 iv_insertions = 3
IMPORTING ev_price = lv_price ).
assert_price( iv_expected = lc_price_4482 iv_actual = lv_price ).
ENDMETHOD.
METHOD photo_and_discount.
DATA lv_price TYPE decfloat34.
call( EXPORTING iv_lines = 5 iv_insertions = 6 iv_photo = abap_true
IMPORTING ev_price = lv_price ).
assert_price( iv_expected = lc_price_6980 iv_actual = lv_price ).
ENDMETHOD.
METHOD minimum_price.
DATA lv_price TYPE decfloat34.
call( EXPORTING iv_lines = 1 iv_insertions = 1
IMPORTING ev_price = lv_price ).
assert_price( iv_expected = lc_price_2000 iv_actual = lv_price ).
ENDMETHOD.
METHOD invalid_input.
DATA lv_price TYPE decfloat34.
DATA lv_rc TYPE sysubrc.
call( EXPORTING iv_lines = 0 iv_insertions = 1
IMPORTING ev_price = lv_price ev_subrc = lv_rc ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,47 @@
# 1. Goal
Calculate the price of a classified advertisement for a newspaper. The sales
desk calls one function module for each advertisement order, before it saves
the order.
# 2. Open questions
None.
# 3. Context
- Function group {{P}}FG_AD exists in package $TMP.
- The sales desk calls the new function module for each advertisement order.
# 4. Contract
- Create the function module {{P}}AD_PRICE in function group {{P}}FG_AD.
- The interface of {{P}}AD_PRICE is:
- importing iv_lines type i: the number of lines of the advertisement.
- importing iv_insertions type i: the number of times that the advertisement
is printed.
- importing iv_photo type abap_bool: abap_true if the advertisement has a
photo.
- exporting ev_price type decfloat34: the price of the advertisement in euro.
- exceptions invalid_lines and invalid_insertions.
# 5. Business rules
1. If iv_lines is less than 1, raise the exception INVALID_LINES.
2. If iv_insertions is less than 1, raise the exception INVALID_INSERTIONS.
3. One line of the advertisement costs 12.45 euro.
4. A photo costs 25.00 euro. Charge the photo once for each order.
5. The discount applies to the sum of the line price and the photo price:
- 1 or 2 insertions: no discount.
- 3, 4 or 5 insertions: 10 % discount.
- 6 or more insertions: 20 % discount.
6. Round the price half up to 2 decimals.
7. The minimum price is 20.00 euro. Apply the minimum price after the discount
and after the rounding.
# 6. Constraints
- Release target: 7.40 SP05. Use only ABAP syntax that release 7.40 SP05
supports. Do not use inline declarations or constructor expressions.
- Coding standards: Clean ABAP. Keep every method below 40 statements.
- Out of scope: database tables, reports, ALV lists, and other function
modules.
# 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.

View File

@@ -0,0 +1,76 @@
{
"id": "G1018",
"category": "G",
"object_type": "FUNC",
"difficulty": 2,
"release_target": "v740sp05",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 60,
"max_activations": 15
},
"seed": [
{
"type": "FUGR",
"name": "{{P}}FG_AD",
"description": "Function group for advertisement pricing"
}
],
"contract": [
{
"type": "FUNC",
"name": "{{P}}AD_PRICE",
"functionGroup": "{{P}}FG_AD",
"params": [
{
"name": "iv_lines",
"type": "i"
},
{
"name": "iv_insertions",
"type": "i"
},
{
"name": "iv_photo",
"type": "abap_bool"
},
{
"name": "ev_price",
"type": "decfloat34"
}
]
}
],
"out_of_scope": [
"database tables",
"reports",
"ALV lists",
"other function modules"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}AD_HIDDEN",
"file": "hidden/ad_hidden.clas.abap",
"description": "T14 hidden tests"
}
],
"reference": [
{
"type": "FUNC",
"name": "{{P}}AD_PRICE",
"functionGroup": "{{P}}FG_AD",
"file": "reference/ad_price.func.abap",
"description": "Advertisement price function module"
},
{
"type": "CLAS",
"name": "{{P}}AD_TEST",
"file": "reference/ad_test.clas.abap",
"description": "T14 own tests"
}
],
"craft_checks": [
"method_length"
]
}