Snapshot: new training tasks (balanced generation), docs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
16
tasks_gen/train/G1934/faulty/m0_pitch.tabl.asabap
Normal file
16
tasks_gen/train/G1934/faulty/m0_pitch.tabl.asabap
Normal file
@@ -0,0 +1,16 @@
|
||||
@EndUserText.label : 'Campsite pitch booking'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}pitch {
|
||||
key client : abap.clnt not null;
|
||||
booking_id : abap.char(10) not null;
|
||||
pitch_no : abap.numc(4);
|
||||
guest_name : abap.char(30);
|
||||
arrival_date : abap.dats;
|
||||
departure_date : abap.dats;
|
||||
persons : abap.int4;
|
||||
power_hookup : abap.char(1);
|
||||
rate_per_night : abap.dec(9,2);
|
||||
}
|
||||
16
tasks_gen/train/G1934/faulty/m1_pitch.tabl.asabap
Normal file
16
tasks_gen/train/G1934/faulty/m1_pitch.tabl.asabap
Normal file
@@ -0,0 +1,16 @@
|
||||
@EndUserText.label : 'Campsite pitch booking'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}pitch {
|
||||
key client : abap.clnt not null;
|
||||
key booking_id : abap.char(9) not null;
|
||||
pitch_no : abap.numc(4);
|
||||
guest_name : abap.char(30);
|
||||
arrival_date : abap.dats;
|
||||
departure_date : abap.dats;
|
||||
persons : abap.int4;
|
||||
power_hookup : abap.char(1);
|
||||
rate_per_night : abap.dec(9,2);
|
||||
}
|
||||
16
tasks_gen/train/G1934/faulty/m2_pitch.tabl.asabap
Normal file
16
tasks_gen/train/G1934/faulty/m2_pitch.tabl.asabap
Normal file
@@ -0,0 +1,16 @@
|
||||
@EndUserText.label : 'Campsite pitch booking'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}pitch {
|
||||
key client : abap.clnt not null;
|
||||
key booking_id : abap.char(10) not null;
|
||||
pitch_no : abap.numc(4);
|
||||
guest_name : abap.char(30);
|
||||
arrival_date : abap.tims;
|
||||
departure_date : abap.dats;
|
||||
persons : abap.int4;
|
||||
power_hookup : abap.char(1);
|
||||
rate_per_night : abap.dec(9,2);
|
||||
}
|
||||
16
tasks_gen/train/G1934/faulty/m3_pitch.tabl.asabap
Normal file
16
tasks_gen/train/G1934/faulty/m3_pitch.tabl.asabap
Normal file
@@ -0,0 +1,16 @@
|
||||
@EndUserText.label : 'Campsite pitch booking'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}pitch {
|
||||
key client : abap.clnt not null;
|
||||
key booking_id : abap.char(10) not null;
|
||||
pitch_no : abap.numc(4);
|
||||
guest_name : abap.char(30);
|
||||
arrival_date : abap.dats;
|
||||
departure_date : abap.dats;
|
||||
persons : abap.int8;
|
||||
power_hookup : abap.char(1);
|
||||
rate_per_night : abap.dec(9,2);
|
||||
}
|
||||
16
tasks_gen/train/G1934/faulty/m4_pitch.tabl.asabap
Normal file
16
tasks_gen/train/G1934/faulty/m4_pitch.tabl.asabap
Normal file
@@ -0,0 +1,16 @@
|
||||
@EndUserText.label : 'Campsite pitch booking'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}pitch {
|
||||
key client : abap.clnt not null;
|
||||
key booking_id : abap.char(10) not null;
|
||||
pitch_no : abap.numc(4);
|
||||
guest_name : abap.char(30);
|
||||
arrival_date : abap.dats;
|
||||
departure_date : abap.dats;
|
||||
persons : abap.int4;
|
||||
power_hookup : abap.char(1);
|
||||
rate_per_night : abap.dec(9,3);
|
||||
}
|
||||
24
tasks_gen/train/G1934/generation.json
Normal file
24
tasks_gen/train/G1934/generation.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"id": "G1934",
|
||||
"pool": "train",
|
||||
"object_type": "TABL",
|
||||
"category": "B",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 0,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
147
tasks_gen/train/G1934/hidden/t16_hidden.clas.abap
Normal file
147
tasks_gen/train/G1934/hidden/t16_hidden.clas.abap
Normal file
@@ -0,0 +1,147 @@
|
||||
CLASS {{p}}t16_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CLASS-DATA gt_fields TYPE ddfields.
|
||||
CLASS-DATA go_env TYPE REF TO if_osql_test_environment.
|
||||
|
||||
CLASS-METHODS class_setup.
|
||||
CLASS-METHODS class_teardown.
|
||||
METHODS setup.
|
||||
|
||||
METHODS all_fields_present FOR TESTING.
|
||||
METHODS key_fields FOR TESTING.
|
||||
METHODS text_lengths FOR TESTING.
|
||||
METHODS date_and_count_types FOR TESTING.
|
||||
METHODS rate_decimals FOR TESTING.
|
||||
METHODS insert_and_read FOR TESTING.
|
||||
METHODS multiple_rows_stored FOR TESTING.
|
||||
METHODS numc_keeps_leading_zeros FOR TESTING.
|
||||
|
||||
CLASS-METHODS get_field
|
||||
IMPORTING iv_name TYPE fieldname
|
||||
RETURNING VALUE(rs_field) TYPE dfies.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t16_hidden IMPLEMENTATION.
|
||||
|
||||
METHOD class_setup.
|
||||
DATA(lo_struct) = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_name( '{{P}}PITCH' ) ).
|
||||
gt_fields = lo_struct->get_ddic_field_list( ).
|
||||
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}PITCH' ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
IF go_env IS BOUND.
|
||||
go_env->destroy( ).
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD setup.
|
||||
go_env->clear_doubles( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_field.
|
||||
READ TABLE gt_fields INTO rs_field WITH KEY fieldname = iv_name.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = sy-subrc
|
||||
msg = |Field { iv_name } is missing| ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD all_fields_present.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 9 act = lines( gt_fields ) ).
|
||||
get_field( 'CLIENT' ).
|
||||
get_field( 'BOOKING_ID' ).
|
||||
get_field( 'PITCH_NO' ).
|
||||
get_field( 'GUEST_NAME' ).
|
||||
get_field( 'ARRIVAL_DATE' ).
|
||||
get_field( 'DEPARTURE_DATE' ).
|
||||
get_field( 'PERSONS' ).
|
||||
get_field( 'POWER_HOOKUP' ).
|
||||
get_field( 'RATE_PER_NIGHT' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD key_fields.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'X' act = get_field( 'CLIENT' )-keyflag ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'X' act = get_field( 'BOOKING_ID' )-keyflag ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = ' ' act = get_field( 'PITCH_NO' )-keyflag ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = ' ' act = get_field( 'GUEST_NAME' )-keyflag ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = ' ' act = get_field( 'ARRIVAL_DATE' )-keyflag ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = ' ' act = get_field( 'DEPARTURE_DATE' )-keyflag ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = ' ' act = get_field( 'PERSONS' )-keyflag ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = ' ' act = get_field( 'POWER_HOOKUP' )-keyflag ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = ' ' act = get_field( 'RATE_PER_NIGHT' )-keyflag ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD text_lengths.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'C' act = get_field( 'CLIENT' )-inttype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = get_field( 'CLIENT' )-leng ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'C' act = get_field( 'BOOKING_ID' )-inttype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 10 act = get_field( 'BOOKING_ID' )-leng ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'N' act = get_field( 'PITCH_NO' )-inttype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4 act = get_field( 'PITCH_NO' )-leng ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'C' act = get_field( 'GUEST_NAME' )-inttype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 30 act = get_field( 'GUEST_NAME' )-leng ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'C' act = get_field( 'POWER_HOOKUP' )-inttype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = get_field( 'POWER_HOOKUP' )-leng ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD date_and_count_types.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'D' act = get_field( 'ARRIVAL_DATE' )-inttype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 8 act = get_field( 'ARRIVAL_DATE' )-leng ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'D' act = get_field( 'DEPARTURE_DATE' )-inttype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 8 act = get_field( 'DEPARTURE_DATE' )-leng ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'I' act = get_field( 'PERSONS' )-inttype ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rate_decimals.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'P' act = get_field( 'RATE_PER_NIGHT' )-inttype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 9 act = get_field( 'RATE_PER_NIGHT' )-leng ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = get_field( 'RATE_PER_NIGHT' )-decimals ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD insert_and_read.
|
||||
DATA lt_rows TYPE STANDARD TABLE OF {{p}}pitch WITH EMPTY KEY.
|
||||
lt_rows = VALUE #(
|
||||
( client = sy-mandt booking_id = 'B0001' pitch_no = '0001' guest_name = 'MUELLER'
|
||||
arrival_date = '20250601' departure_date = '20250608' persons = 4
|
||||
power_hookup = 'X' rate_per_night = '12.50' ) ).
|
||||
INSERT {{p}}pitch FROM TABLE @lt_rows.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
SELECT SINGLE guest_name, pitch_no, persons, power_hookup, departure_date, rate_per_night
|
||||
FROM {{p}}pitch WHERE booking_id = 'B0001' INTO @DATA(ls_row).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'MUELLER' act = ls_row-guest_name ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = '0001' act = ls_row-pitch_no ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4 act = ls_row-persons ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'X' act = ls_row-power_hookup ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = '20250608' act = ls_row-departure_date ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '12.50' )
|
||||
act = CONV decfloat34( ls_row-rate_per_night ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD multiple_rows_stored.
|
||||
DATA lt_rows TYPE STANDARD TABLE OF {{p}}pitch WITH EMPTY KEY.
|
||||
lt_rows = VALUE #(
|
||||
( client = sy-mandt booking_id = 'C0001' pitch_no = '0003' arrival_date = '20250601'
|
||||
departure_date = '20250602' persons = 1 rate_per_night = '9.00' )
|
||||
( client = sy-mandt booking_id = 'C0002' pitch_no = '0004' arrival_date = '20250601'
|
||||
departure_date = '20250602' persons = 2 rate_per_night = '9.00' )
|
||||
( client = sy-mandt booking_id = 'C0003' pitch_no = '0005' arrival_date = '20250601'
|
||||
departure_date = '20250602' persons = 3 rate_per_night = '9.00' ) ).
|
||||
INSERT {{p}}pitch FROM TABLE @lt_rows.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
SELECT COUNT(*) FROM {{p}}pitch INTO @DATA(lv_count).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = lv_count ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD numc_keeps_leading_zeros.
|
||||
DATA lt_rows TYPE STANDARD TABLE OF {{p}}pitch WITH EMPTY KEY.
|
||||
lt_rows = VALUE #(
|
||||
( client = sy-mandt booking_id = 'D0001' pitch_no = '0123' arrival_date = '20250601'
|
||||
departure_date = '20250602' persons = 2 rate_per_night = '10.00' ) ).
|
||||
INSERT {{p}}pitch FROM TABLE @lt_rows.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
SELECT SINGLE pitch_no FROM {{p}}pitch WHERE booking_id = 'D0001' INTO @DATA(lv_pitch).
|
||||
cl_abap_unit_assert=>assert_equals( exp = '0123' act = lv_pitch ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
55
tasks_gen/train/G1934/mutation.json
Normal file
55
tasks_gen/train/G1934/mutation.json
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"task": "G1934",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}PITCH",
|
||||
"mutant": "line 8: key booking_id : -> booking_id : (key)",
|
||||
"status": "killed",
|
||||
"hidden": "6/8",
|
||||
"failed_tests": [
|
||||
"KEY_FIELDS",
|
||||
"MULTIPLE_ROWS_STORED"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}PITCH",
|
||||
"mutant": "line 8: abap.char(10) -> abap.char(9) (length)",
|
||||
"status": "killed",
|
||||
"hidden": "7/8",
|
||||
"failed_tests": [
|
||||
"TEXT_LENGTHS"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}PITCH",
|
||||
"mutant": "line 11: abap.dats -> abap.tims (type)",
|
||||
"status": "killed",
|
||||
"hidden": "7/8",
|
||||
"failed_tests": [
|
||||
"DATE_AND_COUNT_TYPES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}PITCH",
|
||||
"mutant": "line 13: abap.int4 -> abap.int8 (type)",
|
||||
"status": "killed",
|
||||
"hidden": "7/8",
|
||||
"failed_tests": [
|
||||
"DATE_AND_COUNT_TYPES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}PITCH",
|
||||
"mutant": "line 15: abap.dec(9,2) -> abap.dec(9,3) (decimals)",
|
||||
"status": "killed",
|
||||
"hidden": "7/8",
|
||||
"failed_tests": [
|
||||
"RATE_DECIMALS"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
16
tasks_gen/train/G1934/reference/pitch.tabl.asabap
Normal file
16
tasks_gen/train/G1934/reference/pitch.tabl.asabap
Normal file
@@ -0,0 +1,16 @@
|
||||
@EndUserText.label : 'Campsite pitch booking'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}pitch {
|
||||
key client : abap.clnt not null;
|
||||
key booking_id : abap.char(10) not null;
|
||||
pitch_no : abap.numc(4);
|
||||
guest_name : abap.char(30);
|
||||
arrival_date : abap.dats;
|
||||
departure_date : abap.dats;
|
||||
persons : abap.int4;
|
||||
power_hookup : abap.char(1);
|
||||
rate_per_night : abap.dec(9,2);
|
||||
}
|
||||
83
tasks_gen/train/G1934/reference/t16_test.clas.abap
Normal file
83
tasks_gen/train/G1934/reference/t16_test.clas.abap
Normal file
@@ -0,0 +1,83 @@
|
||||
CLASS {{p}}t16_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CLASS-DATA go_env TYPE REF TO if_osql_test_environment.
|
||||
|
||||
CLASS-METHODS class_setup.
|
||||
CLASS-METHODS class_teardown.
|
||||
METHODS setup.
|
||||
|
||||
METHODS structure_is_correct FOR TESTING.
|
||||
METHODS booking_is_stored FOR TESTING.
|
||||
METHODS two_bookings_are_stored FOR TESTING.
|
||||
METHODS rate_keeps_decimals FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t16_test IMPLEMENTATION.
|
||||
|
||||
METHOD class_setup.
|
||||
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}PITCH' ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
IF go_env IS BOUND.
|
||||
go_env->destroy( ).
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD setup.
|
||||
go_env->clear_doubles( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD structure_is_correct.
|
||||
DATA(lo_struct) = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_name( '{{P}}PITCH' ) ).
|
||||
DATA(lt_fields) = lo_struct->get_ddic_field_list( ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 9 act = lines( lt_fields ) ).
|
||||
READ TABLE lt_fields INTO DATA(ls_field) WITH KEY fieldname = 'BOOKING_ID'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = sy-subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'X' act = ls_field-keyflag ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 10 act = ls_field-leng ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD booking_is_stored.
|
||||
DATA lt_rows TYPE STANDARD TABLE OF {{p}}pitch WITH EMPTY KEY.
|
||||
lt_rows = VALUE #(
|
||||
( client = sy-mandt booking_id = 'T0001' pitch_no = '0007' guest_name = 'WEBER'
|
||||
arrival_date = '20250701' departure_date = '20250705' persons = 3
|
||||
power_hookup = 'X' rate_per_night = '15.00' ) ).
|
||||
INSERT {{p}}pitch FROM TABLE @lt_rows.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
SELECT SINGLE guest_name, pitch_no, persons FROM {{p}}pitch
|
||||
WHERE booking_id = 'T0001' INTO @DATA(ls_row).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'WEBER' act = ls_row-guest_name ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = '0007' act = ls_row-pitch_no ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = ls_row-persons ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD two_bookings_are_stored.
|
||||
DATA lt_rows TYPE STANDARD TABLE OF {{p}}pitch WITH EMPTY KEY.
|
||||
lt_rows = VALUE #(
|
||||
( client = sy-mandt booking_id = 'T0002' pitch_no = '0008' arrival_date = '20250701'
|
||||
departure_date = '20250705' persons = 2 rate_per_night = '15.00' )
|
||||
( client = sy-mandt booking_id = 'T0003' pitch_no = '0009' arrival_date = '20250701'
|
||||
departure_date = '20250703' persons = 1 rate_per_night = '12.00' ) ).
|
||||
INSERT {{p}}pitch FROM TABLE @lt_rows.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
SELECT COUNT(*) FROM {{p}}pitch INTO @DATA(lv_count).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rate_keeps_decimals.
|
||||
DATA lt_rows TYPE STANDARD TABLE OF {{p}}pitch WITH EMPTY KEY.
|
||||
lt_rows = VALUE #(
|
||||
( client = sy-mandt booking_id = 'T0004' pitch_no = '0010' arrival_date = '20250701'
|
||||
departure_date = '20250705' persons = 1 rate_per_night = '12.34' ) ).
|
||||
INSERT {{p}}pitch FROM TABLE @lt_rows.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
SELECT SINGLE rate_per_night FROM {{p}}pitch WHERE booking_id = 'T0004' INTO @DATA(lv_rate).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '12.34' )
|
||||
act = CONV decfloat34( lv_rate ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
50
tasks_gen/train/G1934/spec.md
Normal file
50
tasks_gen/train/G1934/spec.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# 1. Goal
|
||||
The campsite "Lakeside" must store the bookings of its pitches in a database
|
||||
table. The reception desk, a nightly list and an OData service read this table,
|
||||
so the structure of the table must be fixed.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The campsite rents numbered pitches to guests.
|
||||
- A booking has a booking number. A booking number occurs only once.
|
||||
- The campsite runs in one client. The table is client-dependent.
|
||||
|
||||
# 4. Contract
|
||||
- Create the transparent table {{P}}PITCH in package $TMP.
|
||||
- Fields:
|
||||
- client (abap.clnt): the client. Key field.
|
||||
- booking_id (abap.char(10)): the booking number. Key field.
|
||||
- pitch_no (abap.numc(4)): the number of the rented pitch.
|
||||
- guest_name (abap.char(30)): the name of the guest.
|
||||
- arrival_date (abap.dats): the first night of the stay.
|
||||
- departure_date (abap.dats): the day of departure.
|
||||
- persons (abap.int4): the number of persons.
|
||||
- power_hookup (abap.char(1)): 'X' when a power hookup is booked.
|
||||
- rate_per_night (abap.dec(9,2)): the price for one night.
|
||||
|
||||
# 5. Business rules
|
||||
1. One row of the table is one booking. The key of the table is client and
|
||||
booking_id. A booking number occurs only once.
|
||||
2. booking_id has 10 characters.
|
||||
3. pitch_no has 4 characters. The characters are digits.
|
||||
4. guest_name has 30 characters.
|
||||
5. arrival_date and departure_date are dates. arrival_date is the first night
|
||||
of the stay. departure_date is the day of departure.
|
||||
6. persons is a whole number.
|
||||
7. power_hookup has 1 character. The value is 'X' when the guest booked a power
|
||||
hookup. Otherwise the value is empty.
|
||||
8. rate_per_night has 9 digits and 2 decimals. It is the price for one night.
|
||||
9. The table has exactly these 9 fields.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
|
||||
- Use Clean ABAP.
|
||||
- Out of scope: no other objects.
|
||||
|
||||
# 7. Acceptance
|
||||
- The table {{P}}PITCH is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write ABAP Unit tests in a global test class. Use CL_OSQL_TEST_ENVIRONMENT
|
||||
for the database access.
|
||||
54
tasks_gen/train/G1934/task.json
Normal file
54
tasks_gen/train/G1934/task.json
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"id": "G1934",
|
||||
"category": "B",
|
||||
"object_type": "TABL",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [],
|
||||
"contract": [
|
||||
{
|
||||
"type": "TABL",
|
||||
"name": "{{P}}PITCH",
|
||||
"fields": [
|
||||
"client",
|
||||
"booking_id",
|
||||
"pitch_no",
|
||||
"guest_name",
|
||||
"arrival_date",
|
||||
"departure_date",
|
||||
"persons",
|
||||
"power_hookup",
|
||||
"rate_per_night"
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T16_HIDDEN",
|
||||
"file": "hidden/t16_hidden.clas.abap",
|
||||
"description": "Checks the structure of {{P}}PITCH with RTTI and the database access with CL_OSQL_TEST_ENVIRONMENT"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "TABL",
|
||||
"name": "{{P}}PITCH",
|
||||
"file": "reference/pitch.tabl.asabap",
|
||||
"description": "Campsite pitch bookings"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T16_TEST",
|
||||
"file": "reference/t16_test.clas.abap",
|
||||
"description": "Own tests for {{P}}PITCH"
|
||||
}
|
||||
],
|
||||
"craft_checks": []
|
||||
}
|
||||
Reference in New Issue
Block a user