Step F first pass: 81/92 accepted; budget floor 60 calls; rejected slots moved for regeneration
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
73
tasks_gen/eval/G0131/spec.md
Normal file
73
tasks_gen/eval/G0131/spec.md
Normal file
@@ -0,0 +1,73 @@
|
||||
# 1. Goal
|
||||
A driving school checks if a pupil may book a practical driving test. A booking
|
||||
program calls the check before it books the test. When the pupil is not ready,
|
||||
the check must tell the program the exact reason.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The table {{P}}PUPIL exists in package $TMP. It is active.
|
||||
- The table has these fields: CLIENT, PUPIL_ID (character 10), PUPIL_NAME
|
||||
(character 40), THEORY_DONE (character 1), LESSONS_DONE (integer), FEE_PAID
|
||||
(character 1), LAST_FAILED (date).
|
||||
- THEORY_DONE and FEE_PAID contain 'X' when the item is done. They are initial
|
||||
when the item is not done.
|
||||
- LESSONS_DONE is the number of driving lessons that the pupil completed.
|
||||
- LAST_FAILED is the date of the last failed practical test. It is initial when
|
||||
the pupil never failed a test.
|
||||
- The class {{P}}PUPIL_DATA fills the table with example data. It is active.
|
||||
|
||||
# 4. Contract
|
||||
Create the class {{P}}DRIVING_TEST_CHECK in package $TMP.
|
||||
- The class is public, final, and has a public constructor without parameters.
|
||||
- Define these types in the public section of the class:
|
||||
TYPES ty_pupil_id TYPE c LENGTH 10.
|
||||
TYPES ty_date TYPE d.
|
||||
- The class has this public method and no other public method:
|
||||
METHODS check
|
||||
IMPORTING iv_pupil_id TYPE ty_pupil_id
|
||||
iv_test_date TYPE ty_date
|
||||
RAISING {{P}}CX_PUPIL_UNKNOWN
|
||||
{{P}}CX_THEORY_MISSING
|
||||
{{P}}CX_LESSONS_MISSING
|
||||
{{P}}CX_FEE_UNPAID
|
||||
{{P}}CX_RECENT_FAILURE.
|
||||
- Create these exception classes in package $TMP. Each class is public and
|
||||
inherits from CX_STATIC_CHECK.
|
||||
- {{P}}CX_PUPIL_UNKNOWN: no constructor parameter.
|
||||
- {{P}}CX_THEORY_MISSING: no constructor parameter.
|
||||
- {{P}}CX_LESSONS_MISSING: constructor parameter IV_MISSING TYPE i. The
|
||||
public read-only attribute MV_MISSING TYPE i has the value of IV_MISSING.
|
||||
- {{P}}CX_FEE_UNPAID: no constructor parameter.
|
||||
- {{P}}CX_RECENT_FAILURE: constructor parameter IV_DAYS_LEFT TYPE i. The
|
||||
public read-only attribute MV_DAYS_LEFT TYPE i has the value of
|
||||
IV_DAYS_LEFT.
|
||||
- Do not add other public methods or attributes to these classes.
|
||||
|
||||
# 5. Business rules
|
||||
The method CHECK reads the pupil with the pupil id IV_PUPIL_ID from the table
|
||||
{{P}}PUPIL. Apply these rules in this sequence. Raise the exception of the
|
||||
first rule that fails. Raise no exception when all rules pass.
|
||||
1. If the table has no entry for this pupil id, raise {{P}}CX_PUPIL_UNKNOWN.
|
||||
2. If THEORY_DONE is not 'X', raise {{P}}CX_THEORY_MISSING.
|
||||
3. If LESSONS_DONE is less than 12, raise {{P}}CX_LESSONS_MISSING with
|
||||
IV_MISSING = 12 - LESSONS_DONE.
|
||||
4. If FEE_PAID is not 'X', raise {{P}}CX_FEE_UNPAID.
|
||||
5. If LAST_FAILED is not initial, calculate the number of days from LAST_FAILED
|
||||
to IV_TEST_DATE. If this number is less than 14, raise
|
||||
{{P}}CX_RECENT_FAILURE with IV_DAYS_LEFT = 14 - number of days.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16.
|
||||
- Coding standards: Clean ABAP. Methods below 40 statements. No global
|
||||
variables. Pass large parameters by reference. No comment that restates the
|
||||
code.
|
||||
- A test must not pass when the method under test raises an exception that the
|
||||
test does not expect.
|
||||
- Out of scope: do not change {{P}}PUPIL and {{P}}PUPIL_DATA.
|
||||
|
||||
# 7. Acceptance
|
||||
- All classes are active and have no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write your own ABAP Unit tests for the class {{P}}DRIVING_TEST_CHECK.
|
||||
Reference in New Issue
Block a user