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,9 @@
@EndUserText.label : 'Common fields of a roast batch'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
define structure {{p}}roast_base {
site : abap.numc(4);
batch_no : abap.char(10);
roast_day : abap.dats;
green_kg : abap.dec(9,3);
roasted_kg : abap.dec(9,3);
}

View File

@@ -0,0 +1,14 @@
@EndUserText.label : 'Result of one roast batch'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
define structure {{p}}roast_result {
site : abap.char(3);
batch_no : abap.char(10);
roast_day : abap.dats;
green_kg : abap.dec(9,3);
roasted_kg : abap.dec(9,3);
roast_level : abap.char(1);
roast_min : abap.int4;
loss_pct : abap.dec(5,2);
roaster_id : abap.char(8);
checked : abap.char(1);
}

View File

@@ -0,0 +1,9 @@
@EndUserText.label : 'Common fields of a roast batch'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
define structure {{p}}roast_base {
site : abap.char(3);
batch_no : abap.char(10);
roast_day : abap.dats;
green_kg : abap.dec(9,3);
roasted_kg : abap.dec(9,3);
}

View File

@@ -0,0 +1,14 @@
@EndUserText.label : 'Result of one roast batch'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
define structure {{p}}roast_result {
site : abap.numc(4);
batch_no : abap.char(10);
roast_day : abap.dats;
green_kg : abap.dec(9,3);
roasted_kg : abap.dec(9,3);
roast_level : abap.char(1);
roast_min : abap.int4;
loss_pct : abap.dec(5,2);
roaster_id : abap.char(8);
checked : abap.char(1);
}

View File

@@ -0,0 +1,9 @@
@EndUserText.label : 'Common fields of a roast batch'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
define structure {{p}}roast_base {
site : abap.char(4);
batch_no : abap.char(10);
roast_day : abap.tims;
green_kg : abap.dec(9,3);
roasted_kg : abap.dec(9,3);
}

View File

