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/G0122/spec.md
Normal file
85
tasks_gen/eval/G0122/spec.md
Normal file
@@ -0,0 +1,85 @@
|
||||
# 1. Goal
|
||||
|
||||
A bike-sharing operator moves bikes between its stations. A background job
|
||||
calls one function module to apply the planned moves of the operator. The
|
||||
function module reads the planned moves and the current state of the stations
|
||||
from the database, applies the moves, and writes the new state of the stations
|
||||
back to the database. The function module returns the number of applied moves
|
||||
and the number of rejected moves.
|
||||
|
||||
# 2. Open questions
|
||||
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
|
||||
- Function group {{P}}FG_BIKE exists in package $TMP.
|
||||
- Table {{P}}STATION exists in package $TMP. It holds the current state of the
|
||||
stations of the operator. The table is client-dependent.
|
||||
- Table {{P}}MOVE exists in package $TMP. It holds the planned moves. The table
|
||||
is client-dependent.
|
||||
- The station IDs in {{P}}STATION are unique. The move numbers in {{P}}MOVE are
|
||||
unique.
|
||||
- The function module reads and changes the two tables. It works on the data of
|
||||
the current client.
|
||||
|
||||
# 4. Contract
|
||||
|
||||
Function module {{P}}BIKE_REBALANCE in the function group {{P}}FG_BIKE:
|
||||
|
||||
IMPORTING
|
||||
iv_dry_run TYPE abap_bool
|
||||
EXPORTING
|
||||
ev_applied TYPE i
|
||||
ev_rejected TYPE i
|
||||
|
||||
Table {{P}}STATION:
|
||||
|
||||
client (key)
|
||||
station_id (key) TYPE c LENGTH 6
|
||||
station_name TYPE c LENGTH 30
|
||||
capacity TYPE i
|
||||
bikes TYPE i
|
||||
|
||||
Table {{P}}MOVE:
|
||||
|
||||
client (key)
|
||||
move_no (key) TYPE i
|
||||
source_id TYPE c LENGTH 6
|
||||
target_id TYPE c LENGTH 6
|
||||
quantity TYPE i
|
||||
|
||||
# 5. Business rules
|
||||
|
||||
1. Read all rows of {{P}}STATION and all rows of {{P}}MOVE.
|
||||
2. Apply the moves in ascending order of move_no. Do not apply them in the
|
||||
order of the table.
|
||||
3. A move is rejected if at least one of these conditions is true:
|
||||
- quantity is less than or equal to 0;
|
||||
- source_id and target_id are equal;
|
||||
- source_id is not the ID of a station in {{P}}STATION;
|
||||
- target_id is not the ID of a station in {{P}}STATION;
|
||||
- the source station has fewer bikes than quantity;
|
||||
- the target station has fewer free docks than quantity. The free docks of
|
||||
a station are capacity minus bikes.
|
||||
4. A rejected move does not change any station.
|
||||
5. An accepted move subtracts quantity from the bikes of the source station
|
||||
and adds quantity to the bikes of the target station.
|
||||
6. After the last move, the function module writes the new bikes value of the
|
||||
stations back to {{P}}STATION. station_name and capacity do not change.
|
||||
7. If iv_dry_run is true, the function module does not change {{P}}STATION.
|
||||
8. ev_applied is the number of accepted moves. ev_rejected is the number of
|
||||
rejected moves. Both numbers are also returned if iv_dry_run is true.
|
||||
|
||||
# 6. Constraints
|
||||
|
||||
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
|
||||
- Package: $TMP. Do not create a transport request.
|
||||
- Clean ABAP. Keep the function module and every method below 40 statements.
|
||||
- Out of scope: do not change {{P}}STATION, {{P}}MOVE and {{P}}SEED_BIKE.
|
||||
|
||||
# 7. Acceptance
|
||||
|
||||
- The function module is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write ABAP Unit tests for the function module in a global test class.
|
||||
Reference in New Issue
Block a user