Snapshot: new training tasks (balanced generation), docs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
17
tasks_gen/train/G1932/faulty/m1_bowl.tabl.asabap
Normal file
17
tasks_gen/train/G1932/faulty/m1_bowl.tabl.asabap
Normal file
@@ -0,0 +1,17 @@
|
||||
@EndUserText.label : 'Bowling lane booking'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}bowl {
|
||||
key client : abap.clnt not null;
|
||||
key booking_id : abap.numc(10) not null;
|
||||
key lane_no : abap.numc(2) not null;
|
||||
play_hours : abap.dec(4,2);
|
||||
game_mode : abap.char(1);
|
||||
order_no : abap.char(10);
|
||||
play_date : abap.dats;
|
||||
player_count : abap.int4;
|
||||
league_code : abap.char(4);
|
||||
price_value : abap.dec(11,2);
|
||||
}
|
||||
17
tasks_gen/train/G1932/faulty/m2_bowl.tabl.asabap
Normal file
17
tasks_gen/train/G1932/faulty/m2_bowl.tabl.asabap
Normal file
@@ -0,0 +1,17 @@
|
||||
@EndUserText.label : 'Bowling lane booking'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}bowl {
|
||||
key client : abap.clnt not null;
|
||||
key booking_id : abap.char(9) not null;
|
||||
key lane_no : abap.numc(2) not null;
|
||||
play_hours : abap.dec(4,2);
|
||||
game_mode : abap.char(1);
|
||||
order_no : abap.char(10);
|
||||
play_date : abap.dats;
|
||||
player_count : abap.int4;
|
||||
league_code : abap.char(4);
|
||||
price_value : abap.dec(11,2);
|
||||
}
|
||||
17
tasks_gen/train/G1932/faulty/m3_bowl.tabl.asabap
Normal file
17
tasks_gen/train/G1932/faulty/m3_bowl.tabl.asabap
Normal file
@@ -0,0 +1,17 @@
|
||||
@EndUserText.label : 'Bowling lane booking'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}bowl {
|
||||
key client : abap.clnt not null;
|
||||
key booking_id : abap.char(10) not null;
|
||||
key lane_no : abap.numc(2) not null;
|
||||
play_hours : abap.dec(4,2);
|
||||
game_mode : abap.char(1);
|
||||
order_no : abap.char(10);
|
||||
play_date : abap.tims;
|
||||
player_count : abap.int4;
|
||||
league_code : abap.char(4);
|
||||
price_value : abap.dec(11,2);
|
||||
}
|
||||
17
tasks_gen/train/G1932/faulty/m4_bowl.tabl.asabap
Normal file
17
tasks_gen/train/G1932/faulty/m4_bowl.tabl.asabap
Normal file
@@ -0,0 +1,17 @@
|
||||
@EndUserText.label : 'Bowling lane booking'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}bowl {
|
||||
key client : abap.clnt not null;
|
||||
key booking_id : abap.char(10) not null;
|
||||
key lane_no : abap.numc(2) not null;
|
||||
play_hours : abap.dec(4,2);
|
||||
game_mode : abap.char(1);
|
||||
order_no : abap.char(10);
|
||||
play_date : abap.dats;
|
||||
player_count : abap.int4;
|
||||
league_code : abap.char(4);
|
||||
price_value : abap.dec(11,3);
|
||||
}
|
||||
42
tasks_gen/train/G1932/generation.json
Normal file
42
tasks_gen/train/G1932/generation.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"id": "G1932",
|
||||
"pool": "train",
|
||||
"object_type": "TABL",
|
||||
"category": "B",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"Too close to task G1912 (similarity spec 0.76, rules 0.51, names 0.00). Choose a different business topic and different object names."
|
||||
],
|
||||
"by_check": {
|
||||
"extra": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 0,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"hidden/bowl_hidden.clas.abap line 20: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"METHODS\""
|
||||
],
|
||||
"by_check": {
|
||||
"abaplint": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 4,
|
||||
"killed": 4,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
195
tasks_gen/train/G1932/hidden/bowl_hidden.clas.abap
Normal file
195
tasks_gen/train/G1932/hidden/bowl_hidden.clas.abap
Normal file
@@ -0,0 +1,195 @@
|
||||
CLASS {{p}}bowl_hidden 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 field_names FOR TESTING.
|
||||
METHODS key_fields FOR TESTING.
|
||||
METHODS char_fields FOR TESTING.
|
||||
METHODS numc_fields FOR TESTING.
|
||||
METHODS decimal_fields FOR TESTING.
|
||||
METHODS date_and_count FOR TESTING.
|
||||
METHODS no_reserved_names FOR TESTING.
|
||||
METHODS insert_and_read FOR TESTING.
|
||||
METHODS duplicate_booking FOR TESTING.
|
||||
METHODS get_field
|
||||
IMPORTING iv_name TYPE string
|
||||
RETURNING VALUE(rs_field) TYPE dfies.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}bowl_hidden IMPLEMENTATION.
|
||||
|
||||
METHOD class_setup.
|
||||
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}BOWL' ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD setup.
|
||||
go_env->clear_doubles( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_field.
|
||||
DATA lo_struct TYPE REF TO cl_abap_structdescr.
|
||||
lo_struct ?= cl_abap_typedescr=>describe_by_name( '{{P}}BOWL' ).
|
||||
DATA(lt_fields) = lo_struct->get_ddic_field_list( ).
|
||||
READ TABLE lt_fields INTO rs_field WITH KEY fieldname = iv_name.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 act = sy-subrc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD field_names.
|
||||
DATA lo_struct TYPE REF TO cl_abap_structdescr.
|
||||
lo_struct ?= cl_abap_typedescr=>describe_by_name( '{{P}}BOWL' ).
|
||||
DATA(lt_fields) = lo_struct->get_ddic_field_list( ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 10 act = lines( lt_fields ) ).
|
||||
|
||||
DATA lt_names TYPE STANDARD TABLE OF string WITH EMPTY KEY.
|
||||
lt_names = VALUE #( FOR ls_field IN lt_fields ( to_upper( ls_field-fieldname ) ) ).
|
||||
|
||||
DATA lt_expected TYPE STANDARD TABLE OF string WITH EMPTY KEY.
|
||||
lt_expected = VALUE #( ( `CLIENT` ) ( `BOOKING_ID` ) ( `LANE_NO` ) ( `PLAY_HOURS` )
|
||||
( `GAME_MODE` ) ( `ORDER_NO` ) ( `PLAY_DATE` )
|
||||
( `PLAYER_COUNT` ) ( `LEAGUE_CODE` ) ( `PRICE_VALUE` ) ).
|
||||
LOOP AT lt_expected INTO DATA(lv_name).
|
||||
READ TABLE lt_names TRANSPORTING NO FIELDS WITH KEY table_line = lv_name.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 act = sy-subrc
|
||||
msg = |Field { lv_name } is missing| ).
|
||||
ENDLOOP.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD key_fields.
|
||||
DATA lo_struct TYPE REF TO cl_abap_structdescr.
|
||||
lo_struct ?= cl_abap_typedescr=>describe_by_name( '{{P}}BOWL' ).
|
||||
DATA(lt_fields) = lo_struct->get_ddic_field_list( ).
|
||||
LOOP AT lt_fields INTO DATA(ls_field).
|
||||
DATA(lv_name) = to_upper( ls_field-fieldname ).
|
||||
IF lv_name = 'CLIENT' OR lv_name = 'BOOKING_ID' OR lv_name = 'LANE_NO'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'X' act = ls_field-keyflag ).
|
||||
ELSE.
|
||||
cl_abap_unit_assert=>assert_equals( exp = ' ' act = ls_field-keyflag ).
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD char_fields.
|
||||
DATA(ls_field) = get_field( 'BOOKING_ID' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'CHAR' act = ls_field-datatype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 10 act = ls_field-leng ).
|
||||
|
||||
ls_field = get_field( 'ORDER_NO' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'CHAR' act = ls_field-datatype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 10 act = ls_field-leng ).
|
||||
|
||||
ls_field = get_field( 'LEAGUE_CODE' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'CHAR' act = ls_field-datatype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4 act = ls_field-leng ).
|
||||
|
||||
ls_field = get_field( 'GAME_MODE' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'CHAR' act = ls_field-datatype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = ls_field-leng ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD numc_fields.
|
||||
DATA(ls_field) = get_field( 'LANE_NO' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'NUMC' act = ls_field-datatype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_field-leng ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD decimal_fields.
|
||||
DATA(ls_field) = get_field( 'PLAY_HOURS' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'DEC' act = ls_field-datatype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4 act = ls_field-leng ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_field-decimals ).
|
||||
|
||||
ls_field = get_field( 'PRICE_VALUE' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'DEC' act = ls_field-datatype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 11 act = ls_field-leng ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_field-decimals ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD date_and_count.
|
||||
DATA(ls_field) = get_field( 'PLAY_DATE' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'DATS' act = ls_field-datatype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 8 act = ls_field-leng ).
|
||||
|
||||
ls_field = get_field( 'PLAYER_COUNT' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'INT4' act = ls_field-datatype ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD no_reserved_names.
|
||||
DATA lo_struct TYPE REF TO cl_abap_structdescr.
|
||||
lo_struct ?= cl_abap_typedescr=>describe_by_name( '{{P}}BOWL' ).
|
||||
DATA(lt_fields) = lo_struct->get_ddic_field_list( ).
|
||||
|
||||
DATA lt_reserved TYPE STANDARD TABLE OF string WITH EMPTY KEY.
|
||||
lt_reserved = VALUE #( ( `HOURS` ) ( `MODE` ) ( `ORDER` ) ( `DATE` )
|
||||
( `COUNT` ) ( `GROUP` ) ( `VALUE` ) ( `NUMBER` ) ).
|
||||
|
||||
LOOP AT lt_fields INTO DATA(ls_field).
|
||||
DATA(lv_name) = to_upper( ls_field-fieldname ).
|
||||
READ TABLE lt_reserved TRANSPORTING NO FIELDS WITH KEY table_line = lv_name.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 4 act = sy-subrc
|
||||
msg = |Field name { lv_name } is a reserved word| ).
|
||||
ENDLOOP.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD insert_and_read.
|
||||
DATA lv_lane TYPE {{p}}bowl-lane_no.
|
||||
DATA ls_booking TYPE {{p}}bowl.
|
||||
ls_booking-client = sy-mandt.
|
||||
ls_booking-booking_id = 'B-0001'.
|
||||
ls_booking-lane_no = '01'.
|
||||
ls_booking-play_hours = '12.50'.
|
||||
ls_booking-game_mode = 'N'.
|
||||
ls_booking-order_no = 'ORD-0001'.
|
||||
ls_booking-play_date = '20240115'.
|
||||
ls_booking-player_count = 4.
|
||||
ls_booking-league_code = 'L-01'.
|
||||
ls_booking-price_value = '1234.50'.
|
||||
|
||||
INSERT {{p}}bowl FROM @ls_booking.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 act = sy-subrc ).
|
||||
|
||||
SELECT SINGLE * FROM {{p}}bowl
|
||||
WHERE booking_id = 'B-0001' AND lane_no = '01' INTO @DATA(ls_read).
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 act = sy-subrc ).
|
||||
|
||||
lv_lane = '01'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_lane act = ls_read-lane_no ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '12.50' )
|
||||
act = CONV decfloat34( ls_read-play_hours ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'N' act = ls_read-game_mode ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'ORD-0001' act = ls_read-order_no ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV d( '20240115' ) act = ls_read-play_date ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4 act = ls_read-player_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'L-01' act = ls_read-league_code ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '1234.50' )
|
||||
act = CONV decfloat34( ls_read-price_value ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD duplicate_booking.
|
||||
DATA ls_booking TYPE {{p}}bowl.
|
||||
ls_booking-client = sy-mandt.
|
||||
ls_booking-booking_id = 'B-0002'.
|
||||
ls_booking-lane_no = '02'.
|
||||
ls_booking-game_mode = 'L'.
|
||||
|
||||
INSERT {{p}}bowl FROM @ls_booking.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 act = sy-subrc ).
|
||||
|
||||
ls_booking-game_mode = 'N'.
|
||||
INSERT {{p}}bowl FROM @ls_booking.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4 act = sy-subrc ).
|
||||
|
||||
SELECT SINGLE game_mode FROM {{p}}bowl
|
||||
WHERE booking_id = 'B-0002' AND lane_no = '02' INTO @DATA(lv_mode).
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 act = sy-subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'L' act = lv_mode ).
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
55
tasks_gen/train/G1932/mutation.json
Normal file
55
tasks_gen/train/G1932/mutation.json
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"task": "G1932",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}BOWL",
|
||||
"mutant": "line 8: key booking_id : -> booking_id : (key)",
|
||||
"status": "invalid",
|
||||
"hidden": "0/0",
|
||||
"failed_tests": []
|
||||
},
|
||||
{
|
||||
"object": "{{P}}BOWL",
|
||||
"mutant": "line 8: abap.char(10) -> abap.numc(10) (type)",
|
||||
"status": "killed",
|
||||
"hidden": "6/9",
|
||||
"failed_tests": [
|
||||
"CHAR_FIELDS",
|
||||
"DUPLICATE_BOOKING",
|
||||
"INSERT_AND_READ"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}BOWL",
|
||||
"mutant": "line 8: abap.char(10) -> abap.char(9) (length)",
|
||||
"status": "killed",
|
||||
"hidden": "8/9",
|
||||
"failed_tests": [
|
||||
"CHAR_FIELDS"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}BOWL",
|
||||
"mutant": "line 13: abap.dats -> abap.tims (type)",
|
||||
"status": "killed",
|
||||
"hidden": "7/9",
|
||||
"failed_tests": [
|
||||
"DATE_AND_COUNT",
|
||||
"INSERT_AND_READ"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}BOWL",
|
||||
"mutant": "line 16: abap.dec(11,2) -> abap.dec(11,3) (decimals)",
|
||||
"status": "killed",
|
||||
"hidden": "8/9",
|
||||
"failed_tests": [
|
||||
"DECIMAL_FIELDS"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 4,
|
||||
"killed": 4,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
17
tasks_gen/train/G1932/reference/bowl.tabl.asabap
Normal file
17
tasks_gen/train/G1932/reference/bowl.tabl.asabap
Normal file
@@ -0,0 +1,17 @@
|
||||
@EndUserText.label : 'Bowling lane booking'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}bowl {
|
||||
key client : abap.clnt not null;
|
||||
key booking_id : abap.char(10) not null;
|
||||
key lane_no : abap.numc(2) not null;
|
||||
play_hours : abap.dec(4,2);
|
||||
game_mode : abap.char(1);
|
||||
order_no : abap.char(10);
|
||||
play_date : abap.dats;
|
||||
player_count : abap.int4;
|
||||
league_code : abap.char(4);
|
||||
price_value : abap.dec(11,2);
|
||||
}
|
||||
63
tasks_gen/train/G1932/reference/bowl_test.clas.abap
Normal file
63
tasks_gen/train/G1932/reference/bowl_test.clas.abap
Normal file
@@ -0,0 +1,63 @@
|
||||
CLASS {{p}}bowl_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 stores_a_booking FOR TESTING.
|
||||
METHODS rejects_duplicate_booking FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}bowl_test IMPLEMENTATION.
|
||||
|
||||
METHOD class_setup.
|
||||
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}BOWL' ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD setup.
|
||||
go_env->clear_doubles( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD stores_a_booking.
|
||||
DATA lv_lane TYPE {{p}}bowl-lane_no.
|
||||
DATA ls_booking TYPE {{p}}bowl.
|
||||
ls_booking-client = sy-mandt.
|
||||
ls_booking-booking_id = 'B-1000'.
|
||||
ls_booking-lane_no = '03'.
|
||||
ls_booking-play_hours = '2.50'.
|
||||
ls_booking-player_count = 2.
|
||||
|
||||
INSERT {{p}}bowl FROM @ls_booking.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 act = sy-subrc ).
|
||||
|
||||
SELECT SINGLE play_hours, player_count, lane_no FROM {{p}}bowl
|
||||
WHERE booking_id = 'B-1000' AND lane_no = '03' INTO @DATA(ls_read).
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 act = sy-subrc ).
|
||||
|
||||
lv_lane = '03'.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_lane act = ls_read-lane_no ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '2.50' )
|
||||
act = CONV decfloat34( ls_read-play_hours ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_read-player_count ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_duplicate_booking.
|
||||
DATA ls_booking TYPE {{p}}bowl.
|
||||
ls_booking-client = sy-mandt.
|
||||
ls_booking-booking_id = 'B-1001'.
|
||||
ls_booking-lane_no = '04'.
|
||||
|
||||
INSERT {{p}}bowl FROM @ls_booking.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 act = sy-subrc ).
|
||||
|
||||
INSERT {{p}}bowl FROM @ls_booking.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4 act = sy-subrc ).
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
69
tasks_gen/train/G1932/spec.md
Normal file
69
tasks_gen/train/G1932/spec.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# 1. Goal
|
||||
The bowling alley "Strike Lane" needs a database table for its lane bookings.
|
||||
The booking desk will read the bookings with ABAP SQL and later with a CDS view.
|
||||
In their daily work the staff use the words hours, mode, order, date, count,
|
||||
group and value. These words are reserved words in ABAP SQL. The new table must
|
||||
therefore use safe field names.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
The bowling alley has 12 lanes. A guest books one lane for a time slot. The
|
||||
booking desk writes one row for each booking into the new table. The table is
|
||||
the first object of the bowling alley in package $TMP. No other object exists.
|
||||
|
||||
# 4. Contract
|
||||
Create the transparent database table {{P}}BOWL in package $TMP. The table has
|
||||
the following fields, in this order, with these names:
|
||||
|
||||
- client: CLNT 3, key
|
||||
- booking_id: CHAR 10, key
|
||||
- lane_no: NUMC 2, key
|
||||
- play_hours: DEC 4,2
|
||||
- game_mode: CHAR 1
|
||||
- order_no: CHAR 10
|
||||
- play_date: DATS
|
||||
- player_count: INT4
|
||||
- league_code: CHAR 4
|
||||
- price_value: DEC 11,2
|
||||
|
||||
# 5. Business rules
|
||||
1. The key of the table is the combination of client, booking_id and lane_no.
|
||||
No other field is a key field.
|
||||
2. play_hours is the booked time in hours. It has 4 characters and 2 decimals.
|
||||
3. game_mode is a single character. 'N' means a normal game, 'L' means a league
|
||||
game.
|
||||
4. order_no is the number of the order that the guest paid at the counter. It
|
||||
has 10 characters.
|
||||
5. play_date is the day of the booking.
|
||||
6. player_count is the number of players on the lane. It is a whole number.
|
||||
7. league_code is the code of the league. It has 4 characters. For a normal
|
||||
game the field is empty.
|
||||
8. price_value is the value of the booking in the local currency. It has 11
|
||||
characters and 2 decimals.
|
||||
9. No field name is a reserved word of ABAP SQL. The table must not have a
|
||||
field with the name hours, mode, order, date, count, group or value.
|
||||
10. The booking number is unique for one client and one lane. A second INSERT
|
||||
with the same client, the same booking number and the same lane number does
|
||||
not change the table and gives sy-subrc = 4.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: ABAP Platform 2025 (SAP_BASIS 816). Package $TMP. No
|
||||
transport.
|
||||
- Use only the built-in Dictionary types abap.clnt, abap.char, abap.numc,
|
||||
abap.dats, abap.int4 and abap.dec. Do not use abap.curr or abap.quan.
|
||||
- Write the table as a DDL source with the annotations @EndUserText.label,
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE,
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT, @AbapCatalog.deliveryClass : #A
|
||||
and @AbapCatalog.dataMaintenance : #RESTRICTED. Declare the key fields as
|
||||
not null.
|
||||
- Do not create any other repository object than the table and your own test
|
||||
class.
|
||||
- Out of scope: a CDS view, a report, a function module and a class with
|
||||
business logic.
|
||||
|
||||
# 7. Acceptance
|
||||
- The table {{P}}BOWL is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write ABAP Unit tests with CL_OSQL_TEST_ENVIRONMENT in a global test class.
|
||||
55
tasks_gen/train/G1932/task.json
Normal file
55
tasks_gen/train/G1932/task.json
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"id": "G1932",
|
||||
"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}}BOWL",
|
||||
"fields": [
|
||||
"client",
|
||||
"booking_id",
|
||||
"lane_no",
|
||||
"play_hours",
|
||||
"game_mode",
|
||||
"order_no",
|
||||
"play_date",
|
||||
"player_count",
|
||||
"league_code",
|
||||
"price_value"
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}BOWL_HIDDEN",
|
||||
"file": "hidden/bowl_hidden.clas.abap",
|
||||
"description": "Hidden tests for the bowling lane booking table"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "TABL",
|
||||
"name": "{{P}}BOWL",
|
||||
"file": "reference/bowl.tabl.asabap",
|
||||
"description": "Bowling lane booking table"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}BOWL_TEST",
|
||||
"file": "reference/bowl_test.clas.abap",
|
||||
"description": "Own tests for the table"
|
||||
}
|
||||
],
|
||||
"craft_checks": []
|
||||
}
|
||||
Reference in New Issue
Block a user