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/G1919/faulty/m0_rescue.tabl.asabap
Normal file
17
tasks_gen/train/G1919/faulty/m0_rescue.tabl.asabap
Normal file
@@ -0,0 +1,17 @@
|
||||
@EndUserText.label : 'Mountain rescue callout'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}rescue {
|
||||
key client : abap.clnt not null;
|
||||
callout_id : abap.char(10) not null;
|
||||
callout_date : abap.dats not null;
|
||||
location : abap.char(30);
|
||||
duration_min : abap.int4;
|
||||
team_size : abap.int4;
|
||||
rescued_count : abap.int4;
|
||||
@Semantics.amount.currencyCode : '{{p}}rescue.currency_code'
|
||||
fee_amount : abap.dec(13,2);
|
||||
currency_code : abap.cuky;
|
||||
}
|
||||
17
tasks_gen/train/G1919/faulty/m1_rescue.tabl.asabap
Normal file
17
tasks_gen/train/G1919/faulty/m1_rescue.tabl.asabap
Normal file
@@ -0,0 +1,17 @@
|
||||
@EndUserText.label : 'Mountain rescue callout'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}rescue {
|
||||
key client : abap.clnt not null;
|
||||
key callout_id : abap.char(9) not null;
|
||||
callout_date : abap.dats not null;
|
||||
location : abap.char(30);
|
||||
duration_min : abap.int4;
|
||||
team_size : abap.int4;
|
||||
rescued_count : abap.int4;
|
||||
@Semantics.amount.currencyCode : '{{p}}rescue.currency_code'
|
||||
fee_amount : abap.dec(13,2);
|
||||
currency_code : abap.cuky;
|
||||
}
|
||||
17
tasks_gen/train/G1919/faulty/m2_rescue.tabl.asabap
Normal file
17
tasks_gen/train/G1919/faulty/m2_rescue.tabl.asabap
Normal file
@@ -0,0 +1,17 @@
|
||||
@EndUserText.label : 'Mountain rescue callout'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}rescue {
|
||||
key client : abap.clnt not null;
|
||||
key callout_id : abap.char(10) not null;
|
||||
callout_date : abap.tims not null;
|
||||
location : abap.char(30);
|
||||
duration_min : abap.int4;
|
||||
team_size : abap.int4;
|
||||
rescued_count : abap.int4;
|
||||
@Semantics.amount.currencyCode : '{{p}}rescue.currency_code'
|
||||
fee_amount : abap.dec(13,2);
|
||||
currency_code : abap.cuky;
|
||||
}
|
||||
17
tasks_gen/train/G1919/faulty/m3_rescue.tabl.asabap
Normal file
17
tasks_gen/train/G1919/faulty/m3_rescue.tabl.asabap
Normal file
@@ -0,0 +1,17 @@
|
||||
@EndUserText.label : 'Mountain rescue callout'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}rescue {
|
||||
key client : abap.clnt not null;
|
||||
key callout_id : abap.char(10) not null;
|
||||
callout_date : abap.dats not null;
|
||||
location : abap.numc(30);
|
||||
duration_min : abap.int4;
|
||||
team_size : abap.int4;
|
||||
rescued_count : abap.int4;
|
||||
@Semantics.amount.currencyCode : '{{p}}rescue.currency_code'
|
||||
fee_amount : abap.dec(13,2);
|
||||
currency_code : abap.cuky;
|
||||
}
|
||||
17
tasks_gen/train/G1919/faulty/m4_rescue.tabl.asabap
Normal file
17
tasks_gen/train/G1919/faulty/m4_rescue.tabl.asabap
Normal file
@@ -0,0 +1,17 @@
|
||||
@EndUserText.label : 'Mountain rescue callout'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}rescue {
|
||||
key client : abap.clnt not null;
|
||||
key callout_id : abap.char(10) not null;
|
||||
callout_date : abap.dats not null;
|
||||
location : abap.char(30);
|
||||
duration_min : abap.int4;
|
||||
team_size : abap.int4;
|
||||
rescued_count : abap.int4;
|
||||
@Semantics.amount.currencyCode : '{{p}}rescue.currency_code'
|
||||
fee_amount : abap.dec(13,3);
|
||||
currency_code : abap.cuky;
|
||||
}
|
||||
19
tasks_gen/train/G1919/generation.json
Normal file
19
tasks_gen/train/G1919/generation.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"id": "G1919",
|
||||
"pool": "train",
|
||||
"object_type": "TABL",
|
||||
"category": "B",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
203
tasks_gen/train/G1919/hidden/t20_hidden.clas.abap
Normal file
203
tasks_gen/train/G1919/hidden/t20_hidden.clas.abap
Normal file
@@ -0,0 +1,203 @@
|
||||
CLASS {{p}}t20_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.
|
||||
CLASS-METHODS get_fields RETURNING VALUE(rt_fields) TYPE ddfields.
|
||||
CLASS-METHODS field_of
|
||||
IMPORTING iv_name TYPE fieldname
|
||||
RETURNING VALUE(rs_field) TYPE dfies.
|
||||
CLASS-METHODS not_null_flag
|
||||
IMPORTING iv_name TYPE fieldname
|
||||
RETURNING VALUE(rv_flag) TYPE abap_bool.
|
||||
METHODS setup.
|
||||
METHODS field_names FOR TESTING.
|
||||
METHODS key_fields FOR TESTING.
|
||||
METHODS field_types FOR TESTING.
|
||||
METHODS field_lengths FOR TESTING.
|
||||
METHODS decimals FOR TESTING.
|
||||
METHODS not_null_fields FOR TESTING.
|
||||
METHODS store_and_read FOR TESTING.
|
||||
METHODS duplicate_key FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t20_hidden IMPLEMENTATION.
|
||||
|
||||
METHOD class_setup.
|
||||
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}RESCUE' ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD setup.
|
||||
go_env->clear_doubles( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_fields.
|
||||
DATA lo_struct TYPE REF TO cl_abap_structdescr.
|
||||
lo_struct ?= cl_abap_typedescr=>describe_by_name( '{{P}}RESCUE' ).
|
||||
rt_fields = lo_struct->get_ddic_field_list( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD field_of.
|
||||
DATA(lt_fields) = get_fields( ).
|
||||
LOOP AT lt_fields INTO DATA(ls_field) WHERE fieldname = iv_name.
|
||||
rs_field = ls_field.
|
||||
RETURN.
|
||||
ENDLOOP.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD not_null_flag.
|
||||
SELECT SINGLE notnull FROM dd03l
|
||||
WHERE tabname = '{{P}}RESCUE' AND fieldname = @iv_name AND as4local = 'A'
|
||||
INTO @rv_flag.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD field_names.
|
||||
DATA(lt_fields) = get_fields( ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 9 act = lines( lt_fields ) ).
|
||||
DATA(ls_field) = field_of( 'CLIENT' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'CLIENT' act = ls_field-fieldname ).
|
||||
ls_field = field_of( 'CALLOUT_ID' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'CALLOUT_ID' act = ls_field-fieldname ).
|
||||
ls_field = field_of( 'CALLOUT_DATE' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'CALLOUT_DATE' act = ls_field-fieldname ).
|
||||
ls_field = field_of( 'LOCATION' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'LOCATION' act = ls_field-fieldname ).
|
||||
ls_field = field_of( 'DURATION_MIN' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'DURATION_MIN' act = ls_field-fieldname ).
|
||||
ls_field = field_of( 'TEAM_SIZE' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'TEAM_SIZE' act = ls_field-fieldname ).
|
||||
ls_field = field_of( 'RESCUED_COUNT' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'RESCUED_COUNT' act = ls_field-fieldname ).
|
||||
ls_field = field_of( 'FEE_AMOUNT' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'FEE_AMOUNT' act = ls_field-fieldname ).
|
||||
ls_field = field_of( 'CURRENCY_CODE' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'CURRENCY_CODE' act = ls_field-fieldname ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD key_fields.
|
||||
DATA(ls_field) = field_of( 'CLIENT' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'X' act = ls_field-keyflag ).
|
||||
ls_field = field_of( 'CALLOUT_ID' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'X' act = ls_field-keyflag ).
|
||||
ls_field = field_of( 'CALLOUT_DATE' ).
|
||||
cl_abap_unit_assert=>assert_initial( act = ls_field-keyflag ).
|
||||
ls_field = field_of( 'LOCATION' ).
|
||||
cl_abap_unit_assert=>assert_initial( act = ls_field-keyflag ).
|
||||
ls_field = field_of( 'DURATION_MIN' ).
|
||||
cl_abap_unit_assert=>assert_initial( act = ls_field-keyflag ).
|
||||
ls_field = field_of( 'TEAM_SIZE' ).
|
||||
cl_abap_unit_assert=>assert_initial( act = ls_field-keyflag ).
|
||||
ls_field = field_of( 'RESCUED_COUNT' ).
|
||||
cl_abap_unit_assert=>assert_initial( act = ls_field-keyflag ).
|
||||
ls_field = field_of( 'FEE_AMOUNT' ).
|
||||
cl_abap_unit_assert=>assert_initial( act = ls_field-keyflag ).
|
||||
ls_field = field_of( 'CURRENCY_CODE' ).
|
||||
cl_abap_unit_assert=>assert_initial( act = ls_field-keyflag ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD field_types.
|
||||
DATA(ls_field) = field_of( 'CLIENT' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'CLNT' act = ls_field-datatype ).
|
||||
ls_field = field_of( 'CALLOUT_ID' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'CHAR' act = ls_field-datatype ).
|
||||
ls_field = field_of( 'CALLOUT_DATE' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'DATS' act = ls_field-datatype ).
|
||||
ls_field = field_of( 'LOCATION' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'CHAR' act = ls_field-datatype ).
|
||||
ls_field = field_of( 'DURATION_MIN' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'INT4' act = ls_field-datatype ).
|
||||
ls_field = field_of( 'TEAM_SIZE' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'INT4' act = ls_field-datatype ).
|
||||
ls_field = field_of( 'RESCUED_COUNT' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'INT4' act = ls_field-datatype ).
|
||||
ls_field = field_of( 'FEE_AMOUNT' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'DEC' act = ls_field-datatype ).
|
||||
ls_field = field_of( 'CURRENCY_CODE' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'CUKY' act = ls_field-datatype ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD field_lengths.
|
||||
DATA(ls_field) = field_of( 'CLIENT' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = CONV i( ls_field-leng ) ).
|
||||
ls_field = field_of( 'CALLOUT_ID' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 10 act = CONV i( ls_field-leng ) ).
|
||||
ls_field = field_of( 'CALLOUT_DATE' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 8 act = CONV i( ls_field-leng ) ).
|
||||
ls_field = field_of( 'LOCATION' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 30 act = CONV i( ls_field-leng ) ).
|
||||
ls_field = field_of( 'DURATION_MIN' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 10 act = CONV i( ls_field-leng ) ).
|
||||
ls_field = field_of( 'TEAM_SIZE' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 10 act = CONV i( ls_field-leng ) ).
|
||||
ls_field = field_of( 'RESCUED_COUNT' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 10 act = CONV i( ls_field-leng ) ).
|
||||
ls_field = field_of( 'FEE_AMOUNT' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 13 act = CONV i( ls_field-leng ) ).
|
||||
ls_field = field_of( 'CURRENCY_CODE' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 5 act = CONV i( ls_field-leng ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD decimals.
|
||||
DATA(ls_field) = field_of( 'FEE_AMOUNT' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = CONV i( ls_field-decimals ) ).
|
||||
ls_field = field_of( 'DURATION_MIN' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = CONV i( ls_field-decimals ) ).
|
||||
ls_field = field_of( 'CURRENCY_CODE' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = CONV i( ls_field-decimals ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD not_null_fields.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'X' act = not_null_flag( 'CLIENT' ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'X' act = not_null_flag( 'CALLOUT_ID' ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'X' act = not_null_flag( 'CALLOUT_DATE' ) ).
|
||||
cl_abap_unit_assert=>assert_initial( act = not_null_flag( 'LOCATION' ) ).
|
||||
cl_abap_unit_assert=>assert_initial( act = not_null_flag( 'DURATION_MIN' ) ).
|
||||
cl_abap_unit_assert=>assert_initial( act = not_null_flag( 'TEAM_SIZE' ) ).
|
||||
cl_abap_unit_assert=>assert_initial( act = not_null_flag( 'RESCUED_COUNT' ) ).
|
||||
cl_abap_unit_assert=>assert_initial( act = not_null_flag( 'FEE_AMOUNT' ) ).
|
||||
cl_abap_unit_assert=>assert_initial( act = not_null_flag( 'CURRENCY_CODE' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD store_and_read.
|
||||
DATA ls_rescue TYPE {{p}}rescue.
|
||||
ls_rescue-client = sy-mandt.
|
||||
ls_rescue-callout_id = 'C0001'.
|
||||
ls_rescue-callout_date = '20250115'.
|
||||
ls_rescue-location = 'NORTH RIDGE'.
|
||||
ls_rescue-duration_min = 95.
|
||||
ls_rescue-team_size = 6.
|
||||
ls_rescue-rescued_count = 2.
|
||||
ls_rescue-fee_amount = '1250.50'.
|
||||
ls_rescue-currency_code = 'EUR'.
|
||||
INSERT {{p}}rescue FROM @ls_rescue.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
|
||||
DATA ls_read TYPE {{p}}rescue.
|
||||
SELECT SINGLE * FROM {{p}}rescue WHERE callout_id = 'C0001' INTO @ls_read.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'NORTH RIDGE' act = ls_read-location ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = '20250115' act = ls_read-callout_date ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 95 act = ls_read-duration_min ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 6 act = ls_read-team_size ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_read-rescued_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '1250.50' )
|
||||
act = CONV decfloat34( ls_read-fee_amount ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'EUR' act = ls_read-currency_code ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD duplicate_key.
|
||||
DATA ls_rescue TYPE {{p}}rescue.
|
||||
ls_rescue-client = sy-mandt.
|
||||
ls_rescue-callout_id = 'C0002'.
|
||||
ls_rescue-callout_date = '20250116'.
|
||||
INSERT {{p}}rescue FROM @ls_rescue.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
INSERT {{p}}rescue FROM @ls_rescue.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 4 ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
57
tasks_gen/train/G1919/mutation.json
Normal file
57
tasks_gen/train/G1919/mutation.json
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"task": "G1919",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}RESCUE",
|
||||
"mutant": "line 8: key callout_id : -> callout_id : (key)",
|
||||
"status": "killed",
|
||||
"hidden": "7/8",
|
||||
"failed_tests": [
|
||||
"KEY_FIELDS"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}RESCUE",
|
||||
"mutant": "line 8: abap.char(10) -> abap.char(9) (length)",
|
||||
"status": "killed",
|
||||
"hidden": "7/8",
|
||||
"failed_tests": [
|
||||
"FIELD_LENGTHS"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}RESCUE",
|
||||
"mutant": "line 9: abap.dats -> abap.tims (type)",
|
||||
"status": "killed",
|
||||
"hidden": "5/8",
|
||||
"failed_tests": [
|
||||
"FIELD_LENGTHS",
|
||||
"FIELD_TYPES",
|
||||
"STORE_AND_READ"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}RESCUE",
|
||||
"mutant": "line 10: abap.char(30) -> abap.numc(30) (type)",
|
||||
"status": "killed",
|
||||
"hidden": "6/8",
|
||||
"failed_tests": [
|
||||
"FIELD_TYPES",
|
||||
"STORE_AND_READ"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}RESCUE",
|
||||
"mutant": "line 15: abap.dec(13,2) -> abap.dec(13,3) (decimals)",
|
||||
"status": "killed",
|
||||
"hidden": "7/8",
|
||||
"failed_tests": [
|
||||
"DECIMALS"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
17
tasks_gen/train/G1919/reference/rescue.tabl.asabap
Normal file
17
tasks_gen/train/G1919/reference/rescue.tabl.asabap
Normal file
@@ -0,0 +1,17 @@
|
||||
@EndUserText.label : 'Mountain rescue callout'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}rescue {
|
||||
key client : abap.clnt not null;
|
||||
key callout_id : abap.char(10) not null;
|
||||
callout_date : abap.dats not null;
|
||||
location : abap.char(30);
|
||||
duration_min : abap.int4;
|
||||
team_size : abap.int4;
|
||||
rescued_count : abap.int4;
|
||||
@Semantics.amount.currencyCode : '{{p}}rescue.currency_code'
|
||||
fee_amount : abap.dec(13,2);
|
||||
currency_code : abap.cuky;
|
||||
}
|
||||
73
tasks_gen/train/G1919/reference/t20_test.clas.abap
Normal file
73
tasks_gen/train/G1919/reference/t20_test.clas.abap
Normal file
@@ -0,0 +1,73 @@
|
||||
CLASS {{p}}t20_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_callout FOR TESTING.
|
||||
METHODS rejects_duplicate FOR TESTING.
|
||||
METHODS keeps_amount FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t20_test IMPLEMENTATION.
|
||||
|
||||
METHOD class_setup.
|
||||
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}RESCUE' ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD setup.
|
||||
go_env->clear_doubles( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD stores_callout.
|
||||
DATA ls_rescue TYPE {{p}}rescue.
|
||||
ls_rescue-client = sy-mandt.
|
||||
ls_rescue-callout_id = 'R0001'.
|
||||
ls_rescue-callout_date = '20250310'.
|
||||
ls_rescue-location = 'EAST FACE'.
|
||||
ls_rescue-duration_min = 120.
|
||||
ls_rescue-team_size = 5.
|
||||
ls_rescue-rescued_count = 1.
|
||||
ls_rescue-fee_amount = '980.00'.
|
||||
ls_rescue-currency_code = 'EUR'.
|
||||
INSERT {{p}}rescue FROM @ls_rescue.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
|
||||
DATA ls_read TYPE {{p}}rescue.
|
||||
SELECT SINGLE * FROM {{p}}rescue WHERE callout_id = 'R0001' INTO @ls_read.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'EAST FACE' act = ls_read-location ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 120 act = ls_read-duration_min ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_duplicate.
|
||||
DATA ls_rescue TYPE {{p}}rescue.
|
||||
ls_rescue-client = sy-mandt.
|
||||
ls_rescue-callout_id = 'R0002'.
|
||||
ls_rescue-callout_date = '20250311'.
|
||||
INSERT {{p}}rescue FROM @ls_rescue.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
INSERT {{p}}rescue FROM @ls_rescue.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 4 ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD keeps_amount.
|
||||
DATA ls_rescue TYPE {{p}}rescue.
|
||||
ls_rescue-client = sy-mandt.
|
||||
ls_rescue-callout_id = 'R0003'.
|
||||
ls_rescue-callout_date = '20250312'.
|
||||
ls_rescue-fee_amount = '1234.56'.
|
||||
ls_rescue-currency_code = 'CHF'.
|
||||
INSERT {{p}}rescue FROM @ls_rescue.
|
||||
|
||||
DATA ls_read TYPE {{p}}rescue.
|
||||
SELECT SINGLE * FROM {{p}}rescue WHERE callout_id = 'R0003' INTO @ls_read.
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '1234.56' )
|
||||
act = CONV decfloat34( ls_read-fee_amount ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
53
tasks_gen/train/G1919/spec.md
Normal file
53
tasks_gen/train/G1919/spec.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# 1. Goal
|
||||
A mountain rescue service records each callout of its rescue teams. The service
|
||||
must store the callouts in a database table. A report and an OData service read
|
||||
the callouts later. Therefore the table needs a fixed structure.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Package $TMP, client 001. No transports.
|
||||
- The table is new. No other object of this task exists.
|
||||
- A callout is the work of one rescue team for one incident.
|
||||
- The client and the callout ID identify one callout.
|
||||
|
||||
# 4. Contract
|
||||
- Create the database table {{P}}RESCUE in package $TMP.
|
||||
- The table contains these fields, in this order:
|
||||
client, callout_id, callout_date, location, duration_min, team_size,
|
||||
rescued_count, fee_amount, currency_code.
|
||||
|
||||
# 5. Business rules
|
||||
1. The key fields of the table are client and callout_id.
|
||||
2. client has the type abap.clnt and is not null.
|
||||
3. callout_id has the type abap.char(10) and is not null. A callout ID is
|
||||
unique for one client.
|
||||
4. callout_date has the type abap.dats and is not null. It is the day of the
|
||||
callout.
|
||||
5. location has the type abap.char(30). It is the place of the incident. The
|
||||
location can be empty.
|
||||
6. duration_min has the type abap.int4. It is the duration of the callout in
|
||||
minutes.
|
||||
7. team_size has the type abap.int4. It is the number of rescuers.
|
||||
8. rescued_count has the type abap.int4. It is the number of persons that the
|
||||
team rescued.
|
||||
9. fee_amount has the type abap.dec(13,2). It is the fee for the callout.
|
||||
10. currency_code has the type abap.cuky. It is the currency of fee_amount.
|
||||
fee_amount is an amount and refers to the currency field of the same table.
|
||||
11. The table keeps one row for each pair of client and callout_id. A second
|
||||
insert with the same pair returns sy-subrc = 4.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16.
|
||||
- Use only built-in types: abap.clnt, abap.char, abap.dats, abap.int4,
|
||||
abap.dec, abap.cuky.
|
||||
- The table is not extensible. Delivery class A. Data maintenance is
|
||||
restricted.
|
||||
- Write clean ABAP. Do not create ATC priority 1 or priority 2 findings.
|
||||
- Out of scope: all other objects in package $TMP.
|
||||
|
||||
# 7. Acceptance
|
||||
- The table {{P}}RESCUE 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.
|
||||
56
tasks_gen/train/G1919/task.json
Normal file
56
tasks_gen/train/G1919/task.json
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"id": "G1919",
|
||||
"category": "B",
|
||||
"object_type": "TABL",
|
||||
"difficulty": 3,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [],
|
||||
"contract": [
|
||||
{
|
||||
"type": "TABL",
|
||||
"name": "{{P}}RESCUE",
|
||||
"fields": [
|
||||
"client",
|
||||
"callout_id",
|
||||
"callout_date",
|
||||
"location",
|
||||
"duration_min",
|
||||
"team_size",
|
||||
"rescued_count",
|
||||
"fee_amount",
|
||||
"currency_code"
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"Other objects in package $TMP"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T20_HIDDEN",
|
||||
"file": "hidden/t20_hidden.clas.abap",
|
||||
"description": "Structure and storage tests for {{P}}RESCUE"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "TABL",
|
||||
"name": "{{P}}RESCUE",
|
||||
"file": "reference/rescue.tabl.asabap",
|
||||
"description": "Mountain rescue callouts"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T20_TEST",
|
||||
"file": "reference/t20_test.clas.abap",
|
||||
"description": "Own tests for {{P}}RESCUE"
|
||||
}
|
||||
],
|
||||
"craft_checks": []
|
||||
}
|
||||
Reference in New Issue
Block a user