@@ -0,0 +1,24 @@
{
"id": "G1946",
"pool": "train",
"object_type": "STRU",
"category": "B",
"attempts": [
{
"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,135 @@
CLASS {{p}}roast_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS base_field_count FOR TESTING.
METHODS base_field_names FOR TESTING.
METHODS base_char_lengths FOR TESTING.
METHODS base_amount_types FOR TESTING.
METHODS base_day_type FOR TESTING.
METHODS result_field_count FOR TESTING.
METHODS result_starts_with_base FOR TESTING.
METHODS result_flag_fields FOR TESTING.
METHODS result_min_type FOR TESTING.
METHODS result_loss_type FOR TESTING.
METHODS result_roaster_type FOR TESTING.
ENDCLASS.
CLASS {{p}}roast_hidden IMPLEMENTATION.
METHOD base_field_count.
DATA(lo_str) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}ROAST_BASE' ) ).
DATA(lt_fields) = lo_str->get_ddic_field_list( ).
cl_abap_unit_assert=>assert_equals( exp = 5 act = lines( lt_fields ) ).
ENDMETHOD.
METHOD base_field_names.
DATA(lo_str) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}ROAST_BASE' ) ).
DATA(lt_fields) = lo_str->get_ddic_field_list( ).
cl_abap_unit_assert=>assert_equals( exp = 'SITE' act = lt_fields[ 1 ]-fieldname ).
cl_abap_unit_assert=>assert_equals( exp = 'BATCH_NO' act = lt_fields[ 2 ]-fieldname ).
cl_abap_unit_assert=>assert_equals( exp = 'ROAST_DAY' act = lt_fields[ 3 ]-fieldname ).
cl_abap_unit_assert=>assert_equals( exp = 'GREEN_KG' act = lt_fields[ 4 ]-fieldname ).
cl_abap_unit_assert=>assert_equals( exp = 'ROASTED_KG' act = lt_fields[ 5 ]-fieldname ).
ENDMETHOD.
METHOD base_char_lengths.
DATA(lo_str) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}ROAST_BASE' ) ).
DATA(lt_fields) = lo_str->get_ddic_field_list( ).
cl_abap_unit_assert=>assert_equals( exp = 'C' act = lt_fields[ 1 ]-inttype ).
cl_abap_unit_assert=>assert_equals( exp = 4 act = lt_fields[ 1 ]-leng ).
cl_abap_unit_assert=>assert_equals( exp = 'C' act = lt_fields[ 2 ]-inttype ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = lt_fields[ 2 ]-leng ).
ENDMETHOD.
METHOD base_amount_types.
DATA(lo_str) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}ROAST_BASE' ) ).
DATA(lt_fields) = lo_str->get_ddic_field_list( ).
cl_abap_unit_assert=>assert_equals( exp = 'P' act = lt_fields[ 4 ]-inttype ).
cl_abap_unit_assert=>assert_equals( exp = 9 act = lt_fields[ 4 ]-leng ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_fields[ 4 ]-decimals ).
cl_abap_unit_assert=>assert_equals( exp = 'P' act = lt_fields[ 5 ]-inttype ).
cl_abap_unit_assert=>assert_equals( exp = 9 act = lt_fields[ 5 ]-leng ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_fields[ 5 ]-decimals ).
ENDMETHOD.
METHOD base_day_type.
DATA(lo_str) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}ROAST_BASE' ) ).
DATA(lt_fields) = lo_str->get_ddic_field_list( ).
cl_abap_unit_assert=>assert_equals( exp = 'D' act = lt_fields[ 3 ]-inttype ).
cl_abap_unit_assert=>assert_equals( exp = 8 act = lt_fields[ 3 ]-leng ).
ENDMETHOD.
METHOD result_field_count.
DATA(lo_str) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}ROAST_RESULT' ) ).
DATA(lt_fields) = lo_str->get_ddic_field_list( ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = lines( lt_fields ) ).
ENDMETHOD.
METHOD result_starts_with_base.
DATA(lo_base) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}ROAST_BASE' ) ).
DATA(lo_res) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}ROAST_RESULT' ) ).
DATA(lt_base) = lo_base->get_ddic_field_list( ).
DATA(lt_res) = lo_res->get_ddic_field_list( ).
DO 5 TIMES.
cl_abap_unit_assert=>assert_equals(
exp = lt_base[ sy-index ]-fieldname
act = lt_res[ sy-index ]-fieldname ).
cl_abap_unit_assert=>assert_equals(
exp = lt_base[ sy-index ]-inttype
act = lt_res[ sy-index ]-inttype ).
cl_abap_unit_assert=>assert_equals(
exp = lt_base[ sy-index ]-leng
act = lt_res[ sy-index ]-leng ).
cl_abap_unit_assert=>assert_equals(
exp = lt_base[ sy-index ]-decimals
act = lt_res[ sy-index ]-decimals ).
ENDDO.
ENDMETHOD.
METHOD result_flag_fields.
DATA(lo_str) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}ROAST_RESULT' ) ).
DATA(lt_fields) = lo_str->get_ddic_field_list( ).
cl_abap_unit_assert=>assert_equals( exp = 'ROAST_LEVEL' act = lt_fields[ 6 ]-fieldname ).
cl_abap_unit_assert=>assert_equals( exp = 'C' act = lt_fields[ 6 ]-inttype ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_fields[ 6 ]-leng ).
cl_abap_unit_assert=>assert_equals( exp = 'CHECKED' act = lt_fields[ 10 ]-fieldname ).
cl_abap_unit_assert=>assert_equals( exp = 'C' act = lt_fields[ 10 ]-inttype ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_fields[ 10 ]-leng ).
ENDMETHOD.
METHOD result_min_type.
DATA(lo_str) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}ROAST_RESULT' ) ).
DATA(lt_fields) = lo_str->get_ddic_field_list( ).
cl_abap_unit_assert=>assert_equals( exp = 'ROAST_MIN' act = lt_fields[ 7 ]-fieldname ).
cl_abap_unit_assert=>assert_equals( exp = 'I' act = lt_fields[ 7 ]-inttype ).
ENDMETHOD.
METHOD result_loss_type.
DATA(lo_str) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}ROAST_RESULT' ) ).
DATA(lt_fields) = lo_str->get_ddic_field_list( ).
cl_abap_unit_assert=>assert_equals( exp = 'LOSS_PCT' act = lt_fields[ 8 ]-fieldname ).
cl_abap_unit_assert=>assert_equals( exp = 'P' act = lt_fields[ 8 ]-inttype ).
cl_abap_unit_assert=>assert_equals( exp = 5 act = lt_fields[ 8 ]-leng ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_fields[ 8 ]-decimals ).
ENDMETHOD.
METHOD result_roaster_type.
DATA(lo_str) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}ROAST_RESULT' ) ).
DATA(lt_fields) = lo_str->get_ddic_field_list( ).
cl_abap_unit_assert=>assert_equals( exp = 'ROASTER_ID' act = lt_fields[ 9 ]-fieldname ).
cl_abap_unit_assert=>assert_equals( exp = 'C' act = lt_fields[ 9 ]-inttype ).
cl_abap_unit_assert=>assert_equals( exp = 8 act = lt_fields[ 9 ]-leng ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,57 @@
{
"task": "G1946",
"mutants": [
{
"object": "{{P}}ROAST_BASE",
"mutant": "line 4: abap.char(4) -> abap.numc(4) (type)",
"status": "killed",
"hidden": "9/11",
"failed_tests": [
"BASE_CHAR_LENGTHS",
"RESULT_STARTS_WITH_BASE"
]
},
{
"object": "{{P}}ROAST_RESULT",
"mutant": "line 4: abap.char(4) -> abap.char(3) (length)",
"status": "killed",
"hidden": "10/11",
"failed_tests": [
"RESULT_STARTS_WITH_BASE"
]
},
{
"object": "{{P}}ROAST_BASE",
"mutant": "line 4: abap.char(4) -> abap.char(3) (length)",
"status": "killed",
"hidden": "9/11",
"failed_tests": [
"BASE_CHAR_LENGTHS",
"RESULT_STARTS_WITH_BASE"
]
},
{
"object": "{{P}}ROAST_RESULT",
"mutant": "line 4: abap.char(4) -> abap.numc(4) (type)",
"status": "killed",
"hidden": "10/11",
"failed_tests": [
"RESULT_STARTS_WITH_BASE"
]
},
{
"object": "{{P}}ROAST_BASE",
"mutant": "line 6: abap.dats -> abap.tims (type)",
"status": "killed",
"hidden": "9/11",
"failed_tests": [
"BASE_DAY_TYPE",
"RESULT_STARTS_WITH_BASE"
]
}
],
"valid": 5,
"killed": 5,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,9 @@
@EndUserText.label : 'Common fields of a roast batch'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
define structure {{p}}roast_base {
site : abap.char(4);
batch_no : abap.char(10);
roast_day : abap.dats;
green_kg : abap.dec(9,3);
roasted_kg : abap.dec(9,3);
}

View File

@@ -0,0 +1,14 @@
@EndUserText.label : 'Result of one roast batch'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
define structure {{p}}roast_result {
site : abap.char(4);
batch_no : abap.char(10);
roast_day : abap.dats;
green_kg : abap.dec(9,3);
roasted_kg : abap.dec(9,3);
roast_level : abap.char(1);
roast_min : abap.int4;
loss_pct : abap.dec(5,2);
roaster_id : abap.char(8);
checked : abap.char(1);
}

View File

@@ -0,0 +1,46 @@
CLASS {{p}}roast_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS base_has_five_fields FOR TESTING.
METHODS result_has_ten_fields FOR TESTING.
METHODS loss_has_two_decimals FOR TESTING.
METHODS result_starts_with_base FOR TESTING.
ENDCLASS.
CLASS {{p}}roast_test IMPLEMENTATION.
METHOD base_has_five_fields.
DATA(lo_str) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}ROAST_BASE' ) ).
DATA(lt_fields) = lo_str->get_ddic_field_list( ).
cl_abap_unit_assert=>assert_equals( exp = 5 act = lines( lt_fields ) ).
ENDMETHOD.
METHOD result_has_ten_fields.
DATA(lo_str) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}ROAST_RESULT' ) ).
DATA(lt_fields) = lo_str->get_ddic_field_list( ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = lines( lt_fields ) ).
ENDMETHOD.
METHOD loss_has_two_decimals.
DATA(lo_str) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}ROAST_RESULT' ) ).
DATA(lt_fields) = lo_str->get_ddic_field_list( ).
READ TABLE lt_fields INTO DATA(ls_field) WITH KEY fieldname = 'LOSS_PCT'.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_field-decimals ).
ENDMETHOD.
METHOD result_starts_with_base.
DATA(lo_base) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}ROAST_BASE' ) ).
DATA(lo_res) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}ROAST_RESULT' ) ).
DATA(lt_base) = lo_base->get_ddic_field_list( ).
DATA(lt_res) = lo_res->get_ddic_field_list( ).
cl_abap_unit_assert=>assert_equals( exp = lt_base[ 1 ]-fieldname act = lt_res[ 1 ]-fieldname ).
cl_abap_unit_assert=>assert_equals( exp = lt_base[ 5 ]-fieldname act = lt_res[ 5 ]-fieldname ).
cl_abap_unit_assert=>assert_equals( exp = lt_base[ 5 ]-leng act = lt_res[ 5 ]-leng ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,18 @@
@EndUserText.label : 'Roast batch log'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}roast {
key client : abap.clnt not null;
key site : abap.char(4) not null;
key batch_no : abap.char(10) not null;
roast_day : abap.dats;
green_kg : abap.dec(9,3);
roasted_kg : abap.dec(9,3);
roast_level : abap.char(1);
roast_min : abap.int4;
loss_pct : abap.dec(5,2);
roaster_id : abap.char(8);
checked : abap.char(1);
}

