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,106 @@
CLASS {{p}}t14_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS call
IMPORTING
iv_players TYPE i
iv_games TYPE i
iv_day TYPE i
iv_shoes TYPE abap_bool DEFAULT abap_false
EXPORTING
ev_fee TYPE decfloat34
ev_note TYPE string
ev_subrc TYPE sysubrc.
METHODS weekday_rate FOR TESTING.
METHODS weekend_rate FOR TESTING.
METHODS lane_count FOR TESTING.
METHODS shoe_charge FOR TESTING.
METHODS group_discount FOR TESTING.
METHODS group_discount_negative FOR TESTING.
METHODS day_above_five FOR TESTING.
METHODS invalid_players FOR TESTING.
METHODS invalid_games FOR TESTING.
METHODS no_discount_below_twelve FOR TESTING.
ENDCLASS.
CLASS {{p}}t14_hidden IMPLEMENTATION.
METHOD call.
CALL FUNCTION '{{P}}BOWL_FEE_OLD'
EXPORTING
iv_players = iv_players
iv_games = iv_games
iv_day = iv_day
iv_shoes = iv_shoes
IMPORTING
ev_fee = ev_fee
ev_note = ev_note
EXCEPTIONS
invalid_input = 1
OTHERS = 2.
ev_subrc = sy-subrc.
ENDMETHOD.
METHOD weekday_rate.
call( EXPORTING iv_players = 1 iv_games = 1 iv_day = 1
IMPORTING ev_fee = DATA(lv_fee) ev_note = DATA(lv_note) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '3.50' ) act = lv_fee ).
cl_abap_unit_assert=>assert_equals( exp = 'BOOKED' act = lv_note ).
ENDMETHOD.
METHOD weekend_rate.
call( EXPORTING iv_players = 6 iv_games = 2 iv_day = 6
IMPORTING ev_fee = DATA(lv_fee) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '10.00' ) act = lv_fee ).
ENDMETHOD.
METHOD lane_count.
call( EXPORTING iv_players = 7 iv_games = 1 iv_day = 1
IMPORTING ev_fee = DATA(lv_fee) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '7.00' ) act = lv_fee ).
ENDMETHOD.
METHOD shoe_charge.
call( EXPORTING iv_players = 7 iv_games = 1 iv_day = 1 iv_shoes = abap_true
IMPORTING ev_fee = DATA(lv_fee) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '21.00' ) act = lv_fee ).
ENDMETHOD.
METHOD group_discount.
call( EXPORTING iv_players = 12 iv_games = 1 iv_day = 1 iv_shoes = abap_true
IMPORTING ev_fee = DATA(lv_fee) ev_note = DATA(lv_note) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '21.00' ) act = lv_fee ).
cl_abap_unit_assert=>assert_equals( exp = 'GROUP' act = lv_note ).
ENDMETHOD.
METHOD group_discount_negative.
call( EXPORTING iv_players = 12 iv_games = 1 iv_day = 1
IMPORTING ev_fee = DATA(lv_fee) ev_note = DATA(lv_note) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '-3.00' ) act = lv_fee ).
cl_abap_unit_assert=>assert_equals( exp = 'GROUP' act = lv_note ).
ENDMETHOD.
METHOD day_above_five.
call( EXPORTING iv_players = 1 iv_games = 1 iv_day = 8
IMPORTING ev_fee = DATA(lv_fee) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '5.00' ) act = lv_fee ).
ENDMETHOD.
METHOD invalid_players.
call( EXPORTING iv_players = 0 iv_games = 1 iv_day = 1
IMPORTING ev_subrc = DATA(lv_rc) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
ENDMETHOD.
METHOD invalid_games.
call( EXPORTING iv_players = 1 iv_games = 0 iv_day = 1
IMPORTING ev_subrc = DATA(lv_rc) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
ENDMETHOD.
METHOD no_discount_below_twelve.
call( EXPORTING iv_players = 11 iv_games = 1 iv_day = 1
IMPORTING ev_fee = DATA(lv_fee) ev_note = DATA(lv_note) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '7.00' ) act = lv_fee ).
cl_abap_unit_assert=>assert_equals( exp = 'BOOKED' act = lv_note ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,90 @@
FUNCTION {{p}}bowl_fee_old
IMPORTING
iv_players TYPE i
iv_games TYPE i
iv_day TYPE i
iv_shoes TYPE abap_bool
EXPORTING
ev_fee TYPE decfloat34
ev_note TYPE string
EXCEPTIONS
invalid_input.
TYPES ty_rate TYPE p LENGTH 8 DECIMALS 2.
CLASS lcl_bowling DEFINITION.
PUBLIC SECTION.
METHODS calculate
IMPORTING
iv_players TYPE i
iv_games TYPE i
iv_day TYPE i
iv_shoes TYPE abap_bool
EXPORTING
ev_fee TYPE decfloat34
ev_note TYPE string.
PRIVATE SECTION.
CONSTANTS:
c_lane_size TYPE i VALUE 6,
c_group_size TYPE i VALUE 12,
c_rate_weekday TYPE ty_rate VALUE '3.50',
c_rate_weekend TYPE ty_rate VALUE '5.00',
c_shoe_price TYPE ty_rate VALUE '2.00',
c_group_discount TYPE ty_rate VALUE '10.00'.
METHODS lanes_for
IMPORTING iv_players TYPE i
RETURNING VALUE(rv_lanes) TYPE i.
METHODS rate_for
IMPORTING iv_day TYPE i
RETURNING VALUE(rv_rate) TYPE ty_rate.
ENDCLASS.
CLASS lcl_bowling IMPLEMENTATION.
METHOD calculate.
DATA(lv_lanes) = lanes_for( iv_players ).
DATA(lv_rate) = rate_for( iv_day ).
DATA lv_sum TYPE p LENGTH 15 DECIMALS 2.
lv_sum = lv_lanes * iv_games * lv_rate.
IF iv_shoes = abap_true.
lv_sum = lv_sum + iv_players * c_shoe_price.
ENDIF.
ev_note = 'BOOKED'.
IF iv_players >= c_group_size.
lv_sum = lv_sum - c_group_discount.
ev_note = 'GROUP'.
ENDIF.
ev_fee = lv_sum.
ENDMETHOD.
METHOD lanes_for.
rv_lanes = iv_players DIV c_lane_size.
IF iv_players MOD c_lane_size > 0.
rv_lanes = rv_lanes + 1.
ENDIF.
ENDMETHOD.
METHOD rate_for.
IF iv_day > 5.
rv_rate = c_rate_weekend.
ELSE.
rv_rate = c_rate_weekday.
ENDIF.
ENDMETHOD.
ENDCLASS.
IF iv_players < 1 OR iv_games < 1.
RAISE invalid_input.
ENDIF.
DATA(lo_bowling) = NEW lcl_bowling( ).
lo_bowling->calculate(
EXPORTING
iv_players = iv_players
iv_games = iv_games
iv_day = iv_day
iv_shoes = iv_shoes
IMPORTING
ev_fee = ev_fee
ev_note = ev_note ).
ENDFUNCTION.

View File

@@ -0,0 +1,74 @@
CLASS {{p}}t14_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS weekday_fee FOR TESTING.
METHODS weekend_fee FOR TESTING.
METHODS group_fee FOR TESTING.
METHODS invalid_input FOR TESTING.
ENDCLASS.
CLASS {{p}}t14_test IMPLEMENTATION.
METHOD weekday_fee.
DATA lv_fee TYPE decfloat34.
CALL FUNCTION '{{P}}BOWL_FEE_OLD'
EXPORTING
iv_players = 1
iv_games = 1
iv_day = 1
IMPORTING
ev_fee = lv_fee
EXCEPTIONS
invalid_input = 1
OTHERS = 2.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '3.50' ) act = lv_fee ).
ENDMETHOD.
METHOD weekend_fee.
DATA lv_fee TYPE decfloat34.
CALL FUNCTION '{{P}}BOWL_FEE_OLD'
EXPORTING
iv_players = 6
iv_games = 2
iv_day = 6
IMPORTING
ev_fee = lv_fee
EXCEPTIONS
invalid_input = 1
OTHERS = 2.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '10.00' ) act = lv_fee ).
ENDMETHOD.
METHOD group_fee.
DATA lv_fee TYPE decfloat34.
CALL FUNCTION '{{P}}BOWL_FEE_OLD'
EXPORTING
iv_players = 12
iv_games = 1
iv_day = 1
iv_shoes = abap_true
IMPORTING
ev_fee = lv_fee
EXCEPTIONS
invalid_input = 1
OTHERS = 2.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '21.00' ) act = lv_fee ).
ENDMETHOD.
METHOD invalid_input.
DATA lv_fee TYPE decfloat34.
CALL FUNCTION '{{P}}BOWL_FEE_OLD'
EXPORTING
iv_players = 0
iv_games = 1
iv_day = 1
IMPORTING
ev_fee = lv_fee
EXCEPTIONS
invalid_input = 1
OTHERS = 2.
cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,50 @@
FUNCTION {{p}}bowl_fee_old
IMPORTING
iv_players TYPE i
iv_games TYPE i
iv_day TYPE i
iv_shoes TYPE abap_bool
EXPORTING
ev_fee TYPE decfloat34
ev_note TYPE string
EXCEPTIONS
invalid_input.
DATA: lv_lanes TYPE i,
lv_rate TYPE p LENGTH 8 DECIMALS 2,
lv_sum TYPE p LENGTH 15 DECIMALS 2.
IF iv_players < 1.
RAISE invalid_input.
ENDIF.
IF iv_games < 1.
RAISE invalid_input.
ENDIF.
COMPUTE lv_lanes = iv_players DIV 6.
IF iv_players MOD 6 > 0.
ADD 1 TO lv_lanes.
ENDIF.
IF iv_day > 5.
MOVE '5.00' TO lv_rate.
ELSE.
MOVE '3.50' TO lv_rate.
ENDIF.
COMPUTE lv_sum = lv_lanes * iv_games * lv_rate.
IF iv_shoes = 'X'.
COMPUTE lv_sum = lv_sum + iv_players * '2.00'.
ENDIF.
ev_note = 'BOOKED'.
IF iv_players >= 12.
COMPUTE lv_sum = lv_sum - '10.00'.
ev_note = 'GROUP'.
ENDIF.
ev_fee = lv_sum.
ENDFUNCTION.

