Generator: pilot analysis and fixes; G0002-G0021 tasks; handover notes merged
- Static bundle checks (name length, seed type, reserved words, contract test classes, testclasses_file), local abaplint parser check before SAP, max_tokens, robust JSON parse - Runner: G2 for CDS views with parameters, contract_check detail in report - G0020 and G0013 fixed by review and revalidated (oracle 100, null 0) - Pilot results in docs/faz1-tasarim.md 11e; handover notes merged into CLAUDE.md and docs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
103
tasks_gen/eval/G0005/spec.md
Normal file
103
tasks_gen/eval/G0005/spec.md
Normal file
@@ -0,0 +1,103 @@
|
||||
# 1. Goal
|
||||
A parcel service calculates the freight cost of a parcel from a zone code and a
|
||||
weight. Each rejected input must be reported as its own class-based exception, so
|
||||
that the calling program can react to the exact reason.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The class {{P}}ZONE_MASTER exists in package $TMP and is active. It provides the
|
||||
zone master data. Do not change it.
|
||||
- {{P}}ZONE_MASTER has these public components:
|
||||
- TYPES TY_ZONE with the components ZONE_CODE (c LENGTH 4), COUNTRY (c LENGTH 2),
|
||||
BASE_FEE (p LENGTH 15 DECIMALS 2), PRICE_PER_KG (p LENGTH 15 DECIMALS 2),
|
||||
MAX_WEIGHT_KG (i), CURRENCY (c LENGTH 5).
|
||||
- TYPES TT_ZONE, a sorted table of TY_ZONE with the unique key ZONE_CODE.
|
||||
- CLASS-METHOD GET_ALL returning the table TT_ZONE.
|
||||
- The zone master data contains these entries:
|
||||
|
||||
| ZONE_CODE | COUNTRY | BASE_FEE | PRICE_PER_KG | MAX_WEIGHT_KG | CURRENCY |
|
||||
| --------- | ------- | -------- | ------------ | ------------- | -------- |
|
||||
| DE01 | DE | 5.00 | 1.20 | 31 | EUR |
|
||||
| DE02 | DE | 8.00 | 1.80 | 31 | EUR |
|
||||
| FR01 | FR | 9.50 | 2.10 | 30 | EUR |
|
||||
| US01 | US | 14.00 | 3.40 | 25 | USD |
|
||||
| CN01 | CN | 18.00 | 4.25 | 20 | CNY |
|
||||
|
||||
# 4. Contract
|
||||
Create these classes in package $TMP.
|
||||
|
||||
{{P}}CX_FREIGHT_ERROR
|
||||
- public, abstract, inherits from CX_STATIC_CHECK.
|
||||
- public attribute MV_ZONE_CODE type c LENGTH 4.
|
||||
- public method GET_REASON_TEXT returning VALUE(rv_text) type string.
|
||||
|
||||
{{P}}CX_UNKNOWN_ZONE
|
||||
- public, inherits from {{P}}CX_FREIGHT_ERROR.
|
||||
|
||||
{{P}}CX_INVALID_WEIGHT
|
||||
- public, inherits from {{P}}CX_FREIGHT_ERROR.
|
||||
- public attribute MV_WEIGHT_KG type p LENGTH 15 DECIMALS 3.
|
||||
|
||||
{{P}}CX_WEIGHT_LIMIT
|
||||
- public, inherits from {{P}}CX_FREIGHT_ERROR.
|
||||
- public attribute MV_WEIGHT_KG type p LENGTH 15 DECIMALS 3.
|
||||
- public attribute MV_MAX_WEIGHT_KG type i.
|
||||
|
||||
GET_REASON_TEXT returns the reason text of the exception. Each of the three
|
||||
concrete exception classes returns its own text, see the business rules.
|
||||
|
||||
{{P}}FREIGHT_CALC
|
||||
- public, final, create public, constructor without parameters.
|
||||
- public type TY_COST (p LENGTH 15 DECIMALS 2).
|
||||
- public type TY_WEIGHT (p LENGTH 15 DECIMALS 3).
|
||||
- public type TY_RESULT with the components COST (type TY_COST) and CURRENCY
|
||||
(c LENGTH 5).
|
||||
- public method CALCULATE:
|
||||
|
||||
IMPORTING iv_zone_code TYPE c LENGTH 4
|
||||
iv_weight_kg TYPE ty_weight
|
||||
iv_express TYPE abap_bool DEFAULT abap_false
|
||||
RETURNING VALUE(rs_result) TYPE ty_result
|
||||
RAISING {{p}}cx_freight_error
|
||||
|
||||
- no other public methods.
|
||||
|
||||
Use the named types of this contract in the method interfaces. Do not write the
|
||||
additions LENGTH or DECIMALS in a method interface.
|
||||
|
||||
# 5. Business rules
|
||||
CALCULATE applies these rules in this sequence.
|
||||
1. Convert the zone code to upper case. Use this value in all further steps and in
|
||||
the attribute MV_ZONE_CODE of every exception.
|
||||
2. If the weight is less than or equal to zero, raise {{P}}CX_INVALID_WEIGHT. Set
|
||||
MV_ZONE_CODE to the zone code and MV_WEIGHT_KG to the given weight.
|
||||
3. Read the zone master data with {{P}}ZONE_MASTER=>GET_ALL and find the entry
|
||||
whose ZONE_CODE equals the zone code. If there is no such entry, raise
|
||||
{{P}}CX_UNKNOWN_ZONE and set MV_ZONE_CODE to the zone code.
|
||||
4. If the weight is greater than MAX_WEIGHT_KG, raise {{P}}CX_WEIGHT_LIMIT. Set
|
||||
MV_ZONE_CODE to the zone code, MV_WEIGHT_KG to the given weight and
|
||||
MV_MAX_WEIGHT_KG to MAX_WEIGHT_KG.
|
||||
5. Calculate the cost as BASE_FEE + weight x PRICE_PER_KG.
|
||||
6. If IV_EXPRESS is ABAP_TRUE, multiply the cost by 1.5.
|
||||
7. Keep the full precision of the cost until this step. Do not round the cost
|
||||
before this step. Round the cost to 2 decimal places with commercial rounding.
|
||||
8. If the rounded cost is less than 6.00, use 6.00.
|
||||
9. Return the cost in COST and the CURRENCY of the zone in CURRENCY.
|
||||
|
||||
GET_REASON_TEXT returns:
|
||||
- in {{P}}CX_UNKNOWN_ZONE: 'Zone ', then the zone code, then ' is not known'.
|
||||
Example: 'Zone XX99 is not known'.
|
||||
- in {{P}}CX_INVALID_WEIGHT: 'Weight must be greater than zero'.
|
||||
- in {{P}}CX_WEIGHT_LIMIT: 'Weight exceeds the zone limit'.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
|
||||
- Coding standards: Clean ABAP. Methods below 40 statements. No global variables.
|
||||
- Out of scope: do not change {{P}}ZONE_MASTER.
|
||||
|
||||
# 7. Acceptance
|
||||
- All classes are active and have no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write your own ABAP Unit tests for {{P}}FREIGHT_CALC.
|
||||
Reference in New Issue
Block a user