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:
Kral
2026-10-03 12:10:52 +02:00
parent d3250acfb8
commit 39769afce8
741 changed files with 40573 additions and 317 deletions

View File

@@ -0,0 +1,14 @@
{
"id": "G0171",
"pool": "eval",
"object_type": "CLAS",
"category": "H",
"attempts": [
{
"stage": "validate",
"oracle": 100,
"null": 30
}
],
"accepted": true
}

View File

@@ -0,0 +1,58 @@
CLASS {{p}}kiln_pricer DEFINITION PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES {{p}}if_kiln_price.
PRIVATE SECTION.
TYPES ty_amount TYPE p LENGTH 10 DECIMALS 4.
CONSTANTS:
c_base_fee TYPE ty_amount VALUE '40.00',
c_piece_fee TYPE ty_amount VALUE '12.00',
c_free_weight TYPE {{p}}if_kiln_price=>ty_weight VALUE '10.00',
c_kg_fee TYPE ty_amount VALUE '3.00',
c_glaze_fee TYPE ty_amount VALUE '25.00',
c_member_rate TYPE ty_amount VALUE '0.85'.
METHODS clay_factor
IMPORTING iv_clay TYPE {{p}}if_kiln_price=>ty_clay
RETURNING VALUE(rv_factor) TYPE ty_amount.
ENDCLASS.
CLASS {{p}}kiln_pricer IMPLEMENTATION.
METHOD {{p}}if_kiln_price~calculate_price.
IF iv_clay IS INITIAL.
rv_price = 0.
RETURN.
ENDIF.
DATA lv_price TYPE ty_amount.
lv_price = c_base_fee + iv_pieces * c_piece_fee.
IF iv_weight > c_free_weight.
lv_price = lv_price + ( iv_weight - c_free_weight ) * c_kg_fee.
ENDIF.
DATA(lv_factor) = clay_factor( iv_clay ).
lv_price = lv_price * lv_factor.
IF iv_glaze = abap_true.
lv_price = lv_price + c_glaze_fee.
ENDIF.
IF iv_member = abap_true.
lv_price = lv_price * c_member_rate.
ENDIF.
rv_price = round( val = lv_price dec = 2 ).
ENDMETHOD.
METHOD clay_factor.
CASE iv_clay.
WHEN 'ST'.
rv_factor = '1.20'.
WHEN 'PO'.
rv_factor = '1.50'.
WHEN OTHERS.
rv_factor = '1.00'.
ENDCASE.
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,92 @@
CLASS ltc_kiln_pricer DEFINITION FINAL FOR TESTING
DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
DATA mo_cut TYPE REF TO {{p}}if_kiln_price.
METHODS setup.
METHODS base_fee FOR TESTING.
METHODS piece_fee FOR TESTING.
METHODS weight_surcharge FOR TESTING.
METHODS clay_factor FOR TESTING.
METHODS glaze_fee FOR TESTING.
METHODS member_discount FOR TESTING.
METHODS initial_clay FOR TESTING.
ENDCLASS.
CLASS ltc_kiln_pricer IMPLEMENTATION.
METHOD setup.
mo_cut = NEW {{p}}kiln_pricer( ).
ENDMETHOD.
METHOD base_fee.
cl_abap_unit_assert=>assert_equals(
exp = '40.00'
act = mo_cut->calculate_price( iv_pieces = 0
iv_weight = '0.00'
iv_clay = 'EA'
iv_glaze = abap_false
iv_member = abap_false ) ).
ENDMETHOD.
METHOD piece_fee.
cl_abap_unit_assert=>assert_equals(
exp = '100.00'
act = mo_cut->calculate_price( iv_pieces = 5
iv_weight = '0.00'
iv_clay = 'EA'
iv_glaze = abap_false
iv_member = abap_false ) ).
ENDMETHOD.
METHOD weight_surcharge.
cl_abap_unit_assert=>assert_equals(
exp = '55.00'
act = mo_cut->calculate_price( iv_pieces = 0
iv_weight = '15.00'
iv_clay = 'EA'
iv_glaze = abap_false
iv_member = abap_false ) ).
ENDMETHOD.
METHOD clay_factor.
cl_abap_unit_assert=>assert_equals(
exp = '60.00'
act = mo_cut->calculate_price( iv_pieces = 0
iv_weight = '0.00'
iv_clay = 'PO'
iv_glaze = abap_false
iv_member = abap_false ) ).
ENDMETHOD.
METHOD glaze_fee.
cl_abap_unit_assert=>assert_equals(
exp = '65.00'
act = mo_cut->calculate_price( iv_pieces = 0
iv_weight = '0.00'
iv_clay = 'EA'
iv_glaze = abap_true
iv_member = abap_false ) ).
ENDMETHOD.
METHOD member_discount.
cl_abap_unit_assert=>assert_equals(
exp = '34.00'
act = mo_cut->calculate_price( iv_pieces = 0
iv_weight = '0.00'
iv_clay = 'EA'
iv_glaze = abap_false
iv_member = abap_true ) ).
ENDMETHOD.
METHOD initial_clay.
cl_abap_unit_assert=>assert_equals(
exp = '0.00'
act = mo_cut->calculate_price( iv_pieces = 0
iv_weight = '0.00'
iv_clay = space
iv_glaze = abap_false
iv_member = abap_false ) ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,13 @@
INTERFACE {{p}}if_kiln_price PUBLIC.
TYPES:
ty_clay TYPE c LENGTH 2,
ty_weight TYPE p LENGTH 6 DECIMALS 2,
ty_price TYPE p LENGTH 8 DECIMALS 2.
METHODS calculate_price
IMPORTING iv_pieces TYPE i
iv_weight TYPE ty_weight
iv_clay TYPE ty_clay
iv_glaze TYPE abap_bool
iv_member TYPE abap_bool
RETURNING VALUE(rv_price) TYPE ty_price.
ENDINTERFACE.

View File

@@ -0,0 +1,54 @@
# 1. Goal
Calculate the price of one firing in a pottery kiln. The kiln booking program calls
the calculation before it confirms a booking. The program needs one price for each
booking.
# 2. Open questions
None.
# 3. Context
- The interface {{P}}IF_KILN_PRICE exists in package $TMP. It is active.
- The interface has the types TY_CLAY (2 characters), TY_WEIGHT (packed, length 6,
decimals 2) and TY_PRICE (packed, length 8, decimals 2).
- The interface has one method:
CALCULATE_PRICE
IMPORTING iv_pieces TYPE i
iv_weight TYPE ty_weight
iv_clay TYPE ty_clay
iv_glaze TYPE abap_bool
iv_member TYPE abap_bool
RETURNING VALUE(rv_price) TYPE ty_price.
iv_pieces is the number of pieces. iv_weight is the weight in kilograms.
iv_glaze is 'X' when the customer books a glaze firing. iv_member is 'X' when
the customer is a member.
- The kiln booking program calls the method for each booking. The customer can
leave the clay type empty when the booking is created. The customer chooses the
clay type later.
# 4. Contract
- Create the class {{P}}KILN_PRICER in package $TMP.
- The class is public, final, and has a public constructor without parameters.
- The class implements {{P}}IF_KILN_PRICE.
- Do not add other public methods.
# 5. Business rules
The price is in euro. Apply the rules in this sequence.
1. Base fee: 40.00 for each firing.
2. Piece fee: 12.00 for each piece.
3. Weight surcharge: 3.00 for each kilogram of the weight that is above 10 kg.
A weight of 10 kg or less gives no surcharge.
4. Clay factor: multiply the sum of rules 1 to 3 by the factor of the chosen clay
type: EA 1.00, ST 1.20, PO 1.50.
5. Glaze firing: add 25.00 when the customer books a glaze firing.
6. Member discount: subtract 15 per cent when the customer is a member.
7. Round the result to two decimals. Round half up.
# 6. Constraints
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
- 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_KILN_PRICE.
# 7. Acceptance
- The class is active and has no syntax error.
- Write your own ABAP Unit tests for the class.

View File

@@ -0,0 +1,65 @@
{
"id": "G0171",
"category": "H",
"object_type": "CLAS",
"difficulty": 2,
"release_target": "v816",
"expected_outcome": "stop",
"expected_gap": {
"description": "The business rules do not define which price the class returns when the clay type is initial, although the caller can pass an empty clay type.",
"keywords": [
[
"clay",
"initial"
],
[
"clay",
"empty"
],
[
"clay",
"chosen"
],
[
"clay",
"unspecified"
]
]
},
"budget": {
"max_tool_calls": 30,
"max_activations": 5
},
"seed": [
{
"type": "INTF",
"name": "{{P}}IF_KILN_PRICE",
"file": "seed/if_kiln_price.intf.abap",
"description": "Interface with the price calculation signature for one kiln firing"
}
],
"contract": [
{
"type": "CLAS",
"name": "{{P}}KILN_PRICER",
"implements": "{{P}}IF_KILN_PRICE"
}
],
"out_of_scope": [
"{{P}}IF_KILN_PRICE"
],
"hidden_tests": [],
"reference": [
{
"type": "CLAS",
"name": "{{P}}KILN_PRICER",
"file": "reference/kiln_pricer.clas.abap",
"description": "Intended kiln price calculation",
"testclasses_file": "reference/kiln_pricer.testclasses.abap"
}
],
"craft_checks": [
"method_length",
"no_global_variables"
]
}