Snapshot: new training tasks (balanced generation), docs

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-05 22:08:59 +02:00
parent eb13453097
commit 6984fc7917
572 changed files with 30024 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
@EndUserText.label : 'Service job'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}svcjob {
key client : abap.clnt not null;
job_id : abap.char(10) not null;
work_hours : abap.dec(5,2) not null;
calc_mode : abap.char(2) not null;
order_no : abap.char(10) not null;
job_date : abap.dats not null;
part_count : abap.int4 not null;
job_group : abap.char(4) not null;
job_value : abap.dec(15,2) not null;
}

View File

@@ -0,0 +1,16 @@
@EndUserText.label : 'Service job'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}svcjob {
key client : abap.clnt not null;
key job_id : abap.char(10) not null;
work_hours : abap.dec(5,3) not null;
calc_mode : abap.char(2) not null;
order_no : abap.char(10) not null;
job_date : abap.dats not null;
part_count : abap.int4 not null;
job_group : abap.char(4) not null;
job_value : abap.dec(15,2) not null;
}

View File

@@ -0,0 +1,16 @@
@EndUserText.label : 'Service job'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}svcjob {
key client : abap.clnt not null;
key job_id : abap.char(10) not null;
work_hours : abap.dec(5,2) not null;
calc_mode : abap.char(1) not null;
order_no : abap.char(10) not null;
job_date : abap.dats not null;
part_count : abap.int4 not null;
job_group : abap.char(4) not null;
job_value : abap.dec(15,2) not null;
}

View File

@@ -0,0 +1,16 @@
@EndUserText.label : 'Service job'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}svcjob {
key client : abap.clnt not null;
key job_id : abap.char(10) not null;
work_hours : abap.dec(5,2) not null;
calc_mode : abap.char(2) not null;
order_no : abap.char(10) not null;
job_date : abap.tims not null;
part_count : abap.int4 not null;
job_group : abap.char(4) not null;
job_value : abap.dec(15,2) not null;
}

View File

@@ -0,0 +1,16 @@
@EndUserText.label : 'Service job'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}svcjob {
key client : abap.clnt not null;
key job_id : abap.char(10) not null;
work_hours : abap.dec(5,2) not null;
calc_mode : abap.char(2) not null;
order_no : abap.char(10) not null;
job_date : abap.dats not null;
part_count : abap.int4 not null;
job_group : abap.char(4) not null;
job_value : abap.dec(15,3) not null;
}

View File

@@ -0,0 +1,29 @@
{
"id": "G1912",
"pool": "train",
"object_type": "TABL",
"category": "B",
"attempts": [
{
"stage": "validate",
"oracle": 0,
"null": 0
},
{
"stage": "validate",
"oracle": 58.3,
"null": 0
},
{
"stage": "validate",
"oracle": 100.0,
"null": 0,
"mutation": {
"valid": 5,
"killed": 5,
"ok": true
}
}
],
"accepted": true
}

View File

