Step F first pass: 81/92 accepted; budget floor 60 calls; rejected slots moved for regeneration
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
14
tasks_gen/eval/G0170/generation.json
Normal file
14
tasks_gen/eval/G0170/generation.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"id": "G0170",
|
||||
"pool": "eval",
|
||||
"object_type": "CLAS",
|
||||
"category": "H",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100,
|
||||
"null": 30
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
68
tasks_gen/eval/G0170/reference/studio_pricer.clas.abap
Normal file
68
tasks_gen/eval/G0170/reference/studio_pricer.clas.abap
Normal file
@@ -0,0 +1,68 @@
|
||||
CLASS {{p}}studio_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_studio_pricer.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_discount_per_booking TYPE p LENGTH 5 DECIMALS 2 VALUE '0.75',
|
||||
c_max_discount TYPE p LENGTH 5 DECIMALS 2 VALUE '15.00'.
|
||||
|
||||
METHODS hourly_rate
|
||||
IMPORTING iv_room TYPE {{p}}if_studio_pricer=>ty_room
|
||||
RETURNING VALUE(rv_rate) TYPE {{p}}if_studio_pricer=>ty_amount.
|
||||
|
||||
METHODS billable_hours
|
||||
IMPORTING iv_minutes TYPE i
|
||||
RETURNING VALUE(rv_hours) TYPE i.
|
||||
|
||||
METHODS discount_percent
|
||||
IMPORTING iv_bookings TYPE i
|
||||
RETURNING VALUE(rv_percent) TYPE i.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}studio_pricer IMPLEMENTATION.
|
||||
METHOD {{p}}if_studio_pricer~calculate.
|
||||
DATA(lv_rate) = hourly_rate( iv_room ).
|
||||
IF lv_rate IS INITIAL.
|
||||
rv_price = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA(lv_base) = lv_rate * billable_hours( iv_minutes ).
|
||||
DATA(lv_percent) = discount_percent( iv_bookings ).
|
||||
rv_price = lv_base - lv_base * lv_percent / 100.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD hourly_rate.
|
||||
CASE iv_room.
|
||||
WHEN {{p}}if_studio_pricer=>c_room-a.
|
||||
rv_rate = '48.00'.
|
||||
WHEN {{p}}if_studio_pricer=>c_room-b.
|
||||
rv_rate = '36.00'.
|
||||
WHEN {{p}}if_studio_pricer=>c_room-c.
|
||||
rv_rate = '27.00'.
|
||||
WHEN OTHERS.
|
||||
rv_rate = 0.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD billable_hours.
|
||||
rv_hours = ( iv_minutes + 59 ) DIV 60.
|
||||
IF rv_hours < 1.
|
||||
rv_hours = 1.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount_percent.
|
||||
IF iv_bookings <= 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA lv_bookings TYPE p LENGTH 7 DECIMALS 2.
|
||||
lv_bookings = iv_bookings.
|
||||
DATA(lv_raw) = lv_bookings * c_discount_per_booking.
|
||||
IF lv_raw > c_max_discount.
|
||||
lv_raw = c_max_discount.
|
||||
ENDIF.
|
||||
rv_percent = lv_raw.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -0,0 +1,76 @@
|
||||
CLASS ltc_studio_pricer DEFINITION FINAL FOR TESTING
|
||||
DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}studio_pricer.
|
||||
|
||||
METHODS setup.
|
||||
METHODS assert_price
|
||||
IMPORTING iv_expected TYPE {{p}}if_studio_pricer=>ty_amount
|
||||
iv_actual TYPE {{p}}if_studio_pricer=>ty_amount.
|
||||
METHODS room_a_three_hours FOR TESTING.
|
||||
METHODS started_hour_counts FOR TESTING.
|
||||
METHODS short_booking_one_hour FOR TESTING.
|
||||
METHODS invalid_room_returns_zero FOR TESTING.
|
||||
METHODS discount_five_bookings FOR TESTING.
|
||||
METHODS discount_is_capped FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_studio_pricer IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}studio_pricer( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD assert_price.
|
||||
cl_abap_unit_assert=>assert_equals( exp = iv_expected act = iv_actual ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD room_a_three_hours.
|
||||
assert_price( iv_expected = '144.00'
|
||||
iv_actual = mo_cut->{{p}}if_studio_pricer~calculate(
|
||||
iv_room = 'A'
|
||||
iv_minutes = 180
|
||||
iv_bookings = 0 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD started_hour_counts.
|
||||
assert_price( iv_expected = '96.00'
|
||||
iv_actual = mo_cut->{{p}}if_studio_pricer~calculate(
|
||||
iv_room = 'A'
|
||||
iv_minutes = 90
|
||||
iv_bookings = 0 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD short_booking_one_hour.
|
||||
assert_price( iv_expected = '27.00'
|
||||
iv_actual = mo_cut->{{p}}if_studio_pricer~calculate(
|
||||
iv_room = 'C'
|
||||
iv_minutes = 15
|
||||
iv_bookings = 0 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_room_returns_zero.
|
||||
assert_price( iv_expected = '0.00'
|
||||
iv_actual = mo_cut->{{p}}if_studio_pricer~calculate(
|
||||
iv_room = 'X'
|
||||
iv_minutes = 60
|
||||
iv_bookings = 0 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount_five_bookings.
|
||||
assert_price( iv_expected = '92.16'
|
||||
iv_actual = mo_cut->{{p}}if_studio_pricer~calculate(
|
||||
iv_room = 'A'
|
||||
iv_minutes = 120
|
||||
iv_bookings = 5 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD discount_is_capped.
|
||||
assert_price( iv_expected = '30.60'
|
||||
iv_actual = mo_cut->{{p}}if_studio_pricer~calculate(
|
||||
iv_room = 'B'
|
||||
iv_minutes = 30
|
||||
iv_bookings = 30 ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
15
tasks_gen/eval/G0170/seed/if_studio_pricer.intf.abap
Normal file
15
tasks_gen/eval/G0170/seed/if_studio_pricer.intf.abap
Normal file
@@ -0,0 +1,15 @@
|
||||
INTERFACE {{p}}if_studio_pricer PUBLIC.
|
||||
TYPES ty_room TYPE c LENGTH 1.
|
||||
TYPES ty_amount TYPE p LENGTH 8 DECIMALS 2.
|
||||
CONSTANTS:
|
||||
BEGIN OF c_room,
|
||||
a TYPE ty_room VALUE 'A',
|
||||
b TYPE ty_room VALUE 'B',
|
||||
c TYPE ty_room VALUE 'C',
|
||||
END OF c_room.
|
||||
METHODS calculate
|
||||
IMPORTING iv_room TYPE ty_room
|
||||
iv_minutes TYPE i
|
||||
iv_bookings TYPE i
|
||||
RETURNING VALUE(rv_price) TYPE ty_amount.
|
||||
ENDINTERFACE.
|
||||
46
tasks_gen/eval/G0170/spec.md
Normal file
46
tasks_gen/eval/G0170/spec.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# 1. Goal
|
||||
Calculate the price of a booking at a recording studio. A booking program calls
|
||||
the calculation before it shows the price to the customer. The program needs one
|
||||
price for each booking.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The interface {{P}}IF_STUDIO_PRICER exists in package $TMP. It is active.
|
||||
- The interface has the type TY_ROOM (CHAR 1), the type TY_AMOUNT (packed, length
|
||||
8, 2 decimals), the constant structure C_ROOM (A, B, C), and one method:
|
||||
CALCULATE IMPORTING iv_room TYPE ty_room, iv_minutes TYPE i, iv_bookings TYPE i
|
||||
RETURNING VALUE(rv_price) TYPE ty_amount.
|
||||
|
||||
# 4. Contract
|
||||
- Create the class {{P}}STUDIO_PRICER in package $TMP.
|
||||
- The class is public and final. It has a public constructor without parameters.
|
||||
- The class implements {{P}}IF_STUDIO_PRICER.
|
||||
- Do not add other public methods.
|
||||
|
||||
# 5. Business rules
|
||||
Apply the rules in this sequence.
|
||||
1. The room type is A, B, or C. Any other room type is invalid. For an invalid
|
||||
room type, return 0.00.
|
||||
2. The hourly rate depends on the room type: A 48.00, B 36.00, C 27.00.
|
||||
3. The booking duration is given in minutes. A started hour counts as a full
|
||||
hour. A booking of less than 60 minutes counts as one hour.
|
||||
4. The base price is the hourly rate multiplied by the number of hours.
|
||||
5. The loyalty discount is 0.75 percent for each booking of the customer in the
|
||||
last 12 months. The discount is at most 15 percent.
|
||||
6. The discount percentage is rounded.
|
||||
7. The price is the base price minus the discount. The discount is the rounded
|
||||
discount percentage of the base price.
|
||||
8. Return the price.
|
||||
|
||||
# 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_STUDIO_PRICER.
|
||||
|
||||
# 7. Acceptance
|
||||
- The class is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write your own ABAP Unit tests for the class.
|
||||
61
tasks_gen/eval/G0170/task.json
Normal file
61
tasks_gen/eval/G0170/task.json
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"id": "G0170",
|
||||
"category": "H",
|
||||
"object_type": "CLAS",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "stop",
|
||||
"budget": {
|
||||
"max_tool_calls": 40,
|
||||
"max_activations": 10
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "INTF",
|
||||
"name": "{{P}}IF_STUDIO_PRICER",
|
||||
"file": "seed/if_studio_pricer.intf.abap",
|
||||
"description": "Studio price contract"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}STUDIO_PRICER",
|
||||
"implements": "{{P}}IF_STUDIO_PRICER"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}IF_STUDIO_PRICER"
|
||||
],
|
||||
"hidden_tests": [],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}STUDIO_PRICER",
|
||||
"file": "reference/studio_pricer.clas.abap",
|
||||
"description": "Studio price calculator",
|
||||
"testclasses_file": "reference/studio_pricer.testclasses.abap"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"db_operation_in_loop"
|
||||
],
|
||||
"expected_gap": {
|
||||
"description": "The spec requires the loyalty discount percentage to be rounded but does not state the rounding target or the rounding mode, so the price of a booking with a fractional discount percentage is undefined.",
|
||||
"keywords": [
|
||||
[
|
||||
"discount",
|
||||
"round"
|
||||
],
|
||||
[
|
||||
"rounding",
|
||||
"precision"
|
||||
],
|
||||
[
|
||||
"round",
|
||||
"mode"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user