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,16 @@
{
"id": "G1305",
"pool": "train",
"category": "K",
"base_task": "G1018",
"style": "incomplete",
"tool_schema": null,
"attempts": [
{
"stage": "validate",
"oracle": 100.0,
"null": 0
}
],
"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,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 @@
Create function module {{P}}AD_PRICE in function group {{P}}FG_AD. The sales desk calls it for each advertisement order before saving. The function module calculates the price of a classified advertisement for a newspaper. The interface is: importing iv_lines type i for the number of lines; importing iv_insertions type i for the number of insertions; importing iv_photo type abap_bool, which is abap_true if the advertisement has a photo; exporting ev_price type decfloat34 for the price in euro; exceptions invalid_lines and invalid_insertions. If iv_lines is less than 1, raise invalid_lines. If iv_insertions is less than 1, raise invalid_insertions. One line costs 12.45 euro. A photo costs 25.00 euro once for each order. The discount applies to the sum of the line price and the photo price. For 1 or 2 insertions, there is no discount. For 3, 4, or 5 insertions, the discount is 10%. For 6 or more insertions, the discount is 20%. Round the price half up to 2 decimals. The minimum price is 20.00 euro. Apply the minimum price after the discount and after the rounding. Use only ABAP syntax that release 7.40 SP05 supports. Do not use inline declarations or constructor expressions. Follow Clean ABAP. Keep each method below 40 statements. Out of scope: database tables, reports, ALV lists, and other function modules. The function module must be active and have no syntax error. The hidden tests must pass. Write ABAP Unit tests for the function module in a global test class.

View File

@@ -0,0 +1,78 @@
{
"id": "G1305",
"category": "K",
"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"
],
"base_task": "G1018",
"input_style": "incomplete"
}