@@ -0,0 +1,175 @@
CLASS {{p}}svcjob_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
TYPES ty_typekind TYPE c LENGTH 1.
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 key_field_types FOR TESTING.
METHODS work_hours_field FOR TESTING.
METHODS calc_mode_field FOR TESTING.
METHODS order_no_field FOR TESTING.
METHODS job_date_field FOR TESTING.
METHODS part_count_field FOR TESTING.
METHODS job_group_field FOR TESTING.
METHODS job_value_field FOR TESTING.
METHODS insert_and_select FOR TESTING.
METHODS duplicate_key FOR TESTING.
METHODS get_ddic_fields RETURNING VALUE(rt_fields) TYPE ddfields.
METHODS check_type IMPORTING iv_name TYPE fieldname
iv_inttype TYPE ty_typekind
iv_leng TYPE i
iv_decimals TYPE i.
ENDCLASS.
CLASS {{p}}svcjob_hidden IMPLEMENTATION.
METHOD class_setup.
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}SVCJOB' ) ) ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
go_env->clear_doubles( ).
ENDMETHOD.
METHOD get_ddic_fields.
DATA lt_fields TYPE ddfields.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = '{{P}}SVCJOB'
langu = 'E'
TABLES
dfies_tab = lt_fields
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
cl_abap_unit_assert=>fail( msg = 'DDIC field information is not available' ).
ENDIF.
rt_fields = lt_fields.
ENDMETHOD.
METHOD check_type.
DATA lt_fields TYPE ddfields.
lt_fields = get_ddic_fields( ).
READ TABLE lt_fields INTO DATA(ls_field) WITH KEY fieldname = iv_name.
IF sy-subrc <> 0.
cl_abap_unit_assert=>fail( msg = |Field { iv_name } is missing| ).
ENDIF.
cl_abap_unit_assert=>assert_equals( exp = iv_inttype act = ls_field-inttype
msg = |Internal type of { iv_name }| ).
cl_abap_unit_assert=>assert_equals( exp = iv_leng act = CONV i( ls_field-leng )
msg = |Length of { iv_name }| ).
cl_abap_unit_assert=>assert_equals( exp = iv_decimals act = CONV i( ls_field-decimals )
msg = |Decimals of { iv_name }| ).
ENDMETHOD.
METHOD field_names.
DATA lt_fields TYPE ddfields.
DATA lt_expected TYPE STANDARD TABLE OF fieldname WITH EMPTY KEY.
lt_expected = VALUE #( ( 'CLIENT' ) ( 'JOB_ID' ) ( 'WORK_HOURS' )
( 'CALC_MODE' ) ( 'ORDER_NO' ) ( 'JOB_DATE' )
( 'PART_COUNT' ) ( 'JOB_GROUP' ) ( 'JOB_VALUE' ) ).
lt_fields = get_ddic_fields( ).
cl_abap_unit_assert=>assert_equals( exp = lines( lt_expected ) act = lines( lt_fields ) ).
LOOP AT lt_expected INTO DATA(lv_name).
READ TABLE lt_fields TRANSPORTING NO FIELDS WITH KEY fieldname = lv_name.
cl_abap_unit_assert=>assert_subrc( exp = 0 msg = |Field { lv_name } is missing| ).
ENDLOOP.
ENDMETHOD.
METHOD key_fields.
DATA lt_fields TYPE ddfields.
lt_fields = get_ddic_fields( ).
LOOP AT lt_fields INTO DATA(ls_field).
IF ls_field-fieldname = 'CLIENT' OR ls_field-fieldname = 'JOB_ID'.
cl_abap_unit_assert=>assert_equals( exp = 'X' act = ls_field-keyflag
msg = |Key flag of { ls_field-fieldname }| ).
ELSE.
cl_abap_unit_assert=>assert_initial( act = ls_field-keyflag
msg = |Key flag of { ls_field-fieldname }| ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD key_field_types.
check_type( iv_name = 'CLIENT' iv_inttype = 'C' iv_leng = 3 iv_decimals = 0 ).
check_type( iv_name = 'JOB_ID' iv_inttype = 'C' iv_leng = 10 iv_decimals = 0 ).
ENDMETHOD.
METHOD work_hours_field.
check_type( iv_name = 'WORK_HOURS' iv_inttype = 'P' iv_leng = 5 iv_decimals = 2 ).
ENDMETHOD.
METHOD calc_mode_field.
check_type( iv_name = 'CALC_MODE' iv_inttype = 'C' iv_leng = 2 iv_decimals = 0 ).
ENDMETHOD.
METHOD order_no_field.
check_type( iv_name = 'ORDER_NO' iv_inttype = 'C' iv_leng = 10 iv_decimals = 0 ).
ENDMETHOD.
METHOD job_date_field.
check_type( iv_name = 'JOB_DATE' iv_inttype = 'D' iv_leng = 8 iv_decimals = 0 ).
ENDMETHOD.
METHOD part_count_field.
check_type( iv_name = 'PART_COUNT' iv_inttype = 'I' iv_leng = 10 iv_decimals = 0 ).
ENDMETHOD.
METHOD job_group_field.
check_type( iv_name = 'JOB_GROUP' iv_inttype = 'C' iv_leng = 4 iv_decimals = 0 ).
ENDMETHOD.
METHOD job_value_field.
check_type( iv_name = 'JOB_VALUE' iv_inttype = 'P' iv_leng = 15 iv_decimals = 2 ).
ENDMETHOD.
METHOD insert_and_select.
DATA ls_job TYPE {{p}}svcjob.
ls_job-client = sy-mandt.
ls_job-job_id = 'J001'.
ls_job-work_hours = '12.50'.
ls_job-calc_mode = 'A1'.
ls_job-order_no = 'ORD123'.
ls_job-job_date = '20250101'.
ls_job-part_count = 5.
ls_job-job_group = 'GR01'.
ls_job-job_value = '1000.00'.
INSERT {{p}}svcjob FROM ls_job.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
SELECT SINGLE * FROM {{p}}svcjob WHERE job_id = 'J001' INTO @DATA(ls_read).
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
cl_abap_unit_assert=>assert_equals( exp = ls_job-work_hours act = ls_read-work_hours ).
cl_abap_unit_assert=>assert_equals( exp = ls_job-calc_mode act = ls_read-calc_mode ).
cl_abap_unit_assert=>assert_equals( exp = ls_job-order_no act = ls_read-order_no ).
cl_abap_unit_assert=>assert_equals( exp = ls_job-job_date act = ls_read-job_date ).
cl_abap_unit_assert=>assert_equals( exp = ls_job-part_count act = ls_read-part_count ).
cl_abap_unit_assert=>assert_equals( exp = ls_job-job_group act = ls_read-job_group ).
cl_abap_unit_assert=>assert_equals( exp = ls_job-job_value act = ls_read-job_value ).
ENDMETHOD.
METHOD duplicate_key.
DATA ls_job TYPE {{p}}svcjob.
ls_job-client = sy-mandt.
ls_job-job_id = 'J002'.
ls_job-work_hours = '1.00'.
ls_job-calc_mode = 'B2'.
ls_job-order_no = 'ORD456'.
ls_job-job_date = '20250102'.
ls_job-part_count = 1.
ls_job-job_group = 'GR02'.
ls_job-job_value = '50.00'.
INSERT {{p}}svcjob FROM ls_job.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
INSERT {{p}}svcjob FROM ls_job.
cl_abap_unit_assert=>assert_equals( exp = 4 act = sy-subrc ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,54 @@
{
"task": "G1912",
"mutants": [
{
"object": "{{P}}SVCJOB",
"mutant": "line 8: key job_id : -> job_id : (key)",
"status": "killed",
"hidden": "11/12",
"failed_tests": [
"KEY_FIELDS"
]
},
{
"object": "{{P}}SVCJOB",
"mutant": "line 9: abap.dec(5,2) -> abap.dec(5,3) (decimals)",
"status": "killed",
"hidden": "11/12",
"failed_tests": [
"WORK_HOURS_FIELD"
]
},
{
"object": "{{P}}SVCJOB",
"mutant": "line 10: abap.char(2) -> abap.char(1) (length)",
"status": "killed",
"hidden": "11/12",
"failed_tests": [
"CALC_MODE_FIELD"
]
},
{
"object": "{{P}}SVCJOB",
"mutant": "line 12: abap.dats -> abap.tims (type)",
"status": "killed",
"hidden": "11/12",
"failed_tests": [
"JOB_DATE_FIELD"
]
},
{
"object": "{{P}}SVCJOB",
"mutant": "line 15: abap.dec(15,2) -> abap.dec(15,3) (decimals)",
"status": "killed",
"hidden": "11/12",
"failed_tests": [
"JOB_VALUE_FIELD"
]
}
],
"valid": 5,
"killed": 5,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,16 @@
@EndUserText.label : 'Service job'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}svcjob {
key client : abap.clnt not null;
key job_id : abap.char(10) not null;
work_hours : abap.dec(5,2) not null;
calc_mode : abap.char(2) not null;
order_no : abap.char(10) not null;
job_date : abap.dats not null;
part_count : abap.int4 not null;
job_group : abap.char(4) not null;
job_value : abap.dec(15,2) not null;
}

View File

@@ -0,0 +1,139 @@
CLASS {{p}}svcjob_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
TYPES ty_typekind TYPE c LENGTH 1.
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 field_types FOR TESTING.
METHODS insert_and_select FOR TESTING.
METHODS duplicate_key FOR TESTING.
METHODS get_ddic_fields RETURNING VALUE(rt_fields) TYPE ddfields.
METHODS check_type IMPORTING iv_name TYPE fieldname
iv_inttype TYPE ty_typekind
iv_leng TYPE i
iv_decimals TYPE i.
ENDCLASS.
CLASS {{p}}svcjob_test IMPLEMENTATION.
METHOD class_setup.
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}SVCJOB' ) ) ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
go_env->clear_doubles( ).
ENDMETHOD.
METHOD get_ddic_fields.
DATA lt_fields TYPE ddfields.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = '{{P}}SVCJOB'
langu = 'E'
TABLES
dfies_tab = lt_fields
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
cl_abap_unit_assert=>fail( msg = 'DDIC field information is not available' ).
ENDIF.
rt_fields = lt_fields.
ENDMETHOD.
METHOD check_type.
DATA lt_fields TYPE ddfields.
lt_fields = get_ddic_fields( ).
READ TABLE lt_fields INTO DATA(ls_field) WITH KEY fieldname = iv_name.
IF sy-subrc <> 0.
cl_abap_unit_assert=>fail( msg = |Field { iv_name } is missing| ).
ENDIF.
cl_abap_unit_assert=>assert_equals( exp = iv_inttype act = ls_field-inttype ).
cl_abap_unit_assert=>assert_equals( exp = iv_leng act = CONV i( ls_field-leng ) ).
cl_abap_unit_assert=>assert_equals( exp = iv_decimals act = CONV i( ls_field-decimals ) ).
ENDMETHOD.
METHOD field_names.
DATA lt_fields TYPE ddfields.
DATA lt_expected TYPE STANDARD TABLE OF fieldname WITH EMPTY KEY.
lt_expected = VALUE #( ( 'CLIENT' ) ( 'JOB_ID' ) ( 'WORK_HOURS' )
( 'CALC_MODE' ) ( 'ORDER_NO' ) ( 'JOB_DATE' )
( 'PART_COUNT' ) ( 'JOB_GROUP' ) ( 'JOB_VALUE' ) ).
lt_fields = get_ddic_fields( ).
cl_abap_unit_assert=>assert_equals( exp = lines( lt_expected ) act = lines( lt_fields ) ).
LOOP AT lt_expected INTO DATA(lv_name).
READ TABLE lt_fields TRANSPORTING NO FIELDS WITH KEY fieldname = lv_name.
cl_abap_unit_assert=>assert_subrc( exp = 0 msg = |Field { lv_name } is missing| ).
ENDLOOP.
ENDMETHOD.
METHOD key_fields.
DATA lt_fields TYPE ddfields.
lt_fields = get_ddic_fields( ).
LOOP AT lt_fields INTO DATA(ls_field).
IF ls_field-fieldname = 'CLIENT' OR ls_field-fieldname = 'JOB_ID'.
cl_abap_unit_assert=>assert_equals( exp = 'X' act = ls_field-keyflag
msg = |Key flag of { ls_field-fieldname }| ).
ELSE.
cl_abap_unit_assert=>assert_initial( act = ls_field-keyflag
msg = |Key flag of { ls_field-fieldname }| ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD field_types.
check_type( iv_name = 'CLIENT' iv_inttype = 'C' iv_leng = 3 iv_decimals = 0 ).
check_type( iv_name = 'JOB_ID' iv_inttype = 'C' iv_leng = 10 iv_decimals = 0 ).
check_type( iv_name = 'WORK_HOURS' iv_inttype = 'P' iv_leng = 5 iv_decimals = 2 ).
check_type( iv_name = 'CALC_MODE' iv_inttype = 'C' iv_leng = 2 iv_decimals = 0 ).
check_type( iv_name = 'ORDER_NO' iv_inttype = 'C' iv_leng = 10 iv_decimals = 0 ).
check_type( iv_name = 'JOB_DATE' iv_inttype = 'D' iv_leng = 8 iv_decimals = 0 ).
check_type( iv_name = 'PART_COUNT' iv_inttype = 'I' iv_leng = 10 iv_decimals = 0 ).
check_type( iv_name = 'JOB_GROUP' iv_inttype = 'C' iv_leng = 4 iv_decimals = 0 ).
check_type( iv_name = 'JOB_VALUE' iv_inttype = 'P' iv_leng = 15 iv_decimals = 2 ).
ENDMETHOD.
METHOD insert_and_select.
DATA ls_job TYPE {{p}}svcjob.
ls_job-client = sy-mandt.
ls_job-job_id = 'J001'.
ls_job-work_hours = '12.50'.
ls_job-calc_mode = 'A1'.
ls_job-order_no = 'ORD123'.
ls_job-job_date = '20250101'.
ls_job-part_count = 5.
ls_job-job_group = 'GR01'.
ls_job-job_value = '1000.00'.
INSERT {{p}}svcjob FROM ls_job.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
SELECT SINGLE * FROM {{p}}svcjob WHERE job_id = 'J001' INTO @DATA(ls_read).
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
cl_abap_unit_assert=>assert_equals( exp = ls_job-work_hours act = ls_read-work_hours ).
cl_abap_unit_assert=>assert_equals( exp = ls_job-job_value act = ls_read-job_value ).
ENDMETHOD.
METHOD duplicate_key.
DATA ls_job TYPE {{p}}svcjob.
ls_job-client = sy-mandt.
ls_job-job_id = 'J002'.
ls_job-work_hours = '1.00'.
ls_job-calc_mode = 'B2'.
ls_job-order_no = 'ORD456'.
ls_job-job_date = '20250102'.
ls_job-part_count = 1.
ls_job-job_group = 'GR02'.
ls_job-job_value = '50.00'.
INSERT {{p}}svcjob FROM ls_job.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
INSERT {{p}}svcjob FROM ls_job.
cl_abap_unit_assert=>assert_equals( exp = 4 act = sy-subrc ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,47 @@
# 1. Goal
Store the service jobs of a service company. The company records the work hours,
the calculation mode, the order number, the date, the part count, the group, and
the value of each job. The business domain uses concepts that collide with
reserved or SQL words. The contract therefore uses safe field names.
# 2. Open questions
None.
# 3. Context
- The table is in package $TMP.
- The table stores service jobs of the service company.
- The table has a client field as the first key field.
# 4. Contract
Create the database table {{P}}SVCJOB with these fields:
| Field name | Data type | Length | Decimals | Key |
|------------|-----------|--------|----------|-----|
| client | abap.clnt | 3 | 0 | X |
| job_id | abap.char | 10 | 0 | X |
| work_hours | abap.dec | 5 | 2 | |
| calc_mode | abap.char | 2 | 0 | |
| order_no | abap.char | 10 | 0 | |
| job_date | abap.dats | 8 | 0 | |
| part_count | abap.int4 | 10 | 0 | |
| job_group | abap.char | 4 | 0 | |
| job_value | abap.dec | 15 | 2 | |
# 5. Business rules
1. Use the field names exactly as given in the contract. Use lower case field
names in the table definition.
2. Do not use reserved words as field names. Reserved words include HOURS, MODE,
ORDER, DATE, COUNT, GROUP, and VALUE.
3. The key fields are client and job_id. No other field is a key field.
4. Use only built-in data types. Do not use data elements or domains.
5. The table must be active.
# 6. Constraints
- Release target: 8.16.
- Out of scope: none.
- Do not create other objects.
# 7. Acceptance
- The table is active and has no syntax error.
- The hidden tests pass.
- Write ABAP Unit tests for the table in a global test class.

View File

@@ -0,0 +1,54 @@
{
"id": "G1912",
"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}}SVCJOB",
"fields": [
"client",
"job_id",
"work_hours",
"calc_mode",
"order_no",
"job_date",
"part_count",
"job_group",
"job_value"
]
}
],
"out_of_scope": [],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}SVCJOB_HIDDEN",
"file": "hidden/svcjob_hidden.clas.abap",
"description": "Hidden tests for table {{P}}SVCJOB"
}
],
"reference": [
{
"type": "TABL",
"name": "{{P}}SVCJOB",
"file": "reference/svcjob.tabl.asabap",
"description": "Service job table"
},
{
"type": "CLAS",
"name": "{{P}}SVCJOB_TEST",
"file": "reference/svcjob_test.clas.abap",
"description": "Own tests for table {{P}}SVCJOB"
}
],
"craft_checks": []
}