Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
58
tasks_gen/train/G1113/spec.md
Normal file
58
tasks_gen/train/G1113/spec.md
Normal file
@@ -0,0 +1,58 @@
|
||||
# 1. Goal
|
||||
A blood donation centre summarises the donations of one collection day. The
|
||||
centre calls one function module for each collection day. The function module
|
||||
groups the donations by donor and blood group and gives the total units of each
|
||||
group.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Function group {{P}}FG_DON exists in package $TMP.
|
||||
- The collection team records the donations of one day on a handheld device.
|
||||
The device sends the donations of the day as one text.
|
||||
- Each donation is one line of the text. A line has three fields that are
|
||||
separated by a semicolon (;):
|
||||
- field 1: the donor id, without blanks
|
||||
- field 2: the blood group code, without blanks
|
||||
- field 3: the units, a decimal number without leading zeros
|
||||
- The lines of the text are separated by the newline character
|
||||
(cl_abap_char_utilities=>newline). The text does not end with a newline.
|
||||
- Function module {{P}}DON_SAMPLE exists in the group. It shows how the text of
|
||||
one day is split into lines.
|
||||
|
||||
# 4. Contract
|
||||
- Create the function module {{P}}DON_SUM in function group {{P}}FG_DON.
|
||||
- Use this interface:
|
||||
- IMPORTING iv_donations TYPE string
|
||||
- EXPORTING ev_donor_count TYPE i
|
||||
- CHANGING cv_totals TYPE string
|
||||
- EXCEPTIONS invalid_units
|
||||
|
||||
# 5. Business rules
|
||||
1. A donation is not valid if its units are less than 1. If the text contains a
|
||||
donation that is not valid, raise the exception INVALID_UNITS. In this case,
|
||||
do not change cv_totals.
|
||||
2. Group the donations by donor id and blood group code. The total units of a
|
||||
group is the sum of the units of all donations of the group.
|
||||
3. Compare blood group codes without regard to case. Write the blood group code
|
||||
in the result in upper case.
|
||||
4. cv_totals has exactly one line for each group. Replace the content of
|
||||
cv_totals. Do not append to the old content.
|
||||
5. A line of cv_totals has the same layout as a line of the input text: donor
|
||||
id, semicolon, blood group code, semicolon, total units. The total units have
|
||||
no leading zeros. The lines are sorted by donor id in ascending order and
|
||||
then by blood group code in ascending order. The lines are separated by the
|
||||
newline character. The text does not end with a newline.
|
||||
6. ev_donor_count is the number of different donor id values in the text.
|
||||
7. If the text is empty, cv_totals is empty and ev_donor_count is 0.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16.
|
||||
- Coding standard: Clean ABAP. Methods have less than 40 statements.
|
||||
- Out of scope: do not change {{P}}DON_SAMPLE.
|
||||
|
||||
# 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