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:
30
tasks_gen/train/G1027/generation.json
Normal file
30
tasks_gen/train/G1027/generation.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"id": "G1027",
|
||||
"pool": "train",
|
||||
"object_type": "CLAS",
|
||||
"category": "H",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"reference/scaffold_fee.testclasses.abap line 19: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"reference/scaffold_fee.testclasses.abap line 19: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"20\"",
|
||||
"reference/scaffold_fee.testclasses.abap line 25: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"reference/scaffold_fee.testclasses.abap line 25: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"41\"",
|
||||
"reference/scaffold_fee.testclasses.abap line 30: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"reference/scaffold_fee.testclasses.abap line 30: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"06\"",
|
||||
"reference/scaffold_fee.testclasses.abap line 31: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"reference/scaffold_fee.testclasses.abap line 31: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"94\""
|
||||
],
|
||||
"by_check": {
|
||||
"abaplint": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100,
|
||||
"null": 30
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
54
tasks_gen/train/G1027/reference/scaffold_fee.clas.abap
Normal file
54
tasks_gen/train/G1027/reference/scaffold_fee.clas.abap
Normal file
@@ -0,0 +1,54 @@
|
||||
CLASS {{p}}scaffold_fee DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_hire_fee.
|
||||
|
||||
PRIVATE SECTION.
|
||||
TYPES ty_exact TYPE p LENGTH 15 DECIMALS 5.
|
||||
|
||||
CONSTANTS:
|
||||
c_daily_rate TYPE {{p}}if_hire_fee=>ty_amount VALUE '4.20',
|
||||
c_express_percent TYPE i VALUE 12,
|
||||
c_discount_percent TYPE i VALUE 6,
|
||||
c_long_hire_days TYPE i VALUE 30.
|
||||
|
||||
METHODS base_fee
|
||||
IMPORTING iv_days TYPE i
|
||||
iv_parts TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE {{p}}if_hire_fee=>ty_amount.
|
||||
METHODS express_surcharge
|
||||
IMPORTING iv_base TYPE {{p}}if_hire_fee=>ty_amount
|
||||
RETURNING VALUE(rv_surcharge) TYPE {{p}}if_hire_fee=>ty_amount.
|
||||
METHODS long_hire_discount
|
||||
IMPORTING iv_base TYPE {{p}}if_hire_fee=>ty_amount
|
||||
RETURNING VALUE(rv_discount) TYPE {{p}}if_hire_fee=>ty_amount.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}scaffold_fee IMPLEMENTATION.
|
||||
METHOD {{p}}if_hire_fee~calculate_fee.
|
||||
DATA(lv_base) = base_fee( iv_days = iv_days iv_parts = iv_parts ).
|
||||
DATA(lv_fee) = lv_base.
|
||||
IF iv_express = abap_true.
|
||||
lv_fee = lv_fee + express_surcharge( lv_base ).
|
||||
ENDIF.
|
||||
IF iv_days > c_long_hire_days.
|
||||
rs_result-discount = long_hire_discount( lv_base ).
|
||||
lv_fee = lv_fee - rs_result-discount.
|
||||
ENDIF.
|
||||
rs_result-fee = lv_fee.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD base_fee.
|
||||
rv_fee = iv_days * iv_parts * c_daily_rate.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD express_surcharge.
|
||||
DATA(lv_amount) = CONV ty_exact( iv_base ) * c_express_percent / 100.
|
||||
rv_surcharge = round( val = lv_amount dec = 2 mode = 'CEILING' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD long_hire_discount.
|
||||
DATA(lv_amount) = CONV ty_exact( iv_base ) * c_discount_percent / 100.
|
||||
rv_discount = round( val = lv_amount dec = 2 mode = 'HALF_UP' ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -0,0 +1,52 @@
|
||||
CLASS ltc_scaffold_fee DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}scaffold_fee.
|
||||
METHODS setup.
|
||||
METHODS base_fee_only FOR TESTING.
|
||||
METHODS express_surcharge_rounds_up FOR TESTING.
|
||||
METHODS discount_on_long_hire FOR TESTING.
|
||||
METHODS no_discount_on_short_hire FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_scaffold_fee IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}scaffold_fee( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD base_fee_only.
|
||||
DATA lv_exp TYPE {{p}}if_hire_fee=>ty_amount.
|
||||
DATA(ls_result) = mo_cut->{{p}}if_hire_fee~calculate_fee(
|
||||
iv_days = 3 iv_parts = 2 iv_express = abap_false ).
|
||||
lv_exp = '25.20'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = ls_result-fee ).
|
||||
lv_exp = '0.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = ls_result-discount ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD express_surcharge_rounds_up.
|
||||
DATA lv_exp TYPE {{p}}if_hire_fee=>ty_amount.
|
||||
DATA(ls_result) = mo_cut->{{p}}if_hire_fee~calculate_fee(
|
||||
iv_days = 2 iv_parts = 1 iv_express = abap_true ).
|
||||
lv_exp = '9.41'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = ls_result-fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount_on_long_hire.
|
||||
DATA lv_exp TYPE {{p}}if_hire_fee=>ty_amount.
|
||||
DATA(ls_result) = mo_cut->{{p}}if_hire_fee~calculate_fee(
|
||||
iv_days = 31 iv_parts = 5 iv_express = abap_false ).
|
||||
lv_exp = '39.06'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = ls_result-discount ).
|
||||
lv_exp = '611.94'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = ls_result-fee ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD no_discount_on_short_hire.
|
||||
DATA lv_exp TYPE {{p}}if_hire_fee=>ty_amount.
|
||||
DATA(ls_result) = mo_cut->{{p}}if_hire_fee~calculate_fee(
|
||||
iv_days = 30 iv_parts = 1 iv_express = abap_false ).
|
||||
lv_exp = '0.00'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = ls_result-discount ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
13
tasks_gen/train/G1027/seed/if_hire_fee.intf.abap
Normal file
13
tasks_gen/train/G1027/seed/if_hire_fee.intf.abap
Normal file
@@ -0,0 +1,13 @@
|
||||
INTERFACE {{p}}if_hire_fee PUBLIC.
|
||||
TYPES ty_amount TYPE p LENGTH 8 DECIMALS 2.
|
||||
TYPES:
|
||||
BEGIN OF ty_result,
|
||||
fee TYPE ty_amount,
|
||||
discount TYPE ty_amount,
|
||||
END OF ty_result.
|
||||
METHODS calculate_fee
|
||||
IMPORTING iv_days TYPE i
|
||||
iv_parts TYPE i
|
||||
iv_express TYPE abap_bool
|
||||
RETURNING VALUE(rs_result) TYPE ty_result.
|
||||
ENDINTERFACE.
|
||||
51
tasks_gen/train/G1027/spec.md
Normal file
51
tasks_gen/train/G1027/spec.md
Normal file
@@ -0,0 +1,51 @@
|
||||
# 1. Goal
|
||||
A scaffolding company hires out scaffold parts to building sites. A quotation
|
||||
program calls the fee calculation for each hire order before it prints the
|
||||
quotation. The program needs the final fee and the long-hire discount of the
|
||||
hire order.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The interface {{P}}IF_HIRE_FEE exists in package $TMP. It is active.
|
||||
- The interface has the type TY_AMOUNT (packed, length 8, 2 decimals) and the
|
||||
structure type TY_RESULT with the components FEE and DISCOUNT. Both
|
||||
components have the type TY_AMOUNT.
|
||||
- The interface has one method:
|
||||
CALCULATE_FEE
|
||||
IMPORTING iv_days TYPE i
|
||||
iv_parts TYPE i
|
||||
iv_express TYPE abap_bool
|
||||
RETURNING VALUE(rs_result) TYPE ty_result.
|
||||
|
||||
# 4. Contract
|
||||
- Create the class {{P}}SCAFFOLD_FEE in package $TMP.
|
||||
- The class is public, final, and has a public constructor without parameters.
|
||||
- The class implements {{P}}IF_HIRE_FEE.
|
||||
- Do not add other public methods.
|
||||
|
||||
# 5. Business rules
|
||||
1. The daily rate of one scaffold part is 4.20 EUR.
|
||||
2. The base fee is IV_DAYS multiplied by IV_PARTS multiplied by the daily rate.
|
||||
3. If IV_EXPRESS is true, the express surcharge is 12 percent of the base fee.
|
||||
Round the express surcharge up to the next full cent.
|
||||
4. If IV_DAYS is greater than 30, the long-hire discount is 6 percent of the
|
||||
base fee.
|
||||
5. The final fee is the base fee plus the express surcharge minus the long-hire
|
||||
discount.
|
||||
6. The result contains the final fee in the component FEE and the long-hire
|
||||
discount in the component DISCOUNT.
|
||||
7. The final fee and the discount are amounts in EUR. Each amount is exact to
|
||||
the cent.
|
||||
8. If IV_DAYS is not greater than 30, the discount is zero.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16.
|
||||
- Coding standards: Clean ABAP. Method length below 40 statements. No global
|
||||
variables. No comment that restates the code.
|
||||
- Out of scope: do not change {{P}}IF_HIRE_FEE.
|
||||
|
||||
# 7. Acceptance
|
||||
- The class is active and has no syntax error.
|
||||
- Write your own ABAP Unit tests for the class.
|
||||
61
tasks_gen/train/G1027/task.json
Normal file
61
tasks_gen/train/G1027/task.json
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"id": "G1027",
|
||||
"category": "H",
|
||||
"object_type": "CLAS",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "stop",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "INTF",
|
||||
"name": "{{P}}IF_HIRE_FEE",
|
||||
"file": "seed/if_hire_fee.intf.abap",
|
||||
"description": "Hire fee contract with the result structure"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}SCAFFOLD_FEE",
|
||||
"implements": "{{P}}IF_HIRE_FEE"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}IF_HIRE_FEE"
|
||||
],
|
||||
"hidden_tests": [],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}SCAFFOLD_FEE",
|
||||
"file": "reference/scaffold_fee.clas.abap",
|
||||
"description": "Scaffold hire fee calculation",
|
||||
"testclasses_file": "reference/scaffold_fee.testclasses.abap"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"db_operation_in_loop"
|
||||
],
|
||||
"expected_gap": {
|
||||
"description": "The business rules do not say how to round the long-hire discount to full cents, so the returned discount and the final fee cannot be computed.",
|
||||
"keywords": [
|
||||
[
|
||||
"discount",
|
||||
"round"
|
||||
],
|
||||
[
|
||||
"discount",
|
||||
"cent"
|
||||
],
|
||||
[
|
||||
"round",
|
||||
"rule"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user