View File

@@ -0,0 +1,36 @@
# 1. Goal
Refactor the legacy function module {{P}}BOWL_FEE_OLD in place. The behavior must
stay the same. Improve the code quality so that the module is easier to maintain.
# 2. Open questions
None.
# 3. Context
- Function group {{P}}FG_BOWL exists in package $TMP.
- Function module {{P}}BOWL_FEE_OLD exists in this group. It is the legacy
implementation of the bowling fee calculation.
- The booking program calls this function module. The interface must not change.
# 4. Contract
- Refactor the function module {{P}}BOWL_FEE_OLD in function group {{P}}FG_BOWL.
- Keep the exact interface: the same parameter names, types, and exceptions.
- The function module name stays the same.
# 5. Business rules
The business rules are defined by the current behavior of the legacy code.
Read the legacy source code in {{P}}BOWL_FEE_OLD. The refactored function module
must produce exactly the same results as the legacy code for every input.
Do not change any rule.
# 6. Constraints
- Release target: SAP_BASIS 816.
- Coding standards: Clean ABAP. Use modern ABAP syntax. No obsolete statements
(for example COMPUTE, MOVE, ADD ... TO ...). Methods below 40 statements.
Pass large parameters by reference. No ATC priority 1 or 2 findings.
- Out of scope: do not change the function group {{P}}FG_BOWL. Do not change
the function module interface.
# 7. Acceptance
- The function module is active and has no syntax error.
- The hidden tests pass.
- Write ABAP Unit tests for the function module in a global test class.