View File

@@ -0,0 +1,55 @@
# 1. Goal
The coffee roastery "Ember Roast" records every roast batch in the database table
{{P}}ROAST. A report and an OData service read the roast batches into an internal
table. The line type of this internal table is the structure {{P}}ROAST_RESULT.
Create the two structures that the report and the OData service need.
# 2. Open questions
None.
# 3. Context
- Table {{P}}ROAST (roast batch log), package $TMP. The table is in the system.
Key fields: CLIENT (CLNT 3), SITE (CHAR 4), BATCH_NO (CHAR 10).
Other fields: ROAST_DAY (DATS), GREEN_KG (DEC 9,3), ROASTED_KG (DEC 9,3),
ROAST_LEVEL (CHAR 1), ROAST_MIN (INT4), LOSS_PCT (DEC 5,2),
ROASTER_ID (CHAR 8), CHECKED (CHAR 1).
- The report and the OData service use the structure {{P}}ROAST_RESULT as the
line type of their internal table.
- The green coffee intake uses the structure {{P}}ROAST_BASE. It holds the five
fields that every roast batch has in common.
# 4. Contract
- Create the structure {{P}}ROAST_BASE in package $TMP.
- Create the structure {{P}}ROAST_RESULT in package $TMP.
- Fields of {{P}}ROAST_BASE, in this order: site, batch_no, roast_day, green_kg,
roasted_kg.
- Fields of {{P}}ROAST_RESULT, in this order: site, batch_no, roast_day, green_kg,
roasted_kg, roast_level, roast_min, loss_pct, roaster_id, checked.
# 5. Business rules
1. The structure {{P}}ROAST_BASE has exactly five fields. The fields are, in this
order: SITE (CHAR 4), BATCH_NO (CHAR 10), ROAST_DAY (DATS), GREEN_KG
(DEC 9,3) and ROASTED_KG (DEC 9,3).
2. The structure {{P}}ROAST_RESULT has exactly ten fields.
3. The first five fields of {{P}}ROAST_RESULT have the same names, data types,
lengths and number of decimals as the five fields of {{P}}ROAST_BASE, in the
same order.
4. The last five fields of {{P}}ROAST_RESULT are, in this order: ROAST_LEVEL
(CHAR 1), ROAST_MIN (INT4), LOSS_PCT (DEC 5,2), ROASTER_ID (CHAR 8) and
CHECKED (CHAR 1).
5. GREEN_KG and ROASTED_KG have 3 decimals. LOSS_PCT has 2 decimals.
6. The fields of the two structures have the same data types, lengths and number
of decimals as the fields with the same names in the table {{P}}ROAST.
# 6. Constraints
- Release target: ABAP Platform 2025 (SAP_BASIS 816).
- Create both structures as DDL sources (define structure) in package $TMP.
- Both structures are not extensible.
- Out of scope: do not change {{P}}ROAST.
# 7. Acceptance
- Both structures are active and have no syntax error.
- The hidden tests pass.
- Write ABAP Unit tests in a global test class. The tests read the fields of both
structures with RTTI and check the names, the data types, the lengths and the
number of decimals.

