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,19 @@
@EndUserText.label : 'Drilling job'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}well {
key client : abap.clnt not null;
job_id : abap.char(10) not null;
site_name : abap.char(40);
drilled_on : abap.dats;
@Semantics.quantity.unitOfMeasure : '{{p}}well.depth_unit'
depth_m : abap.dec(7,2);
depth_unit : abap.unit(3);
@Semantics.amount.currencyCode : '{{p}}well.currency_code'
price : abap.dec(15,2);
currency_code : abap.cuky;
permit_no : abap.numc(8);
crew_size : abap.int4;
}

View File

@@ -0,0 +1,19 @@
@EndUserText.label : 'Drilling job'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}well {
key client : abap.clnt not null;
key job_id : abap.char(10) not null;
site_name : abap.char(40);
drilled_on : abap.tims;
@Semantics.quantity.unitOfMeasure : '{{p}}well.depth_unit'
depth_m : abap.dec(7,2);
depth_unit : abap.unit(3);
@Semantics.amount.currencyCode : '{{p}}well.currency_code'
price : abap.dec(15,2);
currency_code : abap.cuky;
permit_no : abap.numc(8);
crew_size : abap.int4;
}

View File

@@ -0,0 +1,19 @@
@EndUserText.label : 'Drilling job'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}well {
key client : abap.clnt not null;
key job_id : abap.char(10) not null;
site_name : abap.char(40);
drilled_on : abap.dats;
@Semantics.quantity.unitOfMeasure : '{{p}}well.depth_unit'
depth_m : abap.dec(7,3);
depth_unit : abap.unit(3);
@Semantics.amount.currencyCode : '{{p}}well.currency_code'
price : abap.dec(15,2);
currency_code : abap.cuky;
permit_no : abap.numc(8);
crew_size : abap.int4;
}

View File

@@ -0,0 +1,19 @@
@EndUserText.label : 'Drilling job'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}well {
key client : abap.clnt not null;
key job_id : abap.char(10) not null;
site_name : abap.char(40);
drilled_on : abap.dats;
@Semantics.quantity.unitOfMeasure : '{{p}}well.depth_unit'
depth_m : abap.dec(7,2);
depth_unit : abap.unit(3);
@Semantics.amount.currencyCode : '{{p}}well.currency_code'
price : abap.dec(15,2);
currency_code : abap.cuky;
permit_no : abap.numc(7);
crew_size : abap.int4;
}

View File

@@ -0,0 +1,19 @@
@EndUserText.label : 'Drilling job'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}well {
key client : abap.clnt not null;
key job_id : abap.char(10) not null;
site_name : abap.char(40);
drilled_on : abap.dats;
@Semantics.quantity.unitOfMeasure : '{{p}}well.depth_unit'
depth_m : abap.dec(7,2);
depth_unit : abap.unit(3);
@Semantics.amount.currencyCode : '{{p}}well.currency_code'
price : abap.dec(15,2);
currency_code : abap.cuky;
permit_no : abap.numc(8);
crew_size : abap.int8;
}

View File

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

View File

