Snapshot: new training tasks (balanced generation), docs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
76
tasks_gen/train/G1956/spec.md
Normal file
76
tasks_gen/train/G1956/spec.md
Normal file
@@ -0,0 +1,76 @@
|
||||
# 1. Goal
|
||||
Define the interface {{P}}IF_COBBLER in package $TMP. A cobbler's workshop
|
||||
repairs shoes. The order desk takes the repair orders and the pricing engine
|
||||
prices them. The interface is the contract between the order desk and the
|
||||
pricing engine. The interface carries the service codes, the reason codes,
|
||||
the price parameters and the two methods CHECK and PRICE.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The interface {{P}}IF_COBBLER does not exist yet. Create it in package $TMP.
|
||||
- One repair order covers one service and one number of pairs of shoes.
|
||||
- The method CHECK tells the order desk whether an order can be priced. It
|
||||
returns C_REASON-SERVICE if the service of the order is not one of the four
|
||||
codes of C_SERVICE. It returns C_REASON-PAIRS if the number of pairs is less
|
||||
than 1 or greater than C_RULE-MAX_PAIRS. Else it returns C_REASON-OK.
|
||||
- The method PRICE calculates the price of an order in euro. It multiplies the
|
||||
base price of the service with the number of pairs, adds
|
||||
C_RULE-EXPRESS_PERCENT percent if EXPRESS is true, subtracts
|
||||
C_RULE-MEMBER_PERCENT percent if MEMBER is true, rounds the result to full
|
||||
10 cents (5 cents round up) and never returns less than C_RULE-MIN_ORDER.
|
||||
- The workshop keeps the service codes and the price parameters in the
|
||||
interface, so that the order desk and the pricing engine use the same values.
|
||||
- The pricing engine that implements the interface is not part of this task.
|
||||
- No database table, no CDS view, no function module and no report is needed.
|
||||
|
||||
# 4. Contract
|
||||
- Create the interface {{P}}IF_COBBLER in package $TMP.
|
||||
- The interface is public.
|
||||
- The interface has the types, the constants and the methods of section 5 and
|
||||
nothing else.
|
||||
|
||||
# 5. Business rules
|
||||
1. The interface has exactly two methods: CHECK and PRICE.
|
||||
2. TY_REASON is a text field of length 10.
|
||||
3. TY_SERVICE is a text field of length 4.
|
||||
4. TY_AMOUNT is a packed number of length 8 with 2 decimal places.
|
||||
5. TY_ORDER is a structure with exactly four components in this order: SERVICE
|
||||
of type TY_SERVICE, PAIRS of type i, EXPRESS of type abap_bool and MEMBER
|
||||
of type abap_bool.
|
||||
6. C_SERVICE holds the four service codes of the workshop. The components, the
|
||||
types and the values are: HEEL of type TY_SERVICE = 'HEEL' (heel
|
||||
replacement), SOLE of type TY_SERVICE = 'SOLE' (full sole), SEAM of type
|
||||
TY_SERVICE = 'SEAM' (seam repair) and POLISH of type TY_SERVICE = 'POLI'
|
||||
(clean and polish).
|
||||
7. C_REASON holds the three reason codes of the check. The components, the
|
||||
types and the values are: OK of type TY_REASON = 'OK', SERVICE of type
|
||||
TY_REASON = 'SERVICE' and PAIRS of type TY_REASON = 'PAIRS'.
|
||||
8. C_RULE holds the price parameters. The components, the types and the values
|
||||
are: MAX_PAIRS of type i = 12, EXPRESS_PERCENT of type i = 40,
|
||||
MEMBER_PERCENT of type i = 10 and MIN_ORDER of type TY_AMOUNT = 8.00.
|
||||
9. C_BASE_PRICE holds the price of one pair of shoes for each service. The
|
||||
components, the types and the values are: HEEL of type TY_AMOUNT = 12.50,
|
||||
SOLE of type TY_AMOUNT = 25.00, SEAM of type TY_AMOUNT = 8.00 and POLISH of
|
||||
type TY_AMOUNT = 6.50.
|
||||
10. The method CHECK has the importing parameter IS_ORDER of type TY_ORDER and
|
||||
the returning parameter RV_REASON of type TY_REASON.
|
||||
11. The method PRICE has the importing parameter IS_ORDER of type TY_ORDER and
|
||||
the returning parameter RV_PRICE of type TY_AMOUNT.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
|
||||
- Coding standards: Clean ABAP. Names as in section 5. No obsolete syntax.
|
||||
- Out of scope: a class that implements the interface, a database table, a CDS
|
||||
view, a function module and a report.
|
||||
|
||||
# 7. Acceptance
|
||||
- The interface is active and has no syntax error.
|
||||
- The interface has exactly the types, the constants and the methods of
|
||||
section 5.
|
||||
- Write your own ABAP Unit tests in the global test class {{P}}COBBLER_TEST in
|
||||
package $TMP. The class is public, final and it is a test class
|
||||
(FOR TESTING DURATION SHORT RISK LEVEL HARMLESS). Test the constants, the
|
||||
type lengths and the method signatures of {{P}}IF_COBBLER.
|
||||
- The hidden tests pass.
|
||||
Reference in New Issue
Block a user