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 : 'Window cleaning job'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}winjob {
key client : abap.clnt not null;
job_id : abap.char(10) not null;
customer : abap.char(10);
work_hours : abap.int4;
calc_mode : abap.char(2);
order_date : abap.dats;
pane_count : abap.int4;
group_code : abap.char(4);
net_value : abap.dec(15,2);
}

View File

@@ -0,0 +1,16 @@
@EndUserText.label : 'Window cleaning job'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}winjob {
key client : abap.clnt not null;
key job_id : abap.numc(10) not null;
customer : abap.char(10);
work_hours : abap.int4;
calc_mode : abap.char(2);
order_date : abap.dats;
pane_count : abap.int4;
group_code : abap.char(4);
net_value : abap.dec(15,2);
}

View File

@@ -0,0 +1,16 @@
@EndUserText.label : 'Window cleaning job'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}winjob {
key client : abap.clnt not null;
key job_id : abap.char(10) not null;
customer : abap.char(10);
work_hours : abap.int4;
calc_mode : abap.char(1);
order_date : abap.dats;
pane_count : abap.int4;
group_code : abap.char(4);
net_value : abap.dec(15,2);
}

View File

@@ -0,0 +1,16 @@
@EndUserText.label : 'Window cleaning job'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}winjob {
key client : abap.clnt not null;
key job_id : abap.char(10) not null;
customer : abap.char(10);
work_hours : abap.int4;
calc_mode : abap.char(2);
order_date : abap.dats;
pane_count : abap.int8;
group_code : abap.char(4);
net_value : abap.dec(15,2);
}

View File

@@ -0,0 +1,16 @@
@EndUserText.label : 'Window cleaning job'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}winjob {
key client : abap.clnt not null;
key job_id : abap.char(10) not null;
customer : abap.char(10);
work_hours : abap.int4;
calc_mode : abap.char(2);
order_date : abap.dats;
pane_count : abap.int4;
group_code : abap.char(4);
net_value : abap.dec(15,3);
}

View File

@@ -0,0 +1,44 @@
{
"id": "G1957",
"pool": "train",
"object_type": "TABL",
"category": "B",
"attempts": [
{
"stage": "bundle",
"errors": [
"reference/t61_test.clas.abap line 38: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"INSERT\"",
"reference/t61_test.clas.abap line 48: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"INSERT\"",
"reference/t61_test.clas.abap line 50: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"INSERT\"",
"reference/t61_test.clas.abap line 57: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"INSERT\"",
"hidden/t61_hidden.clas.abap line 106: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"INSERT\"",
"hidden/t61_hidden.clas.abap line 119: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"INSERT\"",
"hidden/t61_hidden.clas.abap line 121: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"INSERT\""
],
"by_check": {
"abaplint": 7
}
},
{
"stage": "validate",
"oracle": 0,
"null": 0
},
{
"stage": "validate",
"oracle": 0,
"null": 0
},
{
"stage": "validate",
"oracle": 100.0,
"null": 0,
"mutation": {
"valid": 5,
"killed": 5,
"ok": true
}
}
],
"accepted": true
}

View File