@@ -0,0 +1,154 @@
CLASS {{p}}well_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_count FOR TESTING.
METHODS field_properties FOR TESTING.
METHODS key_fields FOR TESTING.
METHODS insert_and_read FOR TESTING.
METHODS duplicate_key FOR TESTING.
METHODS same_site_two_jobs FOR TESTING.
METHODS keys_only_row FOR TESTING.
METHODS check_field
IMPORTING iv_name TYPE fieldname
iv_leng TYPE i
iv_dec TYPE i
iv_type TYPE dfies-datatype.
ENDCLASS.
CLASS {{p}}well_hidden IMPLEMENTATION.
METHOD class_setup.
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}WELL' ) ) ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
go_env->clear_doubles( ).
ENDMETHOD.
METHOD field_count.
DATA(lo_struct) = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_name( '{{P}}WELL' ) ).
DATA(lt_fields) = lo_struct->get_ddic_field_list( ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = lines( lt_fields )
msg = |Table {{P}}WELL must have 10 fields| ).
ENDMETHOD.
METHOD field_properties.
check_field( iv_name = 'CLIENT' iv_leng = 3 iv_dec = 0 iv_type = 'CLNT' ).
check_field( iv_name = 'JOB_ID' iv_leng = 10 iv_dec = 0 iv_type = 'CHAR' ).
check_field( iv_name = 'SITE_NAME' iv_leng = 40 iv_dec = 0 iv_type = 'CHAR' ).
check_field( iv_name = 'DRILLED_ON' iv_leng = 8 iv_dec = 0 iv_type = 'DATS' ).
check_field( iv_name = 'DEPTH_M' iv_leng = 7 iv_dec = 2 iv_type = 'DEC' ).
check_field( iv_name = 'DEPTH_UNIT' iv_leng = 3 iv_dec = 0 iv_type = 'UNIT' ).
check_field( iv_name = 'PRICE' iv_leng = 15 iv_dec = 2 iv_type = 'DEC' ).
check_field( iv_name = 'CURRENCY_CODE' iv_leng = 5 iv_dec = 0 iv_type = 'CUKY' ).
check_field( iv_name = 'PERMIT_NO' iv_leng = 8 iv_dec = 0 iv_type = 'NUMC' ).
check_field( iv_name = 'CREW_SIZE' iv_leng = 10 iv_dec = 0 iv_type = 'INT4' ).
ENDMETHOD.
METHOD check_field.
DATA(lo_struct) = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_name( '{{P}}WELL' ) ).
DATA(lt_fields) = lo_struct->get_ddic_field_list( ).
READ TABLE lt_fields INTO DATA(ls_field) WITH KEY fieldname = iv_name.
cl_abap_unit_assert=>assert_subrc( exp = 0 act = sy-subrc
msg = |Field { iv_name } is missing| ).
cl_abap_unit_assert=>assert_equals( exp = iv_leng act = ls_field-leng
msg = |Length of field { iv_name }| ).
cl_abap_unit_assert=>assert_equals( exp = iv_dec act = ls_field-decimals
msg = |Decimals of field { iv_name }| ).
cl_abap_unit_assert=>assert_equals( exp = iv_type act = ls_field-datatype
msg = |Data type of field { iv_name }| ).
ENDMETHOD.
METHOD key_fields.
DATA(lo_struct) = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_name( '{{P}}WELL' ) ).
DATA(lt_fields) = lo_struct->get_ddic_field_list( ).
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 = |Field { ls_field-fieldname } must be a key field| ).
ELSE.
cl_abap_unit_assert=>assert_equals( exp = '' act = ls_field-keyflag
msg = |Field { ls_field-fieldname } must not be a key field| ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD insert_and_read.
DATA ls_job TYPE {{p}}well.
ls_job-client = sy-mandt.
ls_job-job_id = 'J1'.
ls_job-site_name = 'FARM NORTH'.
ls_job-drilled_on = '20250115'.
ls_job-depth_m = '120.50'.
ls_job-depth_unit = 'M'.
ls_job-price = '4500.00'.
ls_job-currency_code = 'EUR'.
ls_job-permit_no = '00001234'.
ls_job-crew_size = 4.
INSERT {{p}}well FROM ls_job.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
SELECT SINGLE * FROM {{p}}well WHERE job_id = 'J1' INTO @DATA(ls_db).
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
cl_abap_unit_assert=>assert_equals( exp = 'FARM NORTH' act = ls_db-site_name ).
cl_abap_unit_assert=>assert_equals( exp = '20250115' act = ls_db-drilled_on ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '120.50' )
act = CONV decfloat34( ls_db-depth_m ) ).
cl_abap_unit_assert=>assert_equals( exp = 'M' act = ls_db-depth_unit ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '4500.00' )
act = CONV decfloat34( ls_db-price ) ).
cl_abap_unit_assert=>assert_equals( exp = 'EUR' act = ls_db-currency_code ).
cl_abap_unit_assert=>assert_equals( exp = '00001234' act = ls_db-permit_no ).
cl_abap_unit_assert=>assert_equals( exp = 4 act = ls_db-crew_size ).
ENDMETHOD.
METHOD duplicate_key.
DATA ls_job TYPE {{p}}well.
ls_job-client = sy-mandt.
ls_job-job_id = 'J2'.
ls_job-site_name = 'SITE A'.
INSERT {{p}}well FROM ls_job.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
INSERT {{p}}well FROM ls_job.
cl_abap_unit_assert=>assert_equals( exp = 4 act = sy-subrc ).
ENDMETHOD.
METHOD same_site_two_jobs.
DATA ls_job TYPE {{p}}well.
ls_job-client = sy-mandt.
ls_job-site_name = 'SAME SITE'.
ls_job-job_id = 'J3'.
INSERT {{p}}well FROM ls_job.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
ls_job-job_id = 'J4'.
INSERT {{p}}well FROM ls_job.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
SELECT COUNT(*) FROM {{p}}well WHERE site_name = 'SAME SITE' INTO @DATA(lv_count).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ).
ENDMETHOD.
METHOD keys_only_row.
DATA ls_job TYPE {{p}}well.
ls_job-client = sy-mandt.
ls_job-job_id = 'K1'.
INSERT {{p}}well FROM ls_job.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
SELECT SINGLE site_name, depth_m, crew_size FROM {{p}}well WHERE job_id = 'K1'
INTO @DATA(ls_db).
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
cl_abap_unit_assert=>assert_equals( exp = '' act = ls_db-site_name ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 )
act = CONV decfloat34( ls_db-depth_m ) ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = ls_db-crew_size ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,56 @@
{
"task": "G1955",
"mutants": [
{
"object": "{{P}}WELL",
"mutant": "line 8: key job_id : -> job_id : (key)",
"status": "killed",
"hidden": "5/7",
"failed_tests": [
"KEY_FIELDS",
"SAME_SITE_TWO_JOBS"
]
},
{
"object": "{{P}}WELL",
"mutant": "line 10: abap.dats -> abap.tims (type)",
"status": "killed",
"hidden": "5/7",
"failed_tests": [
"FIELD_PROPERTIES",
"INSERT_AND_READ"
]
},
{
"object": "{{P}}WELL",
"mutant": "line 12: abap.dec(7,2) -> abap.dec(7,3) (decimals)",
"status": "killed",
"hidden": "6/7",
"failed_tests": [
"FIELD_PROPERTIES"
]
},
{
"object": "{{P}}WELL",
"mutant": "line 17: abap.numc(8) -> abap.numc(7) (length)",
"status": "killed",
"hidden": "6/7",
"failed_tests": [
"FIELD_PROPERTIES"
]
},
{
"object": "{{P}}WELL",
"mutant": "line 18: abap.int4 -> abap.int8 (type)",
"status": "killed",
"hidden": "6/7",
"failed_tests": [
"FIELD_PROPERTIES"
]
}
],
"valid": 5,
"killed": 5,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,19 @@
@EndUserText.label : 'Drilling job'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}well {
key client : abap.clnt not null;
key job_id : abap.char(10) not null;
site_name : abap.char(40);
drilled_on : abap.dats;
@Semantics.quantity.unitOfMeasure : '{{p}}well.depth_unit'
depth_m : abap.dec(7,2);
depth_unit : abap.unit(3);
@Semantics.amount.currencyCode : '{{p}}well.currency_code'
price : abap.dec(15,2);
currency_code : abap.cuky;
permit_no : abap.numc(8);
crew_size : abap.int4;
}

