Snapshot: new training tasks (balanced generation), docs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
18
tasks_gen/train/G1939/faulty/m0_pluck.tabl.asabap
Normal file
18
tasks_gen/train/G1939/faulty/m0_pluck.tabl.asabap
Normal file
@@ -0,0 +1,18 @@
|
||||
@EndUserText.label : 'Tea leaf plucking batch'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}pluck {
|
||||
key client : abap.clnt not null;
|
||||
pluck_id : abap.char(10) not null;
|
||||
field_id : abap.char(6) not null;
|
||||
pluck_date : abap.dats not null;
|
||||
team_no : abap.numc(4);
|
||||
leaf_weight : abap.dec(13,3) not null;
|
||||
leaf_grade : abap.char(2);
|
||||
moisture : abap.dec(5,2);
|
||||
wither_min : abap.int4;
|
||||
price_per_kg : abap.dec(11,2);
|
||||
note : abap.char(40);
|
||||
}
|
||||
18
tasks_gen/train/G1939/faulty/m1_pluck.tabl.asabap
Normal file
18
tasks_gen/train/G1939/faulty/m1_pluck.tabl.asabap
Normal file
@@ -0,0 +1,18 @@
|
||||
@EndUserText.label : 'Tea leaf plucking batch'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}pluck {
|
||||
key client : abap.clnt not null;
|
||||
key pluck_id : abap.char(10) not null;
|
||||
field_id : abap.char(6) not null;
|
||||
pluck_date : abap.tims not null;
|
||||
team_no : abap.numc(4);
|
||||
leaf_weight : abap.dec(13,3) not null;
|
||||
leaf_grade : abap.char(2);
|
||||
moisture : abap.dec(5,2);
|
||||
wither_min : abap.int4;
|
||||
price_per_kg : abap.dec(11,2);
|
||||
note : abap.char(40);
|
||||
}
|
||||
18
tasks_gen/train/G1939/faulty/m2_pluck.tabl.asabap
Normal file
18
tasks_gen/train/G1939/faulty/m2_pluck.tabl.asabap
Normal file
@@ -0,0 +1,18 @@
|
||||
@EndUserText.label : 'Tea leaf plucking batch'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}pluck {
|
||||
key client : abap.clnt not null;
|
||||
key pluck_id : abap.char(10) not null;
|
||||
field_id : abap.char(6) not null;
|
||||
pluck_date : abap.dats not null;
|
||||
team_no : abap.numc(3);
|
||||
leaf_weight : abap.dec(13,3) not null;
|
||||
leaf_grade : abap.char(2);
|
||||
moisture : abap.dec(5,2);
|
||||
wither_min : abap.int4;
|
||||
price_per_kg : abap.dec(11,2);
|
||||
note : abap.char(40);
|
||||
}
|
||||
18
tasks_gen/train/G1939/faulty/m4_pluck.tabl.asabap
Normal file
18
tasks_gen/train/G1939/faulty/m4_pluck.tabl.asabap
Normal file
@@ -0,0 +1,18 @@
|
||||
@EndUserText.label : 'Tea leaf plucking batch'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}pluck {
|
||||
key client : abap.clnt not null;
|
||||
key pluck_id : abap.char(10) not null;
|
||||
field_id : abap.char(6) not null;
|
||||
pluck_date : abap.dats not null;
|
||||
team_no : abap.numc(4);
|
||||
leaf_weight : abap.dec(13,3) not null;
|
||||
leaf_grade : abap.char(2);
|
||||
moisture : abap.dec(5,2);
|
||||
wither_min : abap.int4;
|
||||
price_per_kg : abap.dec(11,3);
|
||||
note : abap.char(40);
|
||||
}
|
||||
24
tasks_gen/train/G1939/generation.json
Normal file
24
tasks_gen/train/G1939/generation.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"id": "G1939",
|
||||
"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": 4,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
171
tasks_gen/train/G1939/hidden/pluck_hidden.clas.abap
Normal file
171
tasks_gen/train/G1939/hidden/pluck_hidden.clas.abap
Normal file
@@ -0,0 +1,171 @@
|
||||
CLASS {{p}}pluck_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
TYPES ty_name_tab TYPE STANDARD TABLE OF fieldname WITH EMPTY KEY.
|
||||
TYPES ty_field_tab TYPE STANDARD TABLE OF dfies WITH EMPTY KEY.
|
||||
CLASS-DATA go_env TYPE REF TO if_osql_test_environment.
|
||||
CLASS-DATA gt_fields TYPE ty_field_tab.
|
||||
CLASS-METHODS class_setup.
|
||||
CLASS-METHODS class_teardown.
|
||||
METHODS setup.
|
||||
METHODS field_names FOR TESTING.
|
||||
METHODS key_fields FOR TESTING.
|
||||
METHODS char_lengths FOR TESTING.
|
||||
METHODS packed_lengths FOR TESTING.
|
||||
METHODS other_types FOR TESTING.
|
||||
METHODS insert_and_read FOR TESTING.
|
||||
METHODS duplicate_key FOR TESTING.
|
||||
METHODS empty_fields FOR TESTING.
|
||||
METHODS get_field
|
||||
IMPORTING iv_name TYPE fieldname
|
||||
RETURNING VALUE(rs_field) TYPE dfies.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}pluck_hidden IMPLEMENTATION.
|
||||
|
||||
METHOD class_setup.
|
||||
DATA lo_descr TYPE REF TO cl_abap_typedescr.
|
||||
DATA lo_line TYPE REF TO cl_abap_typedescr.
|
||||
DATA lo_struct TYPE REF TO cl_abap_structdescr.
|
||||
lo_descr = cl_abap_typedescr=>describe_by_name( '{{P}}PLUCK' ).
|
||||
IF lo_descr->kind = cl_abap_typedescr=>kind_table.
|
||||
lo_line = CAST cl_abap_tabledescr( lo_descr )->get_table_line_type( ).
|
||||
lo_struct = CAST cl_abap_structdescr( lo_line ).
|
||||
ELSE.
|
||||
lo_struct = CAST cl_abap_structdescr( lo_descr ).
|
||||
ENDIF.
|
||||
gt_fields = lo_struct->get_ddic_field_list( ).
|
||||
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}PLUCK' ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD setup.
|
||||
go_env->clear_doubles( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_field.
|
||||
READ TABLE gt_fields WITH KEY fieldname = iv_name INTO rs_field.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD field_names.
|
||||
DATA(lt_expected) = VALUE ty_name_tab( ( 'CLIENT' ) ( 'PLUCK_ID' ) ( 'FIELD_ID' )
|
||||
( 'PLUCK_DATE' ) ( 'TEAM_NO' ) ( 'LEAF_WEIGHT' )
|
||||
( 'LEAF_GRADE' ) ( 'MOISTURE' ) ( 'WITHER_MIN' )
|
||||
( 'PRICE_PER_KG' ) ( 'NOTE' ) ).
|
||||
DATA lv_index TYPE i.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lines( lt_expected ) act = lines( gt_fields ) ).
|
||||
LOOP AT lt_expected INTO DATA(lv_name).
|
||||
lv_index = lv_index + 1.
|
||||
READ TABLE gt_fields INTO DATA(ls_field) INDEX lv_index.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_name act = ls_field-fieldname ).
|
||||
ENDLOOP.
|
||||
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( 'PLUCK_ID' )-keyflag ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = ' ' act = get_field( 'FIELD_ID' )-keyflag ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = ' ' act = get_field( 'PLUCK_DATE' )-keyflag ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = ' ' act = get_field( 'NOTE' )-keyflag ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD char_lengths.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = get_field( 'CLIENT' )-leng ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 10 act = get_field( 'PLUCK_ID' )-leng ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 6 act = get_field( 'FIELD_ID' )-leng ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 8 act = get_field( 'PLUCK_DATE' )-leng ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4 act = get_field( 'TEAM_NO' )-leng ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = get_field( 'LEAF_GRADE' )-leng ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 40 act = get_field( 'NOTE' )-leng ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD packed_lengths.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 13 act = get_field( 'LEAF_WEIGHT' )-leng ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = get_field( 'LEAF_WEIGHT' )-decimals ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 5 act = get_field( 'MOISTURE' )-leng ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = get_field( 'MOISTURE' )-decimals ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 11 act = get_field( 'PRICE_PER_KG' )-leng ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = get_field( 'PRICE_PER_KG' )-decimals ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD other_types.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'CLNT' act = get_field( 'CLIENT' )-datatype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'CHAR' act = get_field( 'PLUCK_ID' )-datatype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'CHAR' act = get_field( 'FIELD_ID' )-datatype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'DATS' act = get_field( 'PLUCK_DATE' )-datatype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'NUMC' act = get_field( 'TEAM_NO' )-datatype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'DEC' act = get_field( 'LEAF_WEIGHT' )-datatype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'DEC' act = get_field( 'MOISTURE' )-datatype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'INT4' act = get_field( 'WITHER_MIN' )-datatype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'DEC' act = get_field( 'PRICE_PER_KG' )-datatype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'C' act = get_field( 'CLIENT' )-inttype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'D' act = get_field( 'PLUCK_DATE' )-inttype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'N' act = get_field( 'TEAM_NO' )-inttype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'P' act = get_field( 'LEAF_WEIGHT' )-inttype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'I' act = get_field( 'WITHER_MIN' )-inttype ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 10 act = get_field( 'WITHER_MIN' )-leng ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD insert_and_read.
|
||||
DATA ls_row TYPE {{p}}pluck.
|
||||
DATA lv_date TYPE {{p}}pluck-pluck_date.
|
||||
DATA lv_weight TYPE {{p}}pluck-leaf_weight.
|
||||
lv_date = '20240401'.
|
||||
lv_weight = '850.250'.
|
||||
ls_row = VALUE #( pluck_id = 'B0001'
|
||||
field_id = 'F01'
|
||||
pluck_date = lv_date
|
||||
team_no = '0012'
|
||||
leaf_weight = lv_weight
|
||||
leaf_grade = 'A1'
|
||||
moisture = '3.50'
|
||||
wither_min = 120
|
||||
price_per_kg = '2.10'
|
||||
note = 'first flush' ).
|
||||
INSERT {{p}}pluck FROM @ls_row.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
SELECT SINGLE field_id, pluck_date, leaf_weight, wither_min, price_per_kg, note
|
||||
FROM {{p}}pluck
|
||||
WHERE pluck_id = 'B0001'
|
||||
INTO @DATA(ls_read).
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'F01' act = ls_read-field_id ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_date act = ls_read-pluck_date ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_weight act = ls_read-leaf_weight ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 120 act = ls_read-wither_min ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'first flush' act = ls_read-note ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD duplicate_key.
|
||||
DATA ls_row TYPE {{p}}pluck.
|
||||
ls_row = VALUE #( pluck_id = 'B0002' field_id = 'F02' pluck_date = '20240402'
|
||||
leaf_weight = '100.000' ).
|
||||
INSERT {{p}}pluck FROM @ls_row.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
INSERT {{p}}pluck FROM @ls_row.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4 act = sy-subrc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD empty_fields.
|
||||
DATA ls_row TYPE {{p}}pluck.
|
||||
ls_row = VALUE #( pluck_id = 'B0003' field_id = 'F03' pluck_date = '20240403'
|
||||
leaf_weight = '0.000' ).
|
||||
INSERT {{p}}pluck FROM @ls_row.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
SELECT SINGLE team_no, leaf_grade, moisture, wither_min, note
|
||||
FROM {{p}}pluck
|
||||
WHERE pluck_id = 'B0003'
|
||||
INTO @DATA(ls_read).
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
cl_abap_unit_assert=>assert_initial( act = ls_read-team_no ).
|
||||
cl_abap_unit_assert=>assert_initial( act = ls_read-leaf_grade ).
|
||||
cl_abap_unit_assert=>assert_initial( act = ls_read-moisture ).
|
||||
cl_abap_unit_assert=>assert_initial( act = ls_read-wither_min ).
|
||||
cl_abap_unit_assert=>assert_initial( act = ls_read-note ).
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
53
tasks_gen/train/G1939/mutation.json
Normal file
53
tasks_gen/train/G1939/mutation.json
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"task": "G1939",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}PLUCK",
|
||||
"mutant": "line 8: key pluck_id : -> pluck_id : (key)",
|
||||
"status": "killed",
|
||||
"hidden": "7/8",
|
||||
"failed_tests": [
|
||||
"KEY_FIELDS"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}PLUCK",
|
||||
"mutant": "line 10: abap.dats -> abap.tims (type)",
|
||||
"status": "killed",
|
||||
"hidden": "6/8",
|
||||
"failed_tests": [
|
||||
"CHAR_LENGTHS",
|
||||
"OTHER_TYPES"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}PLUCK",
|
||||
"mutant": "line 11: abap.numc(4) -> abap.numc(3) (length)",
|
||||
"status": "killed",
|
||||
"hidden": "7/8",
|
||||
"failed_tests": [
|
||||
"CHAR_LENGTHS"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}PLUCK",
|
||||
"mutant": "line 13: abap.char(2) -> abap.numc(2) (type)",
|
||||
"status": "survived",
|
||||
"hidden": "8/8",
|
||||
"failed_tests": []
|
||||
},
|
||||
{
|
||||
"object": "{{P}}PLUCK",
|
||||
"mutant": "line 16: abap.dec(11,2) -> abap.dec(11,3) (decimals)",
|
||||
"status": "killed",
|
||||
"hidden": "7/8",
|
||||
"failed_tests": [
|
||||
"PACKED_LENGTHS"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 4,
|
||||
"kill_rate": 0.8,
|
||||
"ok": true
|
||||
}
|
||||
18
tasks_gen/train/G1939/reference/pluck.tabl.asabap
Normal file
18
tasks_gen/train/G1939/reference/pluck.tabl.asabap
Normal file
@@ -0,0 +1,18 @@
|
||||
@EndUserText.label : 'Tea leaf plucking batch'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}pluck {
|
||||
key client : abap.clnt not null;
|
||||
key pluck_id : abap.char(10) not null;
|
||||
field_id : abap.char(6) not null;
|
||||
pluck_date : abap.dats not null;
|
||||
team_no : abap.numc(4);
|
||||
leaf_weight : abap.dec(13,3) not null;
|
||||
leaf_grade : abap.char(2);
|
||||
moisture : abap.dec(5,2);
|
||||
wither_min : abap.int4;
|
||||
price_per_kg : abap.dec(11,2);
|
||||
note : abap.char(40);
|
||||
}
|
||||
98
tasks_gen/train/G1939/reference/pluck_test.clas.abap
Normal file
98
tasks_gen/train/G1939/reference/pluck_test.clas.abap
Normal file
@@ -0,0 +1,98 @@
|
||||
CLASS {{p}}pluck_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_batch FOR TESTING.
|
||||
METHODS rejects_duplicate_key FOR TESTING.
|
||||
METHODS keeps_empty_fields FOR TESTING.
|
||||
METHODS counts_the_batches FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}pluck_test IMPLEMENTATION.
|
||||
|
||||
METHOD class_setup.
|
||||
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}PLUCK' ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD setup.
|
||||
go_env->clear_doubles( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD stores_a_batch.
|
||||
DATA ls_row TYPE {{p}}pluck.
|
||||
DATA lv_date TYPE {{p}}pluck-pluck_date.
|
||||
DATA lv_weight TYPE {{p}}pluck-leaf_weight.
|
||||
lv_date = '20240401'.
|
||||
lv_weight = '850.250'.
|
||||
ls_row = VALUE #( pluck_id = 'B0001'
|
||||
field_id = 'F01'
|
||||
pluck_date = lv_date
|
||||
team_no = '0012'
|
||||
leaf_weight = lv_weight
|
||||
leaf_grade = 'A1'
|
||||
moisture = '3.50'
|
||||
wither_min = 120
|
||||
price_per_kg = '2.10'
|
||||
note = 'first flush' ).
|
||||
INSERT {{p}}pluck FROM @ls_row.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
SELECT SINGLE field_id, pluck_date, leaf_weight, wither_min, note
|
||||
FROM {{p}}pluck
|
||||
WHERE pluck_id = 'B0001'
|
||||
INTO @DATA(ls_read).
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'F01' act = ls_read-field_id ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_date act = ls_read-pluck_date ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_weight act = ls_read-leaf_weight ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 120 act = ls_read-wither_min ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'first flush' act = ls_read-note ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_duplicate_key.
|
||||
DATA ls_row TYPE {{p}}pluck.
|
||||
ls_row = VALUE #( pluck_id = 'B0002' field_id = 'F02' pluck_date = '20240402'
|
||||
leaf_weight = '100.000' ).
|
||||
INSERT {{p}}pluck FROM @ls_row.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
INSERT {{p}}pluck FROM @ls_row.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4 act = sy-subrc ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD keeps_empty_fields.
|
||||
DATA ls_row TYPE {{p}}pluck.
|
||||
ls_row = VALUE #( pluck_id = 'B0003' field_id = 'F03' pluck_date = '20240403'
|
||||
leaf_weight = '0.000' ).
|
||||
INSERT {{p}}pluck FROM @ls_row.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
SELECT SINGLE team_no, leaf_grade, wither_min, note
|
||||
FROM {{p}}pluck
|
||||
WHERE pluck_id = 'B0003'
|
||||
INTO @DATA(ls_read).
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
cl_abap_unit_assert=>assert_initial( act = ls_read-team_no ).
|
||||
cl_abap_unit_assert=>assert_initial( act = ls_read-leaf_grade ).
|
||||
cl_abap_unit_assert=>assert_initial( act = ls_read-wither_min ).
|
||||
cl_abap_unit_assert=>assert_initial( act = ls_read-note ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD counts_the_batches.
|
||||
DATA lt_rows TYPE STANDARD TABLE OF {{p}}pluck WITH EMPTY KEY.
|
||||
lt_rows = VALUE #( ( pluck_id = 'B0001' field_id = 'F01' pluck_date = '20240401'
|
||||
leaf_weight = '1.000' )
|
||||
( pluck_id = 'B0002' field_id = 'F01' pluck_date = '20240402'
|
||||
leaf_weight = '2.000' ) ).
|
||||
INSERT {{p}}pluck FROM TABLE @lt_rows.
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
||||
SELECT COUNT(*) FROM {{p}}pluck INTO @DATA(lv_count).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ).
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
59
tasks_gen/train/G1939/spec.md
Normal file
59
tasks_gen/train/G1939/spec.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# 1. Goal
|
||||
The tea plantation "Highland Leaf" picks the green leaf of its tea fields in
|
||||
batches. The plantation must store every plucking batch in one database table.
|
||||
The factory office, the field book and later evaluations read this table, so
|
||||
the field names and the data types must be exact.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- One plucking batch is the green leaf of one tea field on one day.
|
||||
- The table is new and is in package $TMP. The table is client-dependent.
|
||||
- No other object uses the table yet.
|
||||
|
||||
# 4. Contract
|
||||
- Create the database table {{P}}PLUCK in package $TMP. The table is
|
||||
transparent.
|
||||
- The table is not extensible. Delivery class A. Data maintenance is
|
||||
restricted.
|
||||
- The table has these fields, in this order:
|
||||
CLIENT, PLUCK_ID, FIELD_ID, PLUCK_DATE, TEAM_NO, LEAF_WEIGHT, LEAF_GRADE,
|
||||
MOISTURE, WITHER_MIN, PRICE_PER_KG, NOTE.
|
||||
- Key fields: CLIENT and PLUCK_ID.
|
||||
|
||||
# 5. Business rules
|
||||
1. CLIENT is the client field of the table. Data type: client, length 3. Key
|
||||
field. Not null.
|
||||
2. PLUCK_ID is the number of the plucking batch. Data type: character, length
|
||||
10. Key field. Not null.
|
||||
3. FIELD_ID is the tea field. Data type: character, length 6. Not null.
|
||||
4. PLUCK_DATE is the day of the plucking. Data type: date, length 8. Not null.
|
||||
5. TEAM_NO is the number of the picking team. Data type: numeric text, length
|
||||
4. The field can be empty.
|
||||
6. LEAF_WEIGHT is the weight of the green leaf in kilogram. Data type: packed
|
||||
number, 13 digits, 3 decimal places. Not null.
|
||||
7. LEAF_GRADE is the grade code of the green leaf. Data type: character,
|
||||
length 2. The field can be empty.
|
||||
8. MOISTURE is the moisture of the green leaf in percent. Data type: packed
|
||||
number, 5 digits, 2 decimal places. The field can be empty.
|
||||
9. WITHER_MIN is the planned withering time in minutes. Data type: integer,
|
||||
length 10. The field can be empty.
|
||||
10. PRICE_PER_KG is the price for one kilogram of the green leaf. Data type:
|
||||
packed number, 11 digits, 2 decimal places. The field can be empty.
|
||||
11. NOTE is a short note about the batch. Data type: character, length 40.
|
||||
The field can be empty.
|
||||
12. Two batches with the same PLUCK_ID must not exist. A second insert with
|
||||
the same key must fail.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16.
|
||||
- Coding standards: Clean ABAP.
|
||||
- Out of scope: do not create a CDS view, a class, a program or a function
|
||||
module for this task. Do not change any other object.
|
||||
|
||||
# 7. Acceptance
|
||||
- The table 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.
|
||||
56
tasks_gen/train/G1939/task.json
Normal file
56
tasks_gen/train/G1939/task.json
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"id": "G1939",
|
||||
"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}}PLUCK",
|
||||
"fields": [
|
||||
"client",
|
||||
"pluck_id",
|
||||
"field_id",
|
||||
"pluck_date",
|
||||
"team_no",
|
||||
"leaf_weight",
|
||||
"leaf_grade",
|
||||
"moisture",
|
||||
"wither_min",
|
||||
"price_per_kg",
|
||||
"note"
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}PLUCK_HIDDEN",
|
||||
"file": "hidden/pluck_hidden.clas.abap",
|
||||
"description": "RTTI check of the table and OSQL test double checks"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "TABL",
|
||||
"name": "{{P}}PLUCK",
|
||||
"file": "reference/pluck.tabl.asabap",
|
||||
"description": "Tea leaf plucking batch table"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}PLUCK_TEST",
|
||||
"file": "reference/pluck_test.clas.abap",
|
||||
"description": "Own ABAP Unit tests with CL_OSQL_TEST_ENVIRONMENT"
|
||||
}
|
||||
],
|
||||
"craft_checks": []
|
||||
}
|
||||
Reference in New Issue
Block a user