@@ -0,0 +1,116 @@
CLASS {{p}}t61_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 table_descr RETURNING VALUE(ro_descr) TYPE REF TO cl_abap_structdescr.
METHODS trimmed IMPORTING iv_value TYPE clike
RETURNING VALUE(rv_value) TYPE string.
METHODS field_names FOR TESTING.
METHODS field_lengths FOR TESTING.
METHODS field_types FOR TESTING.
METHODS field_decimals FOR TESTING.
METHODS insert_and_read FOR TESTING.
METHODS reads_two_jobs FOR TESTING.
ENDCLASS.
CLASS {{p}}t61_hidden IMPLEMENTATION.
METHOD class_setup.
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}WINJOB' ) ) ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
go_env->clear_doubles( ).
ENDMETHOD.
METHOD table_descr.
ro_descr = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_name( '{{P}}WINJOB' ) ).
ENDMETHOD.
METHOD trimmed.
rv_value = iv_value.
SHIFT rv_value RIGHT DELETING TRAILING space.
ENDMETHOD.
METHOD field_names.
DATA(lt_components) = table_descr( )->get_components( ).
DATA(lv_act) = ``.
LOOP AT lt_components INTO DATA(ls_comp).
lv_act = lv_act && ls_comp-name && `;`.
ENDLOOP.
cl_abap_unit_assert=>assert_equals(
exp = `CLIENT;JOB_ID;CUSTOMER;WORK_HOURS;CALC_MODE;ORDER_DATE;PANE_COUNT;GROUP_CODE;NET_VALUE;`
act = lv_act ).
ENDMETHOD.
METHOD field_lengths.
DATA(lt_components) = table_descr( )->get_components( ).
DATA(lv_act) = ``.
LOOP AT lt_components INTO DATA(ls_comp).
DATA(lo_elem) = CAST cl_abap_elemdescr( ls_comp-type ).
IF lo_elem->type_kind = 'C'.
DATA(lv_len) = lo_elem->length / 2.
lv_act = lv_act && |{ lv_len }| && `;`.
ENDIF.
ENDLOOP.
cl_abap_unit_assert=>assert_equals( exp = `3;10;10;2;4;` act = lv_act ).
ENDMETHOD.
METHOD field_types.
DATA(lt_components) = table_descr( )->get_components( ).
DATA(lv_act) = ``.
LOOP AT lt_components INTO DATA(ls_comp).
DATA(lo_elem) = CAST cl_abap_elemdescr( ls_comp-type ).
lv_act = lv_act && lo_elem->type_kind && `;`.
ENDLOOP.
cl_abap_unit_assert=>assert_equals( exp = `C;C;C;I;C;D;I;C;P;` act = lv_act ).
ENDMETHOD.
METHOD field_decimals.
DATA(lt_components) = table_descr( )->get_components( ).
DATA(lv_act) = ``.
LOOP AT lt_components INTO DATA(ls_comp).
DATA(lo_elem) = CAST cl_abap_elemdescr( ls_comp-type ).
IF lo_elem->type_kind = 'P'.
lv_act = lv_act && |{ lo_elem->decimals }| && `;`.
ENDIF.
ENDLOOP.
cl_abap_unit_assert=>assert_equals( exp = `2;` act = lv_act ).
ENDMETHOD.
METHOD insert_and_read.
DATA lt_job TYPE STANDARD TABLE OF {{p}}winjob WITH EMPTY KEY.
lt_job = VALUE #( ( client = sy-mandt
job_id = 'J1'
customer = 'CUST01'
work_hours = 3
calc_mode = 'HR'
order_date = '20240115'
pane_count = 12
group_code = 'PRIV'
net_value = '125.50' ) ).
go_env->insert_test_data( lt_job ).
SELECT SINGLE * FROM {{p}}winjob WHERE job_id = 'J1' INTO @DATA(ls_read).
cl_abap_unit_assert=>assert_equals( exp = `CUST01` act = trimmed( ls_read-customer ) ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = ls_read-work_hours ).
cl_abap_unit_assert=>assert_equals( exp = `PRIV` act = trimmed( ls_read-group_code ) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '125.50' )
act = CONV decfloat34( ls_read-net_value ) ).
ENDMETHOD.
METHOD reads_two_jobs.
DATA lt_job TYPE STANDARD TABLE OF {{p}}winjob WITH EMPTY KEY.
lt_job = VALUE #( ( client = sy-mandt job_id = 'K1' customer = 'ALPHA' )
( client = sy-mandt job_id = 'K2' customer = 'BETA' ) ).
go_env->insert_test_data( lt_job ).
SELECT COUNT(*) FROM {{p}}winjob INTO @DATA(lv_count).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,56 @@
{
"task": "G1957",
"mutants": [
{
"object": "{{P}}WINJOB",
"mutant": "line 8: key job_id : -> job_id : (key)",
"status": "killed",
"hidden": "5/6",
"failed_tests": [
"READS_TWO_JOBS"
]
},
{
"object": "{{P}}WINJOB",
"mutant": "line 8: abap.char(10) -> abap.numc(10) (type)",
"status": "killed",
"hidden": "3/6",
"failed_tests": [
"FIELD_LENGTHS",
"FIELD_TYPES",
"INSERT_AND_READ"
]
},
{
"object": "{{P}}WINJOB",
"mutant": "line 11: abap.char(2) -> abap.char(1) (length)",
"status": "killed",
"hidden": "5/6",
"failed_tests": [
"FIELD_LENGTHS"
]
},
{
"object": "{{P}}WINJOB",
"mutant": "line 13: abap.int4 -> abap.int8 (type)",
"status": "killed",
"hidden": "5/6",
"failed_tests": [
"FIELD_TYPES"
]
},
{
"object": "{{P}}WINJOB",
"mutant": "line 15: abap.dec(15,2) -> abap.dec(15,3) (decimals)",
"status": "killed",
"hidden": "5/6",
"failed_tests": [
"FIELD_DECIMALS"
]
}
],
"valid": 5,
"killed": 5,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,68 @@
CLASS {{p}}t61_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 trimmed IMPORTING iv_value TYPE clike
RETURNING VALUE(rv_value) TYPE string.
METHODS stores_a_job FOR TESTING.
METHODS reads_net_value FOR TESTING.
METHODS reads_two_jobs FOR TESTING.
ENDCLASS.
CLASS {{p}}t61_test IMPLEMENTATION.
METHOD class_setup.
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}WINJOB' ) ) ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
go_env->clear_doubles( ).
ENDMETHOD.
METHOD trimmed.
rv_value = iv_value.
SHIFT rv_value RIGHT DELETING TRAILING space.
ENDMETHOD.
METHOD stores_a_job.
DATA lt_job TYPE STANDARD TABLE OF {{p}}winjob WITH EMPTY KEY.
lt_job = VALUE #( ( client = sy-mandt
job_id = 'A1'
customer = 'C1'
work_hours = 2
calc_mode = 'FX'
order_date = '20240201'
pane_count = 4
group_code = 'PRIV'
net_value = '99.00' ) ).
go_env->insert_test_data( lt_job ).
SELECT SINGLE * FROM {{p}}winjob WHERE job_id = 'A1' INTO @DATA(ls_read).
cl_abap_unit_assert=>assert_equals( exp = `C1` act = trimmed( ls_read-customer ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_read-work_hours ).
ENDMETHOD.
METHOD reads_net_value.
DATA lt_job TYPE STANDARD TABLE OF {{p}}winjob WITH EMPTY KEY.
lt_job = VALUE #( ( client = sy-mandt job_id = 'A3' net_value = '12.34' ) ).
go_env->insert_test_data( lt_job ).
SELECT SINGLE net_value FROM {{p}}winjob WHERE job_id = 'A3' INTO @DATA(lv_value).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '12.34' )
act = CONV decfloat34( lv_value ) ).
ENDMETHOD.
METHOD reads_two_jobs.
DATA lt_job TYPE STANDARD TABLE OF {{p}}winjob WITH EMPTY KEY.
lt_job = VALUE #( ( client = sy-mandt job_id = 'A4' )
( client = sy-mandt job_id = 'A5' ) ).
go_env->insert_test_data( lt_job ).
SELECT COUNT(*) FROM {{p}}winjob INTO @DATA(lv_count).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,16 @@
@EndUserText.label : 'Window cleaning job'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}winjob {
key client : abap.clnt not null;
key job_id : abap.char(10) not null;
customer : abap.char(10);
work_hours : abap.int4;
calc_mode : abap.char(2);
order_date : abap.dats;
pane_count : abap.int4;
group_code : abap.char(4);
net_value : abap.dec(15,2);
}

