Snapshot: new training tasks (balanced generation), docs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
49
tasks_gen/train/G1926/faulty/m0_if_kart_check.intf.abap
Normal file
49
tasks_gen/train/G1926/faulty/m0_if_kart_check.intf.abap
Normal file
@@ -0,0 +1,49 @@
|
||||
INTERFACE {{p}}if_kart_check PUBLIC.
|
||||
TYPES ty_reason TYPE c LENGTH 12.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_booking,
|
||||
driver_name TYPE c LENGTH 19,
|
||||
driver_age TYPE i,
|
||||
laps TYPE i,
|
||||
booking_time TYPE t,
|
||||
END OF ty_booking.
|
||||
|
||||
TYPES tt_bookings TYPE STANDARD TABLE OF ty_booking WITH EMPTY KEY.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
no_name TYPE ty_reason VALUE 'NO_NAME',
|
||||
too_young TYPE ty_reason VALUE 'TOO_YOUNG',
|
||||
too_old TYPE ty_reason VALUE 'TOO_OLD',
|
||||
bad_laps TYPE ty_reason VALUE 'BAD_LAPS',
|
||||
closed TYPE ty_reason VALUE 'CLOSED',
|
||||
too_many TYPE ty_reason VALUE 'TOO_MANY',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_limit,
|
||||
min_age TYPE i VALUE 12,
|
||||
max_age TYPE i VALUE 75,
|
||||
min_laps TYPE i VALUE 5,
|
||||
max_laps TYPE i VALUE 30,
|
||||
max_drivers TYPE i VALUE 8,
|
||||
END OF c_limit.
|
||||
|
||||
CONSTANTS:
|
||||
c_open_from TYPE t VALUE '090000',
|
||||
c_open_to TYPE t VALUE '220000'.
|
||||
|
||||
METHODS check_booking
|
||||
IMPORTING is_booking TYPE ty_booking
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS check_group
|
||||
IMPORTING it_bookings TYPE tt_bookings
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS is_open
|
||||
IMPORTING iv_time TYPE t
|
||||
RETURNING VALUE(rv_open) TYPE abap_bool.
|
||||
ENDINTERFACE.
|
||||
49
tasks_gen/train/G1926/faulty/m1_if_kart_check.intf.abap
Normal file
49
tasks_gen/train/G1926/faulty/m1_if_kart_check.intf.abap
Normal file
@@ -0,0 +1,49 @@
|
||||
INTERFACE {{p}}if_kart_check PUBLIC.
|
||||
TYPES ty_reason TYPE c LENGTH 12.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_booking,
|
||||
driver_name TYPE c LENGTH 20,
|
||||
driver_age TYPE i,
|
||||
laps TYPE i,
|
||||
booking_time TYPE t,
|
||||
END OF ty_booking.
|
||||
|
||||
TYPES tt_bookings TYPE STANDARD TABLE OF ty_booking WITH EMPTY KEY.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
no_name TYPE ty_reason VALUE 'ZO_NAME',
|
||||
too_young TYPE ty_reason VALUE 'TOO_YOUNG',
|
||||
too_old TYPE ty_reason VALUE 'TOO_OLD',
|
||||
bad_laps TYPE ty_reason VALUE 'BAD_LAPS',
|
||||
closed TYPE ty_reason VALUE 'CLOSED',
|
||||
too_many TYPE ty_reason VALUE 'TOO_MANY',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_limit,
|
||||
min_age TYPE i VALUE 12,
|
||||
max_age TYPE i VALUE 75,
|
||||
min_laps TYPE i VALUE 5,
|
||||
max_laps TYPE i VALUE 30,
|
||||
max_drivers TYPE i VALUE 8,
|
||||
END OF c_limit.
|
||||
|
||||
CONSTANTS:
|
||||
c_open_from TYPE t VALUE '090000',
|
||||
c_open_to TYPE t VALUE '220000'.
|
||||
|
||||
METHODS check_booking
|
||||
IMPORTING is_booking TYPE ty_booking
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS check_group
|
||||
IMPORTING it_bookings TYPE tt_bookings
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS is_open
|
||||
IMPORTING iv_time TYPE t
|
||||
RETURNING VALUE(rv_open) TYPE abap_bool.
|
||||
ENDINTERFACE.
|
||||
49
tasks_gen/train/G1926/faulty/m2_if_kart_check.intf.abap
Normal file
49
tasks_gen/train/G1926/faulty/m2_if_kart_check.intf.abap
Normal file
@@ -0,0 +1,49 @@
|
||||
INTERFACE {{p}}if_kart_check PUBLIC.
|
||||
TYPES ty_reason TYPE c LENGTH 12.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_booking,
|
||||
driver_name TYPE c LENGTH 20,
|
||||
driver_age TYPE i,
|
||||
laps TYPE i,
|
||||
booking_time TYPE t,
|
||||
END OF ty_booking.
|
||||
|
||||
TYPES tt_bookings TYPE STANDARD TABLE OF ty_booking WITH EMPTY KEY.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
no_name TYPE ty_reason VALUE 'NO_NAME',
|
||||
too_young TYPE ty_reason VALUE 'TOO_YOUNG',
|
||||
too_old TYPE ty_reason VALUE 'TOO_OLD',
|
||||
bad_laps TYPE ty_reason VALUE 'ZAD_LAPS',
|
||||
closed TYPE ty_reason VALUE 'CLOSED',
|
||||
too_many TYPE ty_reason VALUE 'TOO_MANY',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_limit,
|
||||
min_age TYPE i VALUE 12,
|
||||
max_age TYPE i VALUE 75,
|
||||
min_laps TYPE i VALUE 5,
|
||||
max_laps TYPE i VALUE 30,
|
||||
max_drivers TYPE i VALUE 8,
|
||||
END OF c_limit.
|
||||
|
||||
CONSTANTS:
|
||||
c_open_from TYPE t VALUE '090000',
|
||||
c_open_to TYPE t VALUE '220000'.
|
||||
|
||||
METHODS check_booking
|
||||
IMPORTING is_booking TYPE ty_booking
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS check_group
|
||||
IMPORTING it_bookings TYPE tt_bookings
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS is_open
|
||||
IMPORTING iv_time TYPE t
|
||||
RETURNING VALUE(rv_open) TYPE abap_bool.
|
||||
ENDINTERFACE.
|
||||
49
tasks_gen/train/G1926/faulty/m3_if_kart_check.intf.abap
Normal file
49
tasks_gen/train/G1926/faulty/m3_if_kart_check.intf.abap
Normal file
@@ -0,0 +1,49 @@
|
||||
INTERFACE {{p}}if_kart_check PUBLIC.
|
||||
TYPES ty_reason TYPE c LENGTH 12.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_booking,
|
||||
driver_name TYPE c LENGTH 20,
|
||||
driver_age TYPE i,
|
||||
laps TYPE i,
|
||||
booking_time TYPE t,
|
||||
END OF ty_booking.
|
||||
|
||||
TYPES tt_bookings TYPE STANDARD TABLE OF ty_booking WITH EMPTY KEY.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
no_name TYPE ty_reason VALUE 'NO_NAME',
|
||||
too_young TYPE ty_reason VALUE 'TOO_YOUNG',
|
||||
too_old TYPE ty_reason VALUE 'TOO_OLD',
|
||||
bad_laps TYPE ty_reason VALUE 'BAD_LAPS',
|
||||
closed TYPE ty_reason VALUE 'ZLOSED',
|
||||
too_many TYPE ty_reason VALUE 'TOO_MANY',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_limit,
|
||||
min_age TYPE i VALUE 12,
|
||||
max_age TYPE i VALUE 75,
|
||||
min_laps TYPE i VALUE 5,
|
||||
max_laps TYPE i VALUE 30,
|
||||
max_drivers TYPE i VALUE 8,
|
||||
END OF c_limit.
|
||||
|
||||
CONSTANTS:
|
||||
c_open_from TYPE t VALUE '090000',
|
||||
c_open_to TYPE t VALUE '220000'.
|
||||
|
||||
METHODS check_booking
|
||||
IMPORTING is_booking TYPE ty_booking
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS check_group
|
||||
IMPORTING it_bookings TYPE tt_bookings
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS is_open
|
||||
IMPORTING iv_time TYPE t
|
||||
RETURNING VALUE(rv_open) TYPE abap_bool.
|
||||
ENDINTERFACE.
|
||||
49
tasks_gen/train/G1926/faulty/m4_if_kart_check.intf.abap
Normal file
49
tasks_gen/train/G1926/faulty/m4_if_kart_check.intf.abap
Normal file
@@ -0,0 +1,49 @@
|
||||
INTERFACE {{p}}if_kart_check PUBLIC.
|
||||
TYPES ty_reason TYPE c LENGTH 12.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_booking,
|
||||
driver_name TYPE c LENGTH 20,
|
||||
driver_age TYPE i,
|
||||
laps TYPE i,
|
||||
booking_time TYPE t,
|
||||
END OF ty_booking.
|
||||
|
||||
TYPES tt_bookings TYPE STANDARD TABLE OF ty_booking WITH EMPTY KEY.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
no_name TYPE ty_reason VALUE 'NO_NAME',
|
||||
too_young TYPE ty_reason VALUE 'TOO_YOUNG',
|
||||
too_old TYPE ty_reason VALUE 'TOO_OLD',
|
||||
bad_laps TYPE ty_reason VALUE 'BAD_LAPS',
|
||||
closed TYPE ty_reason VALUE 'CLOSED',
|
||||
too_many TYPE ty_reason VALUE 'ZOO_MANY',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_limit,
|
||||
min_age TYPE i VALUE 12,
|
||||
max_age TYPE i VALUE 75,
|
||||
min_laps TYPE i VALUE 5,
|
||||
max_laps TYPE i VALUE 30,
|
||||
max_drivers TYPE i VALUE 8,
|
||||
END OF c_limit.
|
||||
|
||||
CONSTANTS:
|
||||
c_open_from TYPE t VALUE '090000',
|
||||
c_open_to TYPE t VALUE '220000'.
|
||||
|
||||
METHODS check_booking
|
||||
IMPORTING is_booking TYPE ty_booking
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS check_group
|
||||
IMPORTING it_bookings TYPE tt_bookings
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS is_open
|
||||
IMPORTING iv_time TYPE t
|
||||
RETURNING VALUE(rv_open) TYPE abap_bool.
|
||||
ENDINTERFACE.
|
||||
44
tasks_gen/train/G1926/generation.json
Normal file
44
tasks_gen/train/G1926/generation.json
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"id": "G1926",
|
||||
"pool": "train",
|
||||
"object_type": "INTF",
|
||||
"category": "A",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 0,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"reference/kart_check_test.clas.abap line 25: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"reference/kart_check_test.clas.abap line 42: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"reference/kart_check_test.clas.abap line 52: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"hidden/kart_check_hidden.clas.abap line 43: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"hidden/kart_check_hidden.clas.abap line 58: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"hidden/kart_check_hidden.clas.abap line 68: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"hidden/kart_check_hidden.clas.abap line 79: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\""
|
||||
],
|
||||
"by_check": {
|
||||
"abaplint": 7
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 77.0,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
174
tasks_gen/train/G1926/hidden/kart_check_hidden.clas.abap
Normal file
174
tasks_gen/train/G1926/hidden/kart_check_hidden.clas.abap
Normal file
@@ -0,0 +1,174 @@
|
||||
CLASS {{p}}kart_check_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_kart_check.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}if_kart_check.
|
||||
METHODS setup.
|
||||
METHODS assert_char_length
|
||||
IMPORTING iv_name TYPE string
|
||||
iv_length TYPE i.
|
||||
METHODS assert_number
|
||||
IMPORTING iv_name TYPE string
|
||||
iv_value TYPE i.
|
||||
METHODS reason_ok FOR TESTING.
|
||||
METHODS reason_codes FOR TESTING.
|
||||
METHODS limit_values FOR TESTING.
|
||||
METHODS opening_times FOR TESTING.
|
||||
METHODS reason_length FOR TESTING.
|
||||
METHODS booking_components FOR TESTING.
|
||||
METHODS bookings_is_table FOR TESTING.
|
||||
METHODS check_booking_ok FOR TESTING.
|
||||
METHODS check_group_ok FOR TESTING.
|
||||
METHODS is_open_at_noon FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}kart_check_hidden IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = me.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD assert_char_length.
|
||||
DATA lv_probe TYPE string.
|
||||
DATA lv_expected TYPE string.
|
||||
DATA ls_booking TYPE {{p}}if_kart_check=>ty_booking.
|
||||
ASSIGN COMPONENT iv_name OF STRUCTURE ls_booking TO FIELD-SYMBOL(<lv_field>).
|
||||
IF sy-subrc <> 0.
|
||||
cl_abap_unit_assert=>fail( msg = |Component { iv_name } is missing| ).
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DO iv_length + 1 TIMES.
|
||||
lv_probe = lv_probe && 'X'.
|
||||
ENDDO.
|
||||
DO iv_length TIMES.
|
||||
lv_expected = lv_expected && 'X'.
|
||||
ENDDO.
|
||||
<lv_field> = lv_probe.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected
|
||||
act = <lv_field>
|
||||
msg = |Length of { iv_name }| ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD assert_number.
|
||||
DATA ls_booking TYPE {{p}}if_kart_check=>ty_booking.
|
||||
ASSIGN COMPONENT iv_name OF STRUCTURE ls_booking TO FIELD-SYMBOL(<lv_field>).
|
||||
IF sy-subrc <> 0.
|
||||
cl_abap_unit_assert=>fail( msg = |Component { iv_name } is missing| ).
|
||||
RETURN.
|
||||
ENDIF.
|
||||
<lv_field> = iv_value.
|
||||
cl_abap_unit_assert=>assert_equals( exp = iv_value
|
||||
act = <lv_field>
|
||||
msg = |Value of { iv_name }| ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reason_ok.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'OK'
|
||||
act = {{p}}if_kart_check=>c_reason-ok ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reason_codes.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'NO_NAME'
|
||||
act = {{p}}if_kart_check=>c_reason-no_name ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'TOO_YOUNG'
|
||||
act = {{p}}if_kart_check=>c_reason-too_young ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'TOO_OLD'
|
||||
act = {{p}}if_kart_check=>c_reason-too_old ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'BAD_LAPS'
|
||||
act = {{p}}if_kart_check=>c_reason-bad_laps ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'CLOSED'
|
||||
act = {{p}}if_kart_check=>c_reason-closed ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'TOO_MANY'
|
||||
act = {{p}}if_kart_check=>c_reason-too_many ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD limit_values.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 12
|
||||
act = {{p}}if_kart_check=>c_limit-min_age ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 75
|
||||
act = {{p}}if_kart_check=>c_limit-max_age ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 5
|
||||
act = {{p}}if_kart_check=>c_limit-min_laps ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 30
|
||||
act = {{p}}if_kart_check=>c_limit-max_laps ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 8
|
||||
act = {{p}}if_kart_check=>c_limit-max_drivers ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD opening_times.
|
||||
DATA lv_from TYPE t VALUE '090000'.
|
||||
DATA lv_to TYPE t VALUE '220000'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_from
|
||||
act = {{p}}if_kart_check=>c_open_from ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_to
|
||||
act = {{p}}if_kart_check=>c_open_to ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reason_length.
|
||||
DATA lv_reason TYPE {{p}}if_kart_check=>ty_reason.
|
||||
DATA lv_probe TYPE string.
|
||||
DO 13 TIMES.
|
||||
lv_probe = lv_probe && 'X'.
|
||||
ENDDO.
|
||||
lv_reason = lv_probe.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'XXXXXXXXXXXX'
|
||||
act = lv_reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD booking_components.
|
||||
assert_char_length( iv_name = 'DRIVER_NAME' iv_length = 20 ).
|
||||
assert_number( iv_name = 'DRIVER_AGE' iv_value = 30 ).
|
||||
assert_number( iv_name = 'LAPS' iv_value = 10 ).
|
||||
DATA ls_booking TYPE {{p}}if_kart_check=>ty_booking.
|
||||
ls_booking-booking_time = '235959'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = '235959'
|
||||
act = ls_booking-booking_time ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD bookings_is_table.
|
||||
DATA lt_bookings TYPE {{p}}if_kart_check=>tt_bookings.
|
||||
DATA(lo_descr) = cl_abap_typedescr=>describe_by_data( lt_bookings ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = cl_abap_typedescr=>typekind_table
|
||||
act = lo_descr->type_kind ).
|
||||
DATA(lo_table) = CAST cl_abap_tabledescr( lo_descr ).
|
||||
DATA(lo_row) = lo_table->get_table_line_type( ).
|
||||
DATA(lo_struct) = CAST cl_abap_structdescr( lo_row ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4
|
||||
act = lines( lo_struct->components ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_booking_ok.
|
||||
DATA ls_booking TYPE {{p}}if_kart_check=>ty_booking.
|
||||
ls_booking-driver_name = 'MAX MUSTERMANN'.
|
||||
ls_booking-driver_age = 30.
|
||||
ls_booking-laps = 10.
|
||||
ls_booking-booking_time = '140000'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'OK'
|
||||
act = mo_cut->check_booking( ls_booking ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_group_ok.
|
||||
DATA lt_bookings TYPE {{p}}if_kart_check=>tt_bookings.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'OK'
|
||||
act = mo_cut->check_group( lt_bookings ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD is_open_at_noon.
|
||||
DATA lv_time TYPE t VALUE '120000'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_true
|
||||
act = mo_cut->is_open( lv_time ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_kart_check~check_booking.
|
||||
rv_reason = {{p}}if_kart_check=>c_reason-ok.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_kart_check~check_group.
|
||||
rv_reason = {{p}}if_kart_check=>c_reason-ok.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_kart_check~is_open.
|
||||
rv_open = abap_true.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
54
tasks_gen/train/G1926/mutation.json
Normal file
54
tasks_gen/train/G1926/mutation.json
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"task": "G1926",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}IF_KART_CHECK",
|
||||
"mutant": "line 6: LENGTH 20 -> LENGTH 19 (length)",
|
||||
"status": "killed",
|
||||
"hidden": "9/10",
|
||||
"failed_tests": [
|
||||
"BOOKING_COMPONENTS"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}IF_KART_CHECK",
|
||||
"mutant": "line 17: VALUE 'NO_NAME' -> VALUE 'ZO_NAME' (lit)",
|
||||
"status": "killed",
|
||||
"hidden": "9/10",
|
||||
"failed_tests": [
|
||||
"REASON_CODES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}IF_KART_CHECK",
|
||||
"mutant": "line 20: VALUE 'BAD_LAPS' -> VALUE 'ZAD_LAPS' (lit)",
|
||||
"status": "killed",
|
||||
"hidden": "9/10",
|
||||
"failed_tests": [
|
||||
"REASON_CODES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}IF_KART_CHECK",
|
||||
"mutant": "line 21: VALUE 'CLOSED' -> VALUE 'ZLOSED' (lit)",
|
||||
"status": "killed",
|
||||
"hidden": "9/10",
|
||||
"failed_tests": [
|
||||
"REASON_CODES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}IF_KART_CHECK",
|
||||
"mutant": "line 22: VALUE 'TOO_MANY' -> VALUE 'ZOO_MANY' (lit)",
|
||||
"status": "killed",
|
||||
"hidden": "9/10",
|
||||
"failed_tests": [
|
||||
"REASON_CODES"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
49
tasks_gen/train/G1926/reference/if_kart_check.intf.abap
Normal file
49
tasks_gen/train/G1926/reference/if_kart_check.intf.abap
Normal file
@@ -0,0 +1,49 @@
|
||||
INTERFACE {{p}}if_kart_check PUBLIC.
|
||||
TYPES ty_reason TYPE c LENGTH 12.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_booking,
|
||||
driver_name TYPE c LENGTH 20,
|
||||
driver_age TYPE i,
|
||||
laps TYPE i,
|
||||
booking_time TYPE t,
|
||||
END OF ty_booking.
|
||||
|
||||
TYPES tt_bookings TYPE STANDARD TABLE OF ty_booking WITH EMPTY KEY.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_reason,
|
||||
ok TYPE ty_reason VALUE 'OK',
|
||||
no_name TYPE ty_reason VALUE 'NO_NAME',
|
||||
too_young TYPE ty_reason VALUE 'TOO_YOUNG',
|
||||
too_old TYPE ty_reason VALUE 'TOO_OLD',
|
||||
bad_laps TYPE ty_reason VALUE 'BAD_LAPS',
|
||||
closed TYPE ty_reason VALUE 'CLOSED',
|
||||
too_many TYPE ty_reason VALUE 'TOO_MANY',
|
||||
END OF c_reason.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_limit,
|
||||
min_age TYPE i VALUE 12,
|
||||
max_age TYPE i VALUE 75,
|
||||
min_laps TYPE i VALUE 5,
|
||||
max_laps TYPE i VALUE 30,
|
||||
max_drivers TYPE i VALUE 8,
|
||||
END OF c_limit.
|
||||
|
||||
CONSTANTS:
|
||||
c_open_from TYPE t VALUE '090000',
|
||||
c_open_to TYPE t VALUE '220000'.
|
||||
|
||||
METHODS check_booking
|
||||
IMPORTING is_booking TYPE ty_booking
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS check_group
|
||||
IMPORTING it_bookings TYPE tt_bookings
|
||||
RETURNING VALUE(rv_reason) TYPE ty_reason.
|
||||
|
||||
METHODS is_open
|
||||
IMPORTING iv_time TYPE t
|
||||
RETURNING VALUE(rv_open) TYPE abap_bool.
|
||||
ENDINTERFACE.
|
||||
116
tasks_gen/train/G1926/reference/kart_check_test.clas.abap
Normal file
116
tasks_gen/train/G1926/reference/kart_check_test.clas.abap
Normal file
@@ -0,0 +1,116 @@
|
||||
CLASS {{p}}kart_check_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_kart_check.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}if_kart_check.
|
||||
METHODS setup.
|
||||
METHODS reason_codes_are_fixed FOR TESTING.
|
||||
METHODS limits_are_fixed FOR TESTING.
|
||||
METHODS opening_times_are_fixed FOR TESTING.
|
||||
METHODS reason_type_has_length_12 FOR TESTING.
|
||||
METHODS booking_has_four_components FOR TESTING.
|
||||
METHODS bookings_is_a_table FOR TESTING.
|
||||
METHODS check_booking_returns_ok FOR TESTING.
|
||||
METHODS is_open_returns_true FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}kart_check_test IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = me.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reason_codes_are_fixed.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'OK'
|
||||
act = {{p}}if_kart_check=>c_reason-ok ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'NO_NAME'
|
||||
act = {{p}}if_kart_check=>c_reason-no_name ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'TOO_YOUNG'
|
||||
act = {{p}}if_kart_check=>c_reason-too_young ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'TOO_OLD'
|
||||
act = {{p}}if_kart_check=>c_reason-too_old ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'BAD_LAPS'
|
||||
act = {{p}}if_kart_check=>c_reason-bad_laps ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'CLOSED'
|
||||
act = {{p}}if_kart_check=>c_reason-closed ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'TOO_MANY'
|
||||
act = {{p}}if_kart_check=>c_reason-too_many ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD limits_are_fixed.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 12
|
||||
act = {{p}}if_kart_check=>c_limit-min_age ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 75
|
||||
act = {{p}}if_kart_check=>c_limit-max_age ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 5
|
||||
act = {{p}}if_kart_check=>c_limit-min_laps ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 30
|
||||
act = {{p}}if_kart_check=>c_limit-max_laps ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 8
|
||||
act = {{p}}if_kart_check=>c_limit-max_drivers ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD opening_times_are_fixed.
|
||||
DATA lv_from TYPE t VALUE '090000'.
|
||||
DATA lv_to TYPE t VALUE '220000'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_from
|
||||
act = {{p}}if_kart_check=>c_open_from ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_to
|
||||
act = {{p}}if_kart_check=>c_open_to ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reason_type_has_length_12.
|
||||
DATA lv_reason TYPE {{p}}if_kart_check=>ty_reason.
|
||||
DATA lv_probe TYPE string.
|
||||
DO 13 TIMES.
|
||||
lv_probe = lv_probe && 'X'.
|
||||
ENDDO.
|
||||
lv_reason = lv_probe.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'XXXXXXXXXXXX'
|
||||
act = lv_reason ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD booking_has_four_components.
|
||||
DATA ls_booking TYPE {{p}}if_kart_check=>ty_booking.
|
||||
DATA(lo_descr) = cl_abap_typedescr=>describe_by_data( ls_booking ).
|
||||
DATA(lo_struct) = CAST cl_abap_structdescr( lo_descr ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4
|
||||
act = lines( lo_struct->components ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD bookings_is_a_table.
|
||||
DATA lt_bookings TYPE {{p}}if_kart_check=>tt_bookings.
|
||||
DATA(lo_descr) = cl_abap_typedescr=>describe_by_data( lt_bookings ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = cl_abap_typedescr=>typekind_table
|
||||
act = lo_descr->type_kind ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD check_booking_returns_ok.
|
||||
DATA ls_booking TYPE {{p}}if_kart_check=>ty_booking.
|
||||
ls_booking-driver_name = 'ANNA BEISPIEL'.
|
||||
ls_booking-driver_age = 25.
|
||||
ls_booking-laps = 8.
|
||||
ls_booking-booking_time = '100000'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'OK'
|
||||
act = mo_cut->check_booking( ls_booking ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD is_open_returns_true.
|
||||
DATA lv_time TYPE t VALUE '150000'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_true
|
||||
act = mo_cut->is_open( lv_time ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_kart_check~check_booking.
|
||||
rv_reason = {{p}}if_kart_check=>c_reason-ok.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_kart_check~check_group.
|
||||
rv_reason = {{p}}if_kart_check=>c_reason-ok.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_kart_check~is_open.
|
||||
rv_open = abap_true.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
67
tasks_gen/train/G1926/spec.md
Normal file
67
tasks_gen/train/G1926/spec.md
Normal file
@@ -0,0 +1,67 @@
|
||||
# 1. Goal
|
||||
A go-kart circuit starts a race only when the booking is correct. The booking
|
||||
desk and the web shop of the circuit must use the same check. Create the
|
||||
interface that both programs use as the contract of the check.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The interface {{P}}IF_KART_CHECK does not exist. Create it in package $TMP.
|
||||
- The circuit returns one reason code for a booking. The reason codes are
|
||||
OK, NO_NAME, TOO_YOUNG, TOO_OLD, BAD_LAPS, CLOSED and TOO_MANY.
|
||||
- The meaning of the reason codes is:
|
||||
OK - the booking is correct.
|
||||
NO_NAME - the driver name is empty.
|
||||
TOO_YOUNG - the driver is younger than MIN_AGE.
|
||||
TOO_OLD - the driver is older than MAX_AGE.
|
||||
BAD_LAPS - the number of laps is outside MIN_LAPS and MAX_LAPS.
|
||||
CLOSED - the booking time is outside the opening hours.
|
||||
TOO_MANY - the group has more than MAX_DRIVERS bookings.
|
||||
- The circuit is open from 09:00:00 to 22:00:00.
|
||||
- The booking desk and the web shop read the reason codes and the limits from
|
||||
the interface. No other object uses the interface.
|
||||
|
||||
# 4. Contract
|
||||
- Create the interface {{P}}IF_KART_CHECK in package $TMP.
|
||||
- The interface is public.
|
||||
- The interface contains the types, the constants and the methods of the
|
||||
business rules. Do not add other public components.
|
||||
|
||||
# 5. Business rules
|
||||
1. The interface has the type TY_REASON. TY_REASON is a character type of
|
||||
length 12.
|
||||
2. The interface has the structure type TY_BOOKING. The components are:
|
||||
DRIVER_NAME (character, length 20), DRIVER_AGE (integer), LAPS (integer),
|
||||
BOOKING_TIME (time).
|
||||
3. The interface has the table type TT_BOOKINGS. The row type is TY_BOOKING.
|
||||
TT_BOOKINGS is a standard table with an empty key.
|
||||
4. The interface has the constant structure C_REASON. Each component has the
|
||||
type TY_REASON. The components and the values are:
|
||||
OK = 'OK', NO_NAME = 'NO_NAME', TOO_YOUNG = 'TOO_YOUNG',
|
||||
TOO_OLD = 'TOO_OLD', BAD_LAPS = 'BAD_LAPS', CLOSED = 'CLOSED',
|
||||
TOO_MANY = 'TOO_MANY'.
|
||||
5. The interface has the constant structure C_LIMIT. Each component has the
|
||||
type i. The components and the values are:
|
||||
MIN_AGE = 12, MAX_AGE = 75, MIN_LAPS = 5, MAX_LAPS = 30, MAX_DRIVERS = 8.
|
||||
6. The interface has the constant C_OPEN_FROM with the value '090000' and the
|
||||
constant C_OPEN_TO with the value '220000'. Both constants have the type t.
|
||||
7. The interface has the method CHECK_BOOKING. The importing parameter
|
||||
IS_BOOKING has the type TY_BOOKING. The returning parameter RV_REASON has
|
||||
the type TY_REASON.
|
||||
8. The interface has the method CHECK_GROUP. The importing parameter
|
||||
IT_BOOKINGS has the type TT_BOOKINGS. The returning parameter RV_REASON has
|
||||
the type TY_REASON.
|
||||
9. The interface has the method IS_OPEN. The importing parameter IV_TIME has
|
||||
the type t. The returning parameter RV_OPEN has the type ABAP_BOOL.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16.
|
||||
- Coding standards: Clean ABAP. No comment that restates the code.
|
||||
- Out of scope: do not create other objects.
|
||||
|
||||
# 7. Acceptance
|
||||
- The interface is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write your own ABAP Unit tests for the interface. Use a global test class,
|
||||
for example {{P}}KART_CHECK_TEST.
|
||||
46
tasks_gen/train/G1926/task.json
Normal file
46
tasks_gen/train/G1926/task.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"id": "G1926",
|
||||
"category": "A",
|
||||
"object_type": "INTF",
|
||||
"difficulty": 3,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [],
|
||||
"contract": [
|
||||
{
|
||||
"type": "INTF",
|
||||
"name": "{{P}}IF_KART_CHECK"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}KART_CHECK_HIDDEN",
|
||||
"file": "hidden/kart_check_hidden.clas.abap",
|
||||
"description": "Hidden tests for the kart check interface. The test class itself implements the interface, so it only compiles when every signature matches. It reads the constants and checks the component lengths and the component values."
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "INTF",
|
||||
"name": "{{P}}IF_KART_CHECK",
|
||||
"file": "reference/if_kart_check.intf.abap",
|
||||
"description": "Kart check interface with types, constants and methods"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}KART_CHECK_TEST",
|
||||
"file": "reference/kart_check_test.clas.abap",
|
||||
"description": "Own ABAP Unit tests for the interface"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"db_operation_in_loop"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user