View File

@@ -0,0 +1,81 @@
{
"id": "G1946",
"category": "B",
"object_type": "STRU",
"difficulty": 3,
"release_target": "v816",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 60,
"max_activations": 15
},
"seed": [
{
"type": "TABL",
"name": "{{P}}ROAST",
"file": "seed/roast.tabl.asabap",
"description": "Roast batch log"
}
],
"contract": [
{
"type": "STRU",
"name": "{{P}}ROAST_BASE",
"fields": [
"site",
"batch_no",
"roast_day",
"green_kg",
"roasted_kg"
]
},
{
"type": "STRU",
"name": "{{P}}ROAST_RESULT",
"fields": [
"site",
"batch_no",
"roast_day",
"green_kg",
"roasted_kg",
"roast_level",
"roast_min",
"loss_pct",
"roaster_id",
"checked"
]
}
],
"out_of_scope": [
"{{P}}ROAST"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}ROAST_HIDDEN",
"file": "hidden/roast_hidden.clas.abap",
"description": "Field checks for both structures"
}
],
"reference": [
{
"type": "STRU",
"name": "{{P}}ROAST_BASE",
"file": "reference/roast_base.stru.asabap",
"description": "Common fields of a roast batch"
},
{
"type": "STRU",
"name": "{{P}}ROAST_RESULT",
"file": "reference/roast_result.stru.asabap",
"description": "Line type of the roast batch report"
},
{
"type": "CLAS",
"name": "{{P}}ROAST_TEST",
"file": "reference/roast_test.clas.abap",
"description": "Own tests for the two structures"
}
],
"craft_checks": []
}