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:
63
tasks_gen/eval/G0009/spec.md
Normal file
63
tasks_gen/eval/G0009/spec.md
Normal file
@@ -0,0 +1,63 @@
|
||||
# 1. Goal
|
||||
Calculate the shipping cost of a parcel. A webshop calls the calculation before
|
||||
it shows the total price to the customer. The cost depends on the weight of the
|
||||
parcel and on an express flag. The class that the webshop uses today returns
|
||||
wrong costs. A corrected class must replace it.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The interface {{P}}IF_SHIPPING_COST exists in package $TMP. It is active.
|
||||
- The interface contains the types TY_WEIGHT (packed, 3 decimals) and TY_AMOUNT
|
||||
(packed, 2 decimals), the constant structure C_RATE, and one method:
|
||||
CALCULATE IMPORTING iv_weight TYPE ty_weight, iv_express TYPE abap_bool
|
||||
RETURNING VALUE(rv_cost) TYPE ty_amount.
|
||||
- C_RATE has the components MIN_CHARGE (6.00), EXPRESS_PERCENT (35),
|
||||
BULK_WEIGHT (31.500), and BULK_STEP (0.65).
|
||||
- The class {{P}}SHIPPING_COST_LEGACY exists in package $TMP. It is active and
|
||||
it implements the interface, but the calculated costs are wrong.
|
||||
- Reported symptoms of {{P}}SHIPPING_COST_LEGACY:
|
||||
1. A parcel with a weight that is exactly on a weight limit is charged with
|
||||
the rate of the next weight limit.
|
||||
2. A parcel that is heavier than C_RATE-BULK_WEIGHT is charged as if its
|
||||
weight were exactly C_RATE-BULK_WEIGHT.
|
||||
3. An express parcel that is lighter than the minimum charge gets a total
|
||||
that is too high.
|
||||
|
||||
# 4. Contract
|
||||
- Create the class {{P}}SHIPPING_COST_CALC in package $TMP.
|
||||
- The class is public and final and has a public constructor without parameters.
|
||||
- The class implements {{P}}IF_SHIPPING_COST.
|
||||
- Do not add other public methods.
|
||||
- Do not change {{P}}IF_SHIPPING_COST and {{P}}SHIPPING_COST_LEGACY.
|
||||
|
||||
# 5. Business rules
|
||||
Apply the rules in this sequence.
|
||||
1. If iv_weight is zero or negative, the cost is 0. Stop.
|
||||
2. Else calculate the base rate from the weight:
|
||||
- weight up to and including 1.000 kg: 4.90
|
||||
- weight up to and including 5.000 kg: 8.50
|
||||
- weight up to and including 10.000 kg: 12.00
|
||||
- weight up to and including 31.500 kg: 18.75
|
||||
- weight above 31.500 kg: 18.75 plus 0.65 for each started kilogram above
|
||||
31.500 kg. A started kilogram is a kilogram that is not complete.
|
||||
Example: 31.501 kg is 0.001 kg above 31.500 kg, so there is one started
|
||||
kilogram. 33.000 kg is 1.500 kg above 31.500 kg, so there are two started
|
||||
kilograms.
|
||||
3. If iv_express is abap_true, add 35 percent of the base rate to the base rate.
|
||||
Round this surcharge to 2 decimals. Round a half away from zero.
|
||||
4. If the result is below 6.00, the result is 6.00.
|
||||
5. The result has 2 decimals.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 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}}IF_SHIPPING_COST and
|
||||
{{P}}SHIPPING_COST_LEGACY.
|
||||
|
||||
# 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