Fix coverage with several contract classes; table annotation and file path checks; clean task dir on write
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
93
tasks_gen/eval/G0117/spec.md
Normal file
93
tasks_gen/eval/G0117/spec.md
Normal file
@@ -0,0 +1,93 @@
|
||||
# 1. Goal
|
||||
|
||||
A tool crib lends workshop tools to employees. A shop-floor terminal calls one
|
||||
class to record the loans and the returns and to show the open loans. The class
|
||||
keeps the loans in memory.
|
||||
|
||||
# 2. Open questions
|
||||
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
|
||||
- All objects are in package $TMP. No transport is necessary.
|
||||
- The class {{P}}TOOL_MASTER exists in package $TMP. It is active. It has the
|
||||
public type TY_TOOL_ID (character-like, length 10) and the static method
|
||||
IS_VALID_TOOL. IS_VALID_TOOL has the importing parameter IV_TOOL_ID
|
||||
(TY_TOOL_ID) and the returning parameter RV_VALID (abap_bool). The method
|
||||
ignores spaces and letter case. It returns abap_true only for the tools that
|
||||
the crib has in stock.
|
||||
- The terminal creates one instance of the new class for each shift. There is
|
||||
no database table. All loans live in the instance.
|
||||
|
||||
# 4. Contract
|
||||
|
||||
Create the class {{P}}TOOL_CRIB in package $TMP.
|
||||
|
||||
The class is public and final. An instance is created without parameters.
|
||||
|
||||
Public types:
|
||||
- TY_TOOL_ID: character-like, length 10.
|
||||
- TY_EMPLOYEE: character-like, length 20.
|
||||
- TY_LOAN: structure with the components TOOL_ID (TY_TOOL_ID), EMPLOYEE
|
||||
(TY_EMPLOYEE) and DUE_DATE (type D).
|
||||
- TT_LOANS: table type with the row type TY_LOAN.
|
||||
|
||||
Public methods:
|
||||
- LEND, importing IV_TOOL_ID (TY_TOOL_ID), IV_EMPLOYEE (TY_EMPLOYEE) and
|
||||
IV_DUE_DATE (D), returning RV_ACCEPTED (abap_bool).
|
||||
- RETURN_TOOL, importing IV_TOOL_ID (TY_TOOL_ID), returning RV_FOUND
|
||||
(abap_bool).
|
||||
- IS_ON_LOAN, importing IV_TOOL_ID (TY_TOOL_ID), returning RV_ON_LOAN
|
||||
(abap_bool).
|
||||
- OPEN_LOANS, returning RT_LOANS (TT_LOANS).
|
||||
- OVERDUE_LOANS, importing IV_TODAY (D), returning RT_LOANS (TT_LOANS).
|
||||
|
||||
Do not add other public components.
|
||||
|
||||
# 5. Business rules
|
||||
|
||||
Normalization:
|
||||
1. The normalized tool ID is the tool ID without spaces and in upper case.
|
||||
2. The normalized employee is the employee without spaces and in upper case.
|
||||
|
||||
LEND applies these steps in this sequence. It stops at the first step that
|
||||
rejects the loan.
|
||||
3. If the normalized tool ID is empty, reject.
|
||||
4. If the normalized employee is empty, reject.
|
||||
5. If the due date is initial, reject.
|
||||
6. If {{P}}TOOL_MASTER=>IS_VALID_TOOL returns abap_false for the normalized tool
|
||||
ID, reject.
|
||||
7. If the normalized tool ID is already on loan, reject.
|
||||
8. Else record the loan with the normalized tool ID, the normalized employee
|
||||
and the due date. Accept the loan.
|
||||
|
||||
Reject means: return abap_false and do not change the loans.
|
||||
|
||||
9. RETURN_TOOL: if the normalized tool ID is on loan, delete the loan and
|
||||
return abap_true. Else return abap_false. An empty normalized tool ID
|
||||
returns abap_false.
|
||||
10. IS_ON_LOAN: return abap_true if the normalized tool ID is on loan. Else
|
||||
return abap_false. An empty normalized tool ID returns abap_false.
|
||||
11. OPEN_LOANS returns one row for each open loan. The rows are ordered by
|
||||
DUE_DATE in ascending order. Rows with the same DUE_DATE are ordered by
|
||||
TOOL_ID in ascending order.
|
||||
12. OVERDUE_LOANS returns the open loans with a DUE_DATE before IV_TODAY. If
|
||||
IV_TODAY is initial, the result is empty. The rows have the same order as
|
||||
in OPEN_LOANS.
|
||||
13. A due date in the past is permitted at LEND. Such a loan appears in
|
||||
OVERDUE_LOANS.
|
||||
14. A new instance has no loans.
|
||||
|
||||
# 6. Constraints
|
||||
|
||||
- Release target: SAP_BASIS 8.16.
|
||||
- Coding standards: Clean ABAP. Methods below 40 statements. No global
|
||||
variables. No comment that restates the code.
|
||||
- Out of scope: do not change {{P}}TOOL_MASTER.
|
||||
|
||||
# 7. Acceptance
|
||||
|
||||
- The class is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write your own ABAP Unit tests for the class.
|
||||
Reference in New Issue
Block a user