Harness: runner, generator, tasks T01 T13 T14 T15, CLAUDE.md
This commit is contained in:
25
tasks_gen/eval/G0002/generation.json
Normal file
25
tasks_gen/eval/G0002/generation.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"id": "G0002",
|
||||
"pool": "eval",
|
||||
"object_type": "CLAS",
|
||||
"category": "A",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 0,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"invalid JSON: Extra data: line 1 column 14723 (char 14722)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
132
tasks_gen/eval/G0002/hidden/t02_hidden.clas.abap
Normal file
132
tasks_gen/eval/G0002/hidden/t02_hidden.clas.abap
Normal file
@@ -0,0 +1,132 @@
|
||||
CLASS {{p}}t02_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_fri_05 TYPE d VALUE '20240105',
|
||||
c_sat_06 TYPE d VALUE '20240106',
|
||||
c_sun_07 TYPE d VALUE '20240107',
|
||||
c_mon_08 TYPE d VALUE '20240108',
|
||||
c_tue_09 TYPE d VALUE '20240109',
|
||||
c_wed_10 TYPE d VALUE '20240110',
|
||||
c_thu_11 TYPE d VALUE '20240111',
|
||||
c_fri_12 TYPE d VALUE '20240112'.
|
||||
|
||||
DATA mo_cut TYPE REF TO {{p}}delivery_schedule.
|
||||
DATA mt_holidays TYPE {{p}}delivery_schedule=>ty_holidays.
|
||||
DATA mt_no_holidays TYPE {{p}}delivery_schedule=>ty_holidays.
|
||||
|
||||
METHODS setup.
|
||||
METHODS weekend_is_not_working FOR TESTING.
|
||||
METHODS working_day_is_true FOR TESTING.
|
||||
METHODS holiday_is_not_working FOR TESTING.
|
||||
METHODS next_day_same_for_workday FOR TESTING.
|
||||
METHODS next_day_from_weekend FOR TESTING.
|
||||
METHODS next_day_skips_holidays FOR TESTING.
|
||||
METHODS add_zero_days FOR TESTING.
|
||||
METHODS add_days_forward FOR TESTING.
|
||||
METHODS add_forward_skips_holiday FOR TESTING.
|
||||
METHODS add_days_backward FOR TESTING.
|
||||
METHODS count_working_days_inclusive FOR TESTING.
|
||||
METHODS count_reversed_range_is_zero FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t02_hidden IMPLEMENTATION.
|
||||
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}delivery_schedule( ).
|
||||
mt_holidays = VALUE #( ( c_tue_09 ) ( c_wed_10 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD weekend_is_not_working.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = abap_false
|
||||
act = mo_cut->is_working_day( iv_date = c_sat_06 it_holidays = mt_no_holidays )
|
||||
msg = 'Saturday is not a working day' ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = abap_false
|
||||
act = mo_cut->is_working_day( iv_date = c_sun_07 it_holidays = mt_no_holidays )
|
||||
msg = 'Sunday is not a working day' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD working_day_is_true.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = abap_true
|
||||
act = mo_cut->is_working_day( iv_date = c_mon_08 it_holidays = mt_holidays ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD holiday_is_not_working.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = abap_false
|
||||
act = mo_cut->is_working_day( iv_date = c_tue_09 it_holidays = mt_holidays ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD next_day_same_for_workday.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_mon_08
|
||||
act = mo_cut->next_working_day( iv_date = c_mon_08 it_holidays = mt_holidays ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD next_day_from_weekend.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_mon_08
|
||||
act = mo_cut->next_working_day( iv_date = c_sat_06 it_holidays = mt_no_holidays ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD next_day_skips_holidays.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_thu_11
|
||||
act = mo_cut->next_working_day( iv_date = c_tue_09 it_holidays = mt_holidays ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD add_zero_days.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_sat_06
|
||||
act = mo_cut->add_working_days( iv_start = c_sat_06 iv_days = 0 it_holidays = mt_holidays ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD add_days_forward.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_tue_09
|
||||
act = mo_cut->add_working_days( iv_start = c_fri_05 iv_days = 2 it_holidays = mt_no_holidays ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD add_forward_skips_holiday.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_thu_11
|
||||
act = mo_cut->add_working_days( iv_start = c_fri_05 iv_days = 2 it_holidays = mt_holidays ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD add_days_backward.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_fri_05
|
||||
act = mo_cut->add_working_days( iv_start = c_mon_08 iv_days = -1 it_holidays = mt_no_holidays ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD count_working_days_inclusive.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 5
|
||||
act = mo_cut->count_working_days( iv_from = c_mon_08 iv_to = c_fri_12 it_holidays = mt_no_holidays )
|
||||
msg = 'Monday to Friday without holidays' ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 3
|
||||
act = mo_cut->count_working_days( iv_from = c_mon_08 iv_to = c_fri_12 it_holidays = mt_holidays )
|
||||
msg = 'Two holidays in the interval' ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 1
|
||||
act = mo_cut->count_working_days( iv_from = c_mon_08 iv_to = c_mon_08 it_holidays = mt_no_holidays )
|
||||
msg = 'One working day' ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 0
|
||||
act = mo_cut->count_working_days( iv_from = c_tue_09 iv_to = c_tue_09 it_holidays = mt_holidays )
|
||||
msg = 'One holiday' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD count_reversed_range_is_zero.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 0
|
||||
act = mo_cut->count_working_days( iv_from = c_fri_12 iv_to = c_mon_08 it_holidays = mt_holidays ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
104
tasks_gen/eval/G0002/reference/delivery_schedule.clas.abap
Normal file
104
tasks_gen/eval/G0002/reference/delivery_schedule.clas.abap
Normal file
@@ -0,0 +1,104 @@
|
||||
CLASS {{p}}delivery_schedule DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
||||
TYPES ty_holidays TYPE STANDARD TABLE OF d WITH EMPTY KEY.
|
||||
|
||||
METHODS is_working_day
|
||||
IMPORTING iv_date TYPE d
|
||||
it_holidays TYPE ty_holidays
|
||||
RETURNING VALUE(rv_working) TYPE abap_bool.
|
||||
|
||||
METHODS next_working_day
|
||||
IMPORTING iv_date TYPE d
|
||||
it_holidays TYPE ty_holidays
|
||||
RETURNING VALUE(rv_date) TYPE d.
|
||||
|
||||
METHODS add_working_days
|
||||
IMPORTING iv_start TYPE d
|
||||
iv_days TYPE i
|
||||
it_holidays TYPE ty_holidays
|
||||
RETURNING VALUE(rv_date) TYPE d.
|
||||
|
||||
METHODS count_working_days
|
||||
IMPORTING iv_from TYPE d
|
||||
iv_to TYPE d
|
||||
it_holidays TYPE ty_holidays
|
||||
RETURNING VALUE(rv_count) TYPE i.
|
||||
|
||||
PRIVATE SECTION.
|
||||
|
||||
CONSTANTS c_reference_monday TYPE d VALUE '19000101'.
|
||||
|
||||
METHODS is_weekend
|
||||
IMPORTING iv_date TYPE d
|
||||
RETURNING VALUE(rv_weekend) TYPE abap_bool.
|
||||
|
||||
METHODS is_holiday
|
||||
IMPORTING iv_date TYPE d
|
||||
it_holidays TYPE ty_holidays
|
||||
RETURNING VALUE(rv_holiday) TYPE abap_bool.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}delivery_schedule IMPLEMENTATION.
|
||||
|
||||
METHOD is_working_day.
|
||||
rv_working = xsdbool( is_weekend( iv_date ) = abap_false
|
||||
AND is_holiday( iv_date = iv_date
|
||||
it_holidays = it_holidays ) = abap_false ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD next_working_day.
|
||||
rv_date = iv_date.
|
||||
WHILE is_working_day( iv_date = rv_date
|
||||
it_holidays = it_holidays ) = abap_false.
|
||||
rv_date = rv_date + 1.
|
||||
ENDWHILE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD add_working_days.
|
||||
rv_date = iv_start.
|
||||
IF iv_days = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA(lv_remaining) = iv_days.
|
||||
DATA(lv_step) = COND i( WHEN iv_days > 0 THEN 1 ELSE -1 ).
|
||||
WHILE lv_remaining <> 0.
|
||||
rv_date = rv_date + lv_step.
|
||||
IF is_working_day( iv_date = rv_date
|
||||
it_holidays = it_holidays ) = abap_true.
|
||||
lv_remaining = lv_remaining - lv_step.
|
||||
ENDIF.
|
||||
ENDWHILE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD count_working_days.
|
||||
rv_count = 0.
|
||||
DATA(lv_date) = iv_from.
|
||||
WHILE lv_date <= iv_to.
|
||||
IF is_working_day( iv_date = lv_date
|
||||
it_holidays = it_holidays ) = abap_true.
|
||||
rv_count = rv_count + 1.
|
||||
ENDIF.
|
||||
lv_date = lv_date + 1.
|
||||
ENDWHILE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD is_weekend.
|
||||
DATA(lv_days) = iv_date - c_reference_monday.
|
||||
rv_weekend = xsdbool( lv_days MOD 7 >= 5 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD is_holiday.
|
||||
rv_holiday = abap_false.
|
||||
LOOP AT it_holidays INTO DATA(lv_holiday).
|
||||
IF lv_holiday = iv_date.
|
||||
rv_holiday = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
@@ -0,0 +1,72 @@
|
||||
CLASS ltc_delivery_schedule DEFINITION FINAL FOR TESTING
|
||||
DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_fri_05 TYPE d VALUE '20240105',
|
||||
c_sat_06 TYPE d VALUE '20240106',
|
||||
c_sun_07 TYPE d VALUE '20240107',
|
||||
c_mon_08 TYPE d VALUE '20240108',
|
||||
c_tue_09 TYPE d VALUE '20240109',
|
||||
c_wed_10 TYPE d VALUE '20240110',
|
||||
c_thu_11 TYPE d VALUE '20240111',
|
||||
c_fri_12 TYPE d VALUE '20240112'.
|
||||
|
||||
DATA mo_cut TYPE REF TO {{p}}delivery_schedule.
|
||||
DATA mt_holidays TYPE {{p}}delivery_schedule=>ty_holidays.
|
||||
DATA mt_no_holidays TYPE {{p}}delivery_schedule=>ty_holidays.
|
||||
|
||||
METHODS setup.
|
||||
METHODS weekend_is_not_working FOR TESTING.
|
||||
METHODS holiday_is_not_working FOR TESTING.
|
||||
METHODS next_day_skips_weekend FOR TESTING.
|
||||
METHODS add_days_forward FOR TESTING.
|
||||
METHODS add_days_backward FOR TESTING.
|
||||
METHODS count_working_days FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_delivery_schedule IMPLEMENTATION.
|
||||
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}delivery_schedule( ).
|
||||
mt_holidays = VALUE #( ( c_tue_09 ) ( c_wed_10 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD weekend_is_not_working.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = abap_false
|
||||
act = mo_cut->is_working_day( iv_date = c_sat_06 it_holidays = mt_no_holidays ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD holiday_is_not_working.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = abap_false
|
||||
act = mo_cut->is_working_day( iv_date = c_tue_09 it_holidays = mt_holidays ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD next_day_skips_weekend.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_mon_08
|
||||
act = mo_cut->next_working_day( iv_date = c_sun_07 it_holidays = mt_holidays ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD add_days_forward.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_thu_11
|
||||
act = mo_cut->add_working_days( iv_start = c_fri_05 iv_days = 2 it_holidays = mt_holidays ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD add_days_backward.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = c_fri_05
|
||||
act = mo_cut->add_working_days( iv_start = c_mon_08 iv_days = -1 it_holidays = mt_holidays ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD count_working_days.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 3
|
||||
act = mo_cut->count_working_days( iv_from = c_mon_08 iv_to = c_fri_12 it_holidays = mt_holidays ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
84
tasks_gen/eval/G0002/spec.md
Normal file
84
tasks_gen/eval/G0002/spec.md
Normal file
@@ -0,0 +1,84 @@
|
||||
# 1. Goal
|
||||
Calculate delivery dates for sales orders. A delivery date must be a working day.
|
||||
Weekends and plant holidays are not working days. A planner uses the class before
|
||||
the system confirms a delivery date.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The class {{P}}DELIVERY_SCHEDULE does not exist. Create it in package $TMP.
|
||||
- The caller gives the plant holidays as a table of dates. The class does not read
|
||||
a factory calendar. The class does not read the system date.
|
||||
|
||||
# 4. Contract
|
||||
- Create the class {{P}}DELIVERY_SCHEDULE in package $TMP.
|
||||
- The class is public, final, and has a public constructor without parameters.
|
||||
- The class has the public type TY_HOLIDAYS. TY_HOLIDAYS is a standard table of
|
||||
dates (TYPE d) with an empty key.
|
||||
- The class has the public methods below. Do not add other public methods.
|
||||
|
||||
```abap
|
||||
METHODS is_working_day
|
||||
IMPORTING iv_date TYPE d
|
||||
it_holidays TYPE ty_holidays
|
||||
RETURNING VALUE(rv_working) TYPE abap_bool.
|
||||
|
||||
METHODS next_working_day
|
||||
IMPORTING iv_date TYPE d
|
||||
it_holidays TYPE ty_holidays
|
||||
RETURNING VALUE(rv_date) TYPE d.
|
||||
|
||||
METHODS add_working_days
|
||||
IMPORTING iv_start TYPE d
|
||||
iv_days TYPE i
|
||||
it_holidays TYPE ty_holidays
|
||||
RETURNING VALUE(rv_date) TYPE d.
|
||||
|
||||
METHODS count_working_days
|
||||
IMPORTING iv_from TYPE d
|
||||
iv_to TYPE d
|
||||
it_holidays TYPE ty_holidays
|
||||
RETURNING VALUE(rv_count) TYPE i.
|
||||
```
|
||||
|
||||
# 5. Business rules
|
||||
1. The days of the week are Monday, Tuesday, Wednesday, Thursday, Friday, Saturday,
|
||||
Sunday.
|
||||
2. A date is a working day when these two conditions are true:
|
||||
- The date is not a Saturday and not a Sunday.
|
||||
- The date is not in it_holidays.
|
||||
3. IS_WORKING_DAY returns abap_true for a working day. It returns abap_false for
|
||||
all other days.
|
||||
4. NEXT_WORKING_DAY returns the first working day that is on iv_date or after
|
||||
iv_date.
|
||||
5. ADD_WORKING_DAYS counts working days.
|
||||
- If iv_days is 0, the result is iv_start.
|
||||
- If iv_days is greater than 0, the result is the date that is iv_days working
|
||||
days after iv_start. Count only working days. Ignore all other days.
|
||||
- If iv_days is less than 0, the result is the date that is the absolute value
|
||||
of iv_days working days before iv_start. Count only working days. Ignore all
|
||||
other days.
|
||||
- Example: iv_start is a Friday and iv_days is 1. The result is the next Monday.
|
||||
- Example: iv_start is a Monday and iv_days is -1. The result is the Friday
|
||||
before.
|
||||
6. COUNT_WORKING_DAYS counts the working days in the interval from iv_from to
|
||||
iv_to. The interval contains iv_from and iv_to.
|
||||
- If iv_from is after iv_to, the result is 0.
|
||||
- If iv_from is equal to iv_to, the result is 1 for a working day and 0 for all
|
||||
other days.
|
||||
7. it_holidays can be empty. it_holidays can contain dates that are outside the
|
||||
interval. it_holidays can contain the same date more than one time. A date that
|
||||
occurs more than one time in it_holidays is a holiday.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16.
|
||||
- Coding standards: Clean ABAP. A method has less than 40 statements. No global
|
||||
variables. No comment that restates the code.
|
||||
- Out of scope: do not read a factory calendar. Do not read the system date. Do
|
||||
not create other objects.
|
||||
|
||||
# 7. Acceptance
|
||||
- The class is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write your own ABAP Unit tests for the class.
|
||||
41
tasks_gen/eval/G0002/task.json
Normal file
41
tasks_gen/eval/G0002/task.json
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"id": "G0002",
|
||||
"category": "A",
|
||||
"object_type": "CLAS",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 50,
|
||||
"max_activations": 12
|
||||
},
|
||||
"seed": [],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}DELIVERY_SCHEDULE"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T02_HIDDEN",
|
||||
"file": "hidden/t02_hidden.clas.abap",
|
||||
"description": "Working day and delivery date rules"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}DELIVERY_SCHEDULE",
|
||||
"file": "reference/delivery_schedule.clas.abap",
|
||||
"description": "Delivery date calculation with weekends and plant holidays",
|
||||
"testclasses_file": "reference/delivery_schedule.testclasses.abap"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"no_global_variables"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user