View File

@@ -0,0 +1,86 @@
{
"id": "G0143",
"category": "E",
"object_type": "FUNC",
"difficulty": 2,
"release_target": "v816",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 60,
"max_activations": 15
},
"seed": [
{
"type": "FUGR",
"name": "{{P}}FG_BOWL",
"description": "Bowling fee function group"
},
{
"type": "FUNC",
"name": "{{P}}BOWL_FEE_OLD",
"functionGroup": "{{P}}FG_BOWL",
"file": "seed/bowl_fee_old.func.abap",
"description": "Legacy bowling fee calculation"
}
],
"contract": [
{
"type": "FUNC",
"name": "{{P}}BOWL_FEE_OLD",
"functionGroup": "{{P}}FG_BOWL",
"params": [
{
"name": "iv_players",
"type": "i"
},
{
"name": "iv_games",
"type": "i"
},
{
"name": "iv_day",
"type": "i"
},
{
"name": "iv_shoes",
"type": "abap_bool"
},
{
"name": "ev_fee",
"type": "decfloat34"
},
{
"name": "ev_note",
"type": "string"
}
]
}
],
"out_of_scope": [],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}T14_HIDDEN",
"file": "hidden/t14_hidden.clas.abap",
"description": "T14 hidden tests"
}
],
"reference": [
{
"type": "FUNC",
"name": "{{P}}BOWL_FEE_OLD",
"functionGroup": "{{P}}FG_BOWL",
"file": "reference/bowl_fee_old.func.abap",
"description": "Refactored bowling fee calculation"
},
{
"type": "CLAS",
"name": "{{P}}T14_TEST",
"file": "reference/t14_test.clas.abap",
"description": "T14 own tests"
}
],
"craft_checks": [
"method_length"
]
}