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:
23
tasks_gen/train/G1019/generation.json
Normal file
23
tasks_gen/train/G1019/generation.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"id": "G1019",
|
||||
"pool": "train",
|
||||
"object_type": "CLAS",
|
||||
"category": "H",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"reference/bowling_fee.clas.abap line 17: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"METHODS\""
|
||||
],
|
||||
"by_check": {
|
||||
"abaplint": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100,
|
||||
"null": 30
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
60
tasks_gen/train/G1019/reference/bowling_fee.clas.abap
Normal file
60
tasks_gen/train/G1019/reference/bowling_fee.clas.abap
Normal file
@@ -0,0 +1,60 @@
|
||||
CLASS {{p}}bowling_fee DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_bowling_fee.
|
||||
|
||||
PRIVATE SECTION.
|
||||
TYPES ty_rate TYPE p LENGTH 5 DECIMALS 2.
|
||||
|
||||
CONSTANTS:
|
||||
c_lane_fee TYPE {{p}}if_bowling_fee=>ty_fee VALUE '12.00',
|
||||
c_shoe_fee TYPE {{p}}if_bowling_fee=>ty_fee VALUE '2.50',
|
||||
c_group_dis TYPE ty_rate VALUE '0.10',
|
||||
c_large_dis TYPE ty_rate VALUE '0.20'.
|
||||
|
||||
METHODS lane_fee
|
||||
IMPORTING iv_lanes TYPE i
|
||||
iv_hours TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE {{p}}if_bowling_fee=>ty_fee.
|
||||
|
||||
METHODS discount_rate
|
||||
IMPORTING iv_lanes TYPE i
|
||||
iv_hours TYPE i
|
||||
RETURNING VALUE(rv_rate) TYPE ty_rate.
|
||||
|
||||
METHODS shoe_rental
|
||||
IMPORTING iv_shoes TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE {{p}}if_bowling_fee=>ty_fee.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}bowling_fee IMPLEMENTATION.
|
||||
METHOD {{p}}if_bowling_fee~calculate_fee.
|
||||
DATA(lv_lane_fee) = lane_fee( iv_lanes = iv_lanes iv_hours = iv_hours ).
|
||||
lv_lane_fee = lv_lane_fee * ( 1 - discount_rate( iv_lanes = iv_lanes iv_hours = iv_hours ) ).
|
||||
rv_fee = lv_lane_fee + shoe_rental( iv_shoes ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lane_fee.
|
||||
IF iv_lanes <= 0 OR iv_hours <= 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rv_fee = c_lane_fee * iv_lanes * iv_hours.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount_rate.
|
||||
IF iv_lanes > 4 AND iv_hours > 3.
|
||||
rv_rate = c_large_dis.
|
||||
ELSEIF iv_lanes > 4.
|
||||
rv_rate = c_group_dis.
|
||||
ELSEIF iv_hours > 3.
|
||||
rv_rate = c_large_dis.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shoe_rental.
|
||||
IF iv_shoes <= 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
rv_fee = c_shoe_fee * iv_shoes.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
72
tasks_gen/train/G1019/reference/bowling_fee.testclasses.abap
Normal file
72
tasks_gen/train/G1019/reference/bowling_fee.testclasses.abap
Normal file
@@ -0,0 +1,72 @@
|
||||
CLASS ltc_bowling_fee DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_48_00 TYPE {{p}}if_bowling_fee=>ty_fee VALUE '48.00',
|
||||
c_129_60 TYPE {{p}}if_bowling_fee=>ty_fee VALUE '129.60',
|
||||
c_96_00 TYPE {{p}}if_bowling_fee=>ty_fee VALUE '96.00',
|
||||
c_288_00 TYPE {{p}}if_bowling_fee=>ty_fee VALUE '288.00',
|
||||
c_55_50 TYPE {{p}}if_bowling_fee=>ty_fee VALUE '55.50',
|
||||
c_134_60 TYPE {{p}}if_bowling_fee=>ty_fee VALUE '134.60',
|
||||
c_0_00 TYPE {{p}}if_bowling_fee=>ty_fee VALUE '0.00'.
|
||||
|
||||
DATA mo_cut TYPE REF TO {{p}}if_bowling_fee.
|
||||
|
||||
METHODS setup.
|
||||
METHODS lane_fee_only FOR TESTING.
|
||||
METHODS group_discount FOR TESTING.
|
||||
METHODS large_discount FOR TESTING.
|
||||
METHODS group_and_large FOR TESTING.
|
||||
METHODS shoes_are_added FOR TESTING.
|
||||
METHODS shoes_never_discounted FOR TESTING.
|
||||
METHODS zero_lanes FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_bowling_fee IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}bowling_fee( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lane_fee_only.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_48_00
|
||||
act = mo_cut->calculate_fee( iv_lanes = 2 iv_hours = 2 iv_shoes = 0 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD group_discount.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_129_60
|
||||
act = mo_cut->calculate_fee( iv_lanes = 6 iv_hours = 2 iv_shoes = 0 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD large_discount.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_96_00
|
||||
act = mo_cut->calculate_fee( iv_lanes = 2 iv_hours = 5 iv_shoes = 0 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD group_and_large.
|
||||
" The large discount replaces the group discount.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_288_00
|
||||
act = mo_cut->calculate_fee( iv_lanes = 6 iv_hours = 5 iv_shoes = 0 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shoes_are_added.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_55_50
|
||||
act = mo_cut->calculate_fee( iv_lanes = 2 iv_hours = 2 iv_shoes = 3 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD shoes_never_discounted.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_134_60
|
||||
act = mo_cut->calculate_fee( iv_lanes = 6 iv_hours = 2 iv_shoes = 2 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD zero_lanes.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_0_00
|
||||
act = mo_cut->calculate_fee( iv_lanes = 0 iv_hours = 2 iv_shoes = 0 ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
8
tasks_gen/train/G1019/seed/if_bowling_fee.intf.abap
Normal file
8
tasks_gen/train/G1019/seed/if_bowling_fee.intf.abap
Normal file
@@ -0,0 +1,8 @@
|
||||
INTERFACE {{p}}if_bowling_fee PUBLIC.
|
||||
TYPES ty_fee TYPE p LENGTH 8 DECIMALS 2.
|
||||
METHODS calculate_fee
|
||||
IMPORTING iv_lanes TYPE i
|
||||
iv_hours TYPE i
|
||||
iv_shoes TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_fee.
|
||||
ENDINTERFACE.
|
||||
45
tasks_gen/train/G1019/spec.md
Normal file
45
tasks_gen/train/G1019/spec.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# 1. Goal
|
||||
Calculate the fee of a bowling lane booking. A checkout program calls the
|
||||
calculation before it takes the payment. The program needs one fee for each
|
||||
booking.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The interface {{P}}IF_BOWLING_FEE exists in package $TMP. It is active.
|
||||
- The interface has the type TY_FEE (P LENGTH 8 DECIMALS 2) and one method:
|
||||
CALCULATE_FEE IMPORTING iv_lanes TYPE i, iv_hours TYPE i, iv_shoes TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_fee.
|
||||
- The checkout program gives the number of lanes, the number of hours, and the
|
||||
number of pairs of shoes of the booking.
|
||||
|
||||
# 4. Contract
|
||||
- Create the class {{P}}BOWLING_FEE in package $TMP.
|
||||
- The class is public, final, and has a public constructor without parameters.
|
||||
- The class implements {{P}}IF_BOWLING_FEE.
|
||||
- Do not add other public methods.
|
||||
|
||||
# 5. Business rules
|
||||
1. The lane fee is 12.00 EUR for each lane and each hour.
|
||||
2. The shoe rental is 2.50 EUR for each pair of shoes.
|
||||
3. A booking of more than 4 lanes is a group booking.
|
||||
4. A booking of more than 3 hours is a large booking.
|
||||
5. A group booking gets a discount of 10 % on the lane fee.
|
||||
6. A large booking gets a discount of 20 % on the lane fee.
|
||||
7. A booking gets exactly one discount.
|
||||
8. The shoe rental is never discounted.
|
||||
9. If the number of lanes is zero or less, or if the number of hours is zero or
|
||||
less, the lane fee is zero.
|
||||
10. If the number of pairs of shoes is zero or less, the shoe rental is zero.
|
||||
11. The fee is the lane fee after the discount plus the shoe rental.
|
||||
|
||||
# 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_BOWLING_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/G1019/task.json
Normal file
61
tasks_gen/train/G1019/task.json
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"id": "G1019",
|
||||
"category": "H",
|
||||
"object_type": "CLAS",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "stop",
|
||||
"expected_gap": {
|
||||
"description": "Rules 3 to 7 do not say which discount a booking gets when it is both a group booking and a large booking, although rule 7 says that a booking gets exactly one discount.",
|
||||
"keywords": [
|
||||
[
|
||||
"group",
|
||||
"large"
|
||||
],
|
||||
[
|
||||
"discount",
|
||||
"which"
|
||||
],
|
||||
[
|
||||
"booking",
|
||||
"discount"
|
||||
]
|
||||
]
|
||||
},
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "INTF",
|
||||
"name": "{{P}}IF_BOWLING_FEE",
|
||||
"file": "seed/if_bowling_fee.intf.abap",
|
||||
"description": "Bowling fee contract"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}BOWLING_FEE",
|
||||
"implements": "{{P}}IF_BOWLING_FEE"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}IF_BOWLING_FEE"
|
||||
],
|
||||
"hidden_tests": [],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}BOWLING_FEE",
|
||||
"file": "reference/bowling_fee.clas.abap",
|
||||
"description": "Bowling fee calculation; the intended reading is that the large discount replaces the group discount",
|
||||
"testclasses_file": "reference/bowling_fee.testclasses.abap"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"db_operation_in_loop"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user