Stage 2 summary at 50 accepted trajectories

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-05 18:02:52 +02:00
parent 332fb4601d
commit 5bcd1bf9cd
1230 changed files with 77563 additions and 33 deletions

View File

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

View File

@@ -0,0 +1,34 @@
FUNCTION {{p}}lkr_fee
IMPORTING
iv_size_code TYPE string
iv_days TYPE i
iv_member TYPE abap_bool
EXPORTING
ev_fee TYPE decfloat34
EXCEPTIONS
invalid_days.
IF iv_days < 1.
RAISE invalid_days.
ENDIF.
DATA lv_rate TYPE decfloat34.
CASE iv_size_code.
WHEN 'S'.
lv_rate = '2.50'.
WHEN 'M'.
lv_rate = '4.25'.
WHEN 'L'.
lv_rate = '6.75'.
WHEN OTHERS.
" The specification gives no rule for a size code that is not S, M or L.
RETURN.
ENDCASE.
ev_fee = lv_rate * iv_days.
IF iv_member = abap_true.
ev_fee = ev_fee / 2.
ENDIF.
ev_fee = round( val = ev_fee dec = 2 mode = cl_abap_math=>round_half_up ).
ENDFUNCTION.

View File

@@ -0,0 +1,55 @@
CLASS {{p}}lkr_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS fee_for
IMPORTING iv_size_code TYPE string
iv_days TYPE i
iv_member TYPE abap_bool
RETURNING VALUE(rv_fee) TYPE decfloat34.
METHODS daily_rate FOR TESTING.
METHODS member_discount FOR TESTING.
METHODS invalid_days FOR TESTING.
ENDCLASS.
CLASS {{p}}lkr_test IMPLEMENTATION.
METHOD fee_for.
CALL FUNCTION '{{P}}LKR_FEE'
EXPORTING
iv_size_code = iv_size_code
iv_days = iv_days
iv_member = iv_member
IMPORTING
ev_fee = rv_fee
EXCEPTIONS
invalid_days = 1
OTHERS = 2.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
ENDMETHOD.
METHOD daily_rate.
cl_abap_unit_assert=>assert_equals(
exp = CONV decfloat34( '12.75' )
act = fee_for( iv_size_code = 'M' iv_days = 3 iv_member = abap_false ) ).
ENDMETHOD.
METHOD member_discount.
cl_abap_unit_assert=>assert_equals(
exp = CONV decfloat34( '6.38' )
act = fee_for( iv_size_code = 'M' iv_days = 3 iv_member = abap_true ) ).
ENDMETHOD.
METHOD invalid_days.
DATA lv_fee TYPE decfloat34.
CALL FUNCTION '{{P}}LKR_FEE'
EXPORTING
iv_size_code = 'S'
iv_days = 0
IMPORTING
ev_fee = lv_fee
EXCEPTIONS
invalid_days = 1
OTHERS = 2.
cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,17 @@
FUNCTION {{p}}lkr_sample
IMPORTING
iv_size_code TYPE string
iv_days TYPE i
iv_member TYPE abap_bool
EXPORTING
ev_fee TYPE decfloat34
EXCEPTIONS
invalid_days.
IF iv_days < 1.
RAISE invalid_days.
ENDIF.
ev_fee = 0.
ENDFUNCTION.

View File

@@ -0,0 +1,43 @@
# 1. Goal
A ski resort rents lockers in its ski depot. The depot terminal calls one
function module for each locker rental. The function module calculates the fee
of the rental. The terminal calls all locker modules in the same way, so the new
function module must have the same interface as the sample module.
# 2. Open questions
None.
# 3. Context
- Function group {{P}}FG_LKR exists in package $TMP.
- Function module {{P}}LKR_SAMPLE exists in this group. It is the sample locker
module. Its interface is the interface that all locker modules must use.
- The size code of a locker is stored in the electronic lock of the locker. The
terminal sends the code that the lock reports.
- The depot has lockers of the three types S, M and L. Locks of retired locker
types are still in use in the old part of the depot. These locks report the
codes of their retired types.
# 4. Contract
- Create the function module {{P}}LKR_FEE in function group {{P}}FG_LKR.
- Use exactly the interface of {{P}}LKR_SAMPLE: the same parameter names, kinds,
types, and exceptions.
# 5. Business rules
1. If the number of days is less than 1, raise the exception INVALID_DAYS.
2. The daily rate of a locker depends on its size code:
- Size code S: 2.50 per day.
- Size code M: 4.25 per day.
- Size code L: 6.75 per day.
3. The fee is the daily rate multiplied by the number of days.
4. A member of the ski club pays 50 % of the fee.
5. Round the fee half up to 2 decimals.
# 6. Constraints
- Release target: 8.16.
- Coding standards: Clean ABAP.
- Out of scope: do not change {{P}}LKR_SAMPLE.
# 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,90 @@
{
"id": "G1107",
"category": "H",
"object_type": "FUNC",
"difficulty": 2,
"release_target": "v816",
"expected_outcome": "stop",
"expected_gap": {
"description": "The specification gives no rule for a locker size code that is not S, M or L, so the fee of such a rental cannot be determined.",
"keywords": [
[
"unknown",
"code"
],
[
"size",
"code"
],
[
"missing",
"rule"
]
]
},
"budget": {
"max_tool_calls": 60,
"max_activations": 15
},
"seed": [
{
"type": "FUGR",
"name": "{{P}}FG_LKR",
"description": "Locker fee function group"
},
{
"type": "FUNC",
"name": "{{P}}LKR_SAMPLE",
"functionGroup": "{{P}}FG_LKR",
"file": "seed/lkr_sample.func.abap",
"description": "Sample locker module"
}
],
"contract": [
{
"type": "FUNC",
"name": "{{P}}LKR_FEE",
"functionGroup": "{{P}}FG_LKR",
"params": [
{
"name": "iv_size_code",
"type": "string"
},
{
"name": "iv_days",
"type": "i"
},
{
"name": "iv_member",
"type": "abap_bool"
},
{
"name": "ev_fee",
"type": "decfloat34"
}
]
}
],
"out_of_scope": [
"{{P}}LKR_SAMPLE"
],
"hidden_tests": [],
"reference": [
{
"type": "FUNC",
"name": "{{P}}LKR_FEE",
"functionGroup": "{{P}}FG_LKR",
"file": "reference/lkr_fee.func.abap",
"description": "Locker fee module"
},
{
"type": "CLAS",
"name": "{{P}}LKR_TEST",
"file": "reference/lkr_test.clas.abap",
"description": "Own tests for the locker fee module"
}
],
"craft_checks": [
"method_length"
]
}