- generator: budget floor (2x oracle activations, 3x calls), static checks for CDS $parameters and UNION annotation - harness/mutation.py: deterministic mutants of the reference; hidden tests must fail - G0022 revalidated with harness fixes: oracle 100, null 0 - results in docs/faz1-tasarim.md 11f Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
70 lines
2.4 KiB
Markdown
70 lines
2.4 KiB
Markdown
# 1. Goal
|
|
|
|
A freight forwarder calculates the freight cost of a shipment. A legacy class
|
|
calculates this cost today. Write the calculation as a clean class. The cost of
|
|
every shipment must stay the same.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- The interface {{P}}IF_FREIGHT_CALC exists in package $TMP and is active.
|
|
- The legacy class {{P}}FREIGHT_LEGACY exists in package $TMP and is active. It
|
|
implements {{P}}IF_FREIGHT_CALC. Its results are the reference for the new class.
|
|
- The interface declares the types TY_ZONE (character, length 2), TY_WEIGHT
|
|
(packed number, length 9, 3 decimal places) and TY_AMOUNT (packed number,
|
|
length 7, 2 decimal places), and the method CALCULATE.
|
|
|
|
# 4. Contract
|
|
- Create the class {{P}}FREIGHT_CALCULATOR in package $TMP.
|
|
- The class is public, final, and has a public constructor without parameters.
|
|
- The class implements {{P}}IF_FREIGHT_CALC.
|
|
- Do not add other public methods.
|
|
|
|
# 5. Business rules
|
|
|
|
All amounts are packed numbers with 2 decimal places. Round an amount to
|
|
2 decimal places before you use it in the next step. Round half away from zero.
|
|
|
|
1. Zone
|
|
The zone is a two-character code. These zones exist:
|
|
|
|
zone base per kg minimum surcharge factor
|
|
DE 12.50 0.85 25.00 0.065
|
|
FR 15.00 1.10 30.00 0.075
|
|
NL 10.00 0.75 20.00 0.055
|
|
US 20.00 1.40 45.00 0.085
|
|
CN 25.00 1.25 50.00 0.095
|
|
|
|
If the zone is not one of these, the result is 0.00 and no other rule applies.
|
|
|
|
2. Weight charge
|
|
weight charge = weight * per kg of the zone, rounded to 2 decimal places.
|
|
|
|
3. Freight
|
|
freight = base of the zone + weight charge.
|
|
If freight is less than the minimum of the zone, freight is the minimum.
|
|
|
|
4. Surcharge
|
|
surcharge = freight * surcharge factor of the zone, rounded to 2 decimal places.
|
|
|
|
5. Total
|
|
total = freight + surcharge.
|
|
|
|
6. Heavy shipment
|
|
If the weight is greater than 1000.000 kg, total = total * 0.95, rounded to
|
|
2 decimal places.
|
|
|
|
7. The result is total.
|
|
|
|
# 6. Constraints
|
|
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
|
|
- Coding standards: Clean ABAP. Method length below 40 statements. No global
|
|
variables. No comment that restates the code.
|
|
- Out of scope: do not change {{P}}IF_FREIGHT_CALC and {{P}}FREIGHT_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.
|