View File

@@ -0,0 +1,56 @@
# 1. Goal
A mobile window cleaning company records each cleaning job. Store the jobs in
one database table. Later reports and services read this table.
# 2. Open questions
None.
# 3. Context
- Package: $TMP.
- The table is new. There is no other object for this task.
- The company writes one row for each cleaning job.
- A job has a customer, the hours of work, the calculation mode, the date of
the order, the number of panes, the group of the job and the net value.
# 4. Contract
- Create the transparent database table {{P}}WINJOB in package $TMP.
- The table has these fields, in this order: client, job_id, customer,
work_hours, calc_mode, order_date, pane_count, group_code, net_value.
- The key fields are client and job_id.
# 5. Business rules
1. The fields have these data types:
- client: the client field. Key field. Not null.
- job_id: character, length 10. Key field. Not null.
- customer: character, length 10.
- work_hours: integer. The hours of work.
- calc_mode: character, length 2. The calculation mode.
- order_date: date. The date of the order.
- pane_count: integer. The number of panes.
- group_code: character, length 4. The group of the job.
- net_value: packed number, length 15, 2 decimals. The net value of the job.
2. The key of the table is the client and the job id together. A job id is
unique for one client.
3. All key fields are not null. The other fields can be null.
4. The field order in the table is the field order in the contract.
# 6. Constraints
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
- Coding standards:
- Clean ABAP.
- Use the field names of the contract.
- Do not use ABAP SQL reserved words as field names. For example, do not use
hours, mode, order, date, count, group or value.
- Out of scope: do not create other objects. Do not change SAP objects.
# 7. Acceptance
- The table {{P}}WINJOB 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.

View File

@@ -0,0 +1,54 @@
{
"id": "G1957",
"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}}WINJOB",
"fields": [
"client",
"job_id",
"customer",
"work_hours",
"calc_mode",
"order_date",
"pane_count",
"group_code",
"net_value"
]
}
],
"out_of_scope": [],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}T61_HIDDEN",
"file": "hidden/t61_hidden.clas.abap",
"description": "RTTI checks and database tests for {{P}}WINJOB"
}
],
"reference": [
{
"type": "TABL",
"name": "{{P}}WINJOB",
"file": "reference/winjob.tabl.asabap",
"description": "Window cleaning jobs"
},
{
"type": "CLAS",
"name": "{{P}}T61_TEST",
"file": "reference/t61_test.clas.abap",
"description": "Own tests for {{P}}WINJOB"
}
],
"craft_checks": []
}