View File

@@ -0,0 +1,62 @@
CLASS {{p}}well_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 table_has_fields FOR TESTING.
METHODS store_and_read FOR TESTING.
METHODS duplicate_key_rejected FOR TESTING.
ENDCLASS.
CLASS {{p}}well_test IMPLEMENTATION.
METHOD class_setup.
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}WELL' ) ) ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
go_env->clear_doubles( ).
ENDMETHOD.
METHOD table_has_fields.
DATA(lo_struct) = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_name( '{{P}}WELL' ) ).
DATA(lt_fields) = lo_struct->get_ddic_field_list( ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = lines( lt_fields ) ).
READ TABLE lt_fields TRANSPORTING NO FIELDS WITH KEY fieldname = 'DEPTH_M'.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
ENDMETHOD.
METHOD store_and_read.
DATA ls_job TYPE {{p}}well.
ls_job-client = sy-mandt.
ls_job-job_id = 'J1'.
ls_job-site_name = 'FARM NORTH'.
ls_job-depth_m = '120.50'.
ls_job-depth_unit = 'M'.
ls_job-price = '4500.00'.
ls_job-currency_code = 'EUR'.
INSERT {{p}}well FROM ls_job.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
SELECT SINGLE site_name, depth_m FROM {{p}}well WHERE job_id = 'J1' INTO @DATA(ls_db).
cl_abap_unit_assert=>assert_equals( exp = 'FARM NORTH' act = ls_db-site_name ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '120.50' )
act = CONV decfloat34( ls_db-depth_m ) ).
ENDMETHOD.
METHOD duplicate_key_rejected.
DATA ls_job TYPE {{p}}well.
ls_job-client = sy-mandt.
ls_job-job_id = 'J9'.
INSERT {{p}}well FROM ls_job.
INSERT {{p}}well FROM ls_job.
cl_abap_unit_assert=>assert_equals( exp = 4 act = sy-subrc ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,58 @@
# 1. Goal
A well-drilling company drills boreholes for farms and small businesses. The
company needs one database table that stores every drilling job. A report and an
OData service will read the jobs later. Therefore the table must be a
transparent database table in the ABAP Dictionary.
# 2. Open questions
None.
# 3. Context
- Package: $TMP.
- No source table exists. Create the table from scratch.
- One row of the table is one drilling job.
# 4. Contract
- Create the transparent database table {{P}}WELL in package $TMP.
- The table has these fields, with these names:
client, job_id, site_name, drilled_on, depth_m, depth_unit, price,
currency_code, permit_no, crew_size.
- Key fields: client and job_id.
# 5. Business rules
1. client is the client field. Data type abap.clnt. It is a key field and it is
not null.
2. job_id is the number of the drilling job. Data type abap.char(10). It is a
key field and it is not null.
3. site_name is the name of the drilling site. Data type abap.char(40).
4. drilled_on is the date of the drilling. Data type abap.dats.
5. depth_m is the drilled depth. Data type abap.dec(7,2). It is a quantity. The
unit of measure of the quantity is the value of the field depth_unit of the
same row.
6. depth_unit is the unit of depth_m. Data type abap.unit(3).
7. price is the price of the drilling job. Data type abap.dec(15,2). It is an
amount. The currency of the amount is the value of the field currency_code of
the same row.
8. currency_code is the currency of price. Data type abap.cuky.
9. permit_no is the permit number of the water authority. Data type
abap.numc(8).
10. crew_size is the number of workers on the drilling job. Data type
abap.int4.
11. Only client and job_id are key fields. All other fields are not key fields
and can be empty. Two jobs on the same site are two rows with different
job_id values.
# 6. Constraints
- Release target: SAP_BASIS 816 (ABAP Platform 2025), client 001.
- Create the table with a DDL source (define table ...). Do not use the classic
Dictionary maintenance screens.
- Coding standard: Clean ABAP. The table must be active and must have no syntax
error.
- Out of scope: do not create a CDS view, a report, a function module, or a
business class in this task.
# 7. Acceptance
- The table {{P}}WELL is active.
- The hidden tests pass.
- Write ABAP Unit tests for the table in a global test class in package $TMP.
Use CL_OSQL_TEST_ENVIRONMENT as the test double.

View File

@@ -0,0 +1,57 @@
{
"id": "G1955",
"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}}WELL",
"fields": [
"client",
"job_id",
"site_name",
"drilled_on",
"depth_m",
"depth_unit",
"price",
"currency_code",
"permit_no",
"crew_size"
]
}
],
"out_of_scope": [
"Do not create a CDS view, a report, a function module, or a business class in this task."
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}WELL_HIDDEN",
"file": "hidden/well_hidden.clas.abap",
"description": "T32 hidden tests: DDIC field list and OSQL test double"
}
],
"reference": [
{
"type": "TABL",
"name": "{{P}}WELL",
"file": "reference/well.tabl.asabap",
"description": "Drilling job table"
},
{
"type": "CLAS",
"name": "{{P}}WELL_TEST",
"file": "reference/well_test.clas.abap",
"description": "T32 own tests"
}
],
"craft_checks": []
}