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:
85
tasks_gen/eval/G0129/spec.md
Normal file
85
tasks_gen/eval/G0129/spec.md
Normal file
@@ -0,0 +1,85 @@
|
||||
# 1. Goal
|
||||
Calculate the internal price of a print job for the print shop of a company. A
|
||||
billing program calls the calculation before it charges the cost centre of a
|
||||
department. Invalid job data must raise a class-based exception.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Package $TMP. No other object exists for this topic.
|
||||
- The billing program catches the exceptions and shows the reason to the user.
|
||||
The names of the classes and their public components are fixed.
|
||||
|
||||
# 4. Contract
|
||||
Create three classes in package $TMP.
|
||||
|
||||
## {{P}}CX_PRINT_JOB_ERROR
|
||||
- Public, final, inherits from CX_ROOT.
|
||||
- Public type TY_REASON, character 10.
|
||||
- Public constant structure C_REASON with the components PAGES, COPIES, PAPER,
|
||||
COLOR and DEPT. The values are 'PAGES', 'COPIES', 'PAPER', 'COLOR' and
|
||||
'DEPT'.
|
||||
- Public attribute MV_REASON of type TY_REASON.
|
||||
- Public constructor with the importing parameter IV_REASON of type TY_REASON.
|
||||
The constructor writes IV_REASON to MV_REASON.
|
||||
|
||||
## {{P}}CX_PRINT_LIMIT
|
||||
- Public, final, inherits from CX_ROOT.
|
||||
- Public attribute MV_PAGES of type I.
|
||||
- Public constructor with the importing parameter IV_PAGES of type I. The
|
||||
constructor writes IV_PAGES to MV_PAGES.
|
||||
|
||||
## {{P}}PRINT_JOB_PRICER
|
||||
- Public, final, public constructor without parameters.
|
||||
- Public types: TY_PAPER (character 4), TY_COLOR (character 1), TY_DEPT
|
||||
(character 4), TY_PRICE (packed number, length 8, 2 decimals).
|
||||
- Public method CALCULATE_PRICE with these parameters:
|
||||
- IMPORTING IV_PAGES TYPE I
|
||||
- IMPORTING IV_COPIES TYPE I
|
||||
- IMPORTING IV_PAPER TYPE TY_PAPER
|
||||
- IMPORTING IV_COLOR TYPE TY_COLOR
|
||||
- IMPORTING IV_DEPT TYPE TY_DEPT
|
||||
- RETURNING VALUE(RV_PRICE) TYPE TY_PRICE
|
||||
- RAISING {{P}}CX_PRINT_JOB_ERROR and {{P}}CX_PRINT_LIMIT
|
||||
- Do not add other public methods.
|
||||
|
||||
# 5. Business rules
|
||||
Apply the rules in this sequence.
|
||||
|
||||
1. Check the input in this order. Raise the exception of the first rule that
|
||||
fails.
|
||||
1. IV_PAGES is smaller than 1: raise {{P}}CX_PRINT_JOB_ERROR with the
|
||||
reason PAGES.
|
||||
2. IV_COPIES is smaller than 1: raise {{P}}CX_PRINT_JOB_ERROR with the
|
||||
reason COPIES.
|
||||
3. IV_PAPER is not 'A4', 'A3' or 'A5': raise {{P}}CX_PRINT_JOB_ERROR with
|
||||
the reason PAPER.
|
||||
4. IV_COLOR is not 'C' or 'M': raise {{P}}CX_PRINT_JOB_ERROR with the
|
||||
reason COLOR.
|
||||
5. IV_DEPT is not 'SALE', 'HR', 'IT' or 'PROD': raise
|
||||
{{P}}CX_PRINT_JOB_ERROR with the reason DEPT.
|
||||
2. The total number of pages is IV_PAGES multiplied by IV_COPIES.
|
||||
3. If the total number of pages is greater than 5000, raise
|
||||
{{P}}CX_PRINT_LIMIT with MV_PAGES equal to the total number of pages.
|
||||
4. The price of one page is 0.03 for A5, 0.05 for A4 and 0.09 for A3. For the
|
||||
color mode 'C', multiply the price of one page by 4.
|
||||
5. The gross price is the total number of pages multiplied by the price of one
|
||||
page.
|
||||
6. Volume discount on the gross price: 10 per cent if the total number of
|
||||
pages is 1000 or more, 5 per cent if the total number of pages is 500 or
|
||||
more, otherwise no discount.
|
||||
7. The net price is the gross price minus the discount.
|
||||
8. If the net price is smaller than 1.00, the price is 1.00 (minimum charge).
|
||||
9. Return the price.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: SAP_BASIS 8.16.
|
||||
- Coding standards: Clean ABAP. Method length below 40 statements. No global
|
||||
variables. No comment that restates the code.
|
||||
- Out of scope: no database table, no report, no function module, no CDS view.
|
||||
|
||||
# 7. Acceptance
|
||||
- The three classes are active and have no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write your own ABAP Unit tests for {{P}}PRINT_JOB_PRICER.
|
||||
Reference in New Issue
Block a user