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,15 @@
@EndUserText.label : 'Jump session'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}jump {
key client : abap.clnt not null;
session_id : abap.char(10) not null;
visitor_id : abap.char(10);
jump_date : abap.dats;
jump_minutes : abap.int4;
locker_no : abap.numc(4);
fee_amount : abap.dec(9,2);
paid : abap.char(1);
}

View File

@@ -0,0 +1,15 @@
@EndUserText.label : 'Jump session'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}jump {
key client : abap.clnt not null;
key session_id : abap.char(9) not null;
visitor_id : abap.char(10);
jump_date : abap.dats;
jump_minutes : abap.int4;
locker_no : abap.numc(4);
fee_amount : abap.dec(9,2);
paid : abap.char(1);
}

View File

@@ -0,0 +1,15 @@
@EndUserText.label : 'Jump session'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}jump {
key client : abap.clnt not null;
key session_id : abap.char(10) not null;
visitor_id : abap.char(10);
jump_date : abap.tims;
jump_minutes : abap.int4;
locker_no : abap.numc(4);
fee_amount : abap.dec(9,2);
paid : abap.char(1);
}

View File

@@ -0,0 +1,15 @@
@EndUserText.label : 'Jump session'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}jump {
key client : abap.clnt not null;
key session_id : abap.char(10) not null;
visitor_id : abap.char(10);
jump_date : abap.dats;
jump_minutes : abap.int4;
locker_no : abap.numc(3);
fee_amount : abap.dec(9,2);
paid : abap.char(1);
}

View File

@@ -0,0 +1,15 @@
@EndUserText.label : 'Jump session'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}jump {
key client : abap.clnt not null;
key session_id : abap.char(10) not null;
visitor_id : abap.char(10);
jump_date : abap.dats;
jump_minutes : abap.int4;
locker_no : abap.numc(4);
fee_amount : abap.dec(9,3);
paid : abap.char(1);
}

View File

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

View File

@@ -0,0 +1,149 @@
CLASS {{p}}jump_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-DATA gt_fields TYPE ddfields.
CLASS-METHODS class_setup.
CLASS-METHODS class_teardown.
METHODS setup.
METHODS field_info
IMPORTING iv_name TYPE fieldname
RETURNING VALUE(rs_info) TYPE dfies.
METHODS assert_field_exists
IMPORTING iv_name TYPE fieldname.
METHODS all_fields_exist FOR TESTING.
METHODS key_fields FOR TESTING.
METHODS char_fields FOR TESTING.
METHODS date_field FOR TESTING.
METHODS minutes_field FOR TESTING.
METHODS amount_field FOR TESTING.
METHODS client_field FOR TESTING.
METHODS insert_and_read FOR TESTING.
METHODS duplicate_key FOR TESTING.
METHODS filter_by_date FOR TESTING.
ENDCLASS.
CLASS {{p}}jump_hidden IMPLEMENTATION.
METHOD class_setup.
DATA(lo_struct) = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_name( '{{P}}JUMP' ) ).
gt_fields = lo_struct->get_ddic_field_list( ).
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}JUMP' ) ) ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
go_env->clear_doubles( ).
ENDMETHOD.
METHOD field_info.
READ TABLE gt_fields INTO rs_info WITH KEY fieldname = iv_name.
ENDMETHOD.
METHOD assert_field_exists.
cl_abap_unit_assert=>assert_equals( exp = iv_name act = field_info( iv_name )-fieldname ).
ENDMETHOD.
METHOD all_fields_exist.
cl_abap_unit_assert=>assert_equals( exp = 8 act = lines( gt_fields ) ).
assert_field_exists( 'CLIENT' ).
assert_field_exists( 'SESSION_ID' ).
assert_field_exists( 'VISITOR_ID' ).
assert_field_exists( 'JUMP_DATE' ).
assert_field_exists( 'JUMP_MINUTES' ).
assert_field_exists( 'LOCKER_NO' ).
assert_field_exists( 'FEE_AMOUNT' ).
assert_field_exists( 'PAID' ).
ENDMETHOD.
METHOD key_fields.
cl_abap_unit_assert=>assert_equals( exp = 'X' act = field_info( 'CLIENT' )-keyflag ).
cl_abap_unit_assert=>assert_equals( exp = 'X' act = field_info( 'SESSION_ID' )-keyflag ).
cl_abap_unit_assert=>assert_equals( exp = ' ' act = field_info( 'VISITOR_ID' )-keyflag ).
cl_abap_unit_assert=>assert_equals( exp = ' ' act = field_info( 'JUMP_DATE' )-keyflag ).
cl_abap_unit_assert=>assert_equals( exp = ' ' act = field_info( 'JUMP_MINUTES' )-keyflag ).
cl_abap_unit_assert=>assert_equals( exp = ' ' act = field_info( 'LOCKER_NO' )-keyflag ).
cl_abap_unit_assert=>assert_equals( exp = ' ' act = field_info( 'FEE_AMOUNT' )-keyflag ).
cl_abap_unit_assert=>assert_equals( exp = ' ' act = field_info( 'PAID' )-keyflag ).
ENDMETHOD.
METHOD char_fields.
cl_abap_unit_assert=>assert_equals( exp = 'C' act = field_info( 'SESSION_ID' )-inttype ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = field_info( 'SESSION_ID' )-leng ).
cl_abap_unit_assert=>assert_equals( exp = 'C' act = field_info( 'VISITOR_ID' )-inttype ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = field_info( 'VISITOR_ID' )-leng ).
cl_abap_unit_assert=>assert_equals( exp = 'N' act = field_info( 'LOCKER_NO' )-inttype ).
cl_abap_unit_assert=>assert_equals( exp = 4 act = field_info( 'LOCKER_NO' )-leng ).
cl_abap_unit_assert=>assert_equals( exp = 'C' act = field_info( 'PAID' )-inttype ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = field_info( 'PAID' )-leng ).
ENDMETHOD.
METHOD date_field.
cl_abap_unit_assert=>assert_equals( exp = 'D' act = field_info( 'JUMP_DATE' )-inttype ).
cl_abap_unit_assert=>assert_equals( exp = 8 act = field_info( 'JUMP_DATE' )-leng ).
ENDMETHOD.
METHOD minutes_field.
cl_abap_unit_assert=>assert_equals( exp = 'I' act = field_info( 'JUMP_MINUTES' )-inttype ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = field_info( 'JUMP_MINUTES' )-leng ).
ENDMETHOD.
METHOD amount_field.
cl_abap_unit_assert=>assert_equals( exp = 'P' act = field_info( 'FEE_AMOUNT' )-inttype ).
cl_abap_unit_assert=>assert_equals( exp = 9 act = field_info( 'FEE_AMOUNT' )-leng ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = field_info( 'FEE_AMOUNT' )-decimals ).
ENDMETHOD.
METHOD client_field.
cl_abap_unit_assert=>assert_equals( exp = 'C' act = field_info( 'CLIENT' )-inttype ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = field_info( 'CLIENT' )-leng ).
ENDMETHOD.
METHOD insert_and_read.
DATA(ls_jump) = VALUE {{p}}jump( session_id = 'S000000001'
visitor_id = 'V000000001'
jump_date = '20250401'
jump_minutes = 60
locker_no = '0007'
fee_amount = '12.50'
paid = 'X' ).
INSERT {{p}}jump FROM @ls_jump.
cl_abap_unit_assert=>assert_equals( exp = 0 act = sy-subrc ).
SELECT SINGLE * FROM {{p}}jump WHERE session_id = 'S000000001' INTO @DATA(ls_read).
cl_abap_unit_assert=>assert_equals( exp = ls_jump-visitor_id act = ls_read-visitor_id ).
cl_abap_unit_assert=>assert_equals( exp = ls_jump-jump_date act = ls_read-jump_date ).
cl_abap_unit_assert=>assert_equals( exp = ls_jump-jump_minutes act = ls_read-jump_minutes ).
cl_abap_unit_assert=>assert_equals( exp = ls_jump-locker_no act = ls_read-locker_no ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( ls_jump-fee_amount )
act = CONV decfloat34( ls_read-fee_amount ) ).
cl_abap_unit_assert=>assert_equals( exp = ls_jump-paid act = ls_read-paid ).
ENDMETHOD.
METHOD duplicate_key.
DATA(ls_jump) = VALUE {{p}}jump( session_id = 'S000000002'
visitor_id = 'V000000002'
jump_date = '20250402' ).
INSERT {{p}}jump FROM @ls_jump.
cl_abap_unit_assert=>assert_equals( exp = 0 act = sy-subrc ).
INSERT {{p}}jump FROM @ls_jump.
cl_abap_unit_assert=>assert_equals( exp = 4 act = sy-subrc ).
ENDMETHOD.
METHOD filter_by_date.
DATA lt_jump TYPE STANDARD TABLE OF {{p}}jump WITH EMPTY KEY.
lt_jump = VALUE #( ( session_id = 'S1' visitor_id = 'A' jump_date = '20250401' )
( session_id = 'S2' visitor_id = 'B' jump_date = '20250401' )
( session_id = 'S3' visitor_id = 'C' jump_date = '20250402' ) ).
INSERT {{p}}jump FROM TABLE @lt_jump.
cl_abap_unit_assert=>assert_equals( exp = 0 act = sy-subrc ).
SELECT * FROM {{p}}jump INTO TABLE @DATA(lt_all).
cl_abap_unit_assert=>assert_equals( exp = 3 act = lines( lt_all ) ).
SELECT * FROM {{p}}jump WHERE jump_date = '20250401' INTO TABLE @DATA(lt_day).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_day ) ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,57 @@
{
"task": "G1920",
"mutants": [
{
"object": "{{P}}JUMP",
"mutant": "line 8: key session_id : -> session_id : (key)",
"status": "killed",
"hidden": "8/10",
"failed_tests": [
"FILTER_BY_DATE",
"KEY_FIELDS"
]
},
{
"object": "{{P}}JUMP",
"mutant": "line 8: abap.char(10) -> abap.char(9) (length)",
"status": "killed",
"hidden": "8/10",
"failed_tests": [
"CHAR_FIELDS",
"INSERT_AND_READ"
]
},
{
"object": "{{P}}JUMP",
"mutant": "line 10: abap.dats -> abap.tims (type)",
"status": "killed",
"hidden": "8/10",
"failed_tests": [
"DATE_FIELD",
"FILTER_BY_DATE"
]
},
{
"object": "{{P}}JUMP",
"mutant": "line 12: abap.numc(4) -> abap.numc(3) (length)",
"status": "killed",
"hidden": "9/10",
"failed_tests": [
"CHAR_FIELDS"
]
},
{
"object": "{{P}}JUMP",
"mutant": "line 13: abap.dec(9,2) -> abap.dec(9,3) (decimals)",
"status": "killed",
"hidden": "9/10",
"failed_tests": [
"AMOUNT_FIELD"
]
}
],
"valid": 5,
"killed": 5,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,15 @@
@EndUserText.label : 'Jump session'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}jump {
key client : abap.clnt not null;
key session_id : abap.char(10) not null;
visitor_id : abap.char(10);
jump_date : abap.dats;
jump_minutes : abap.int4;
locker_no : abap.numc(4);
fee_amount : abap.dec(9,2);
paid : abap.char(1);
}

View File

@@ -0,0 +1,63 @@
CLASS {{p}}jump_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 fields_match_spec FOR TESTING.
METHODS insert_and_select FOR TESTING.
METHODS duplicate_key_fails FOR TESTING.
ENDCLASS.
CLASS {{p}}jump_test IMPLEMENTATION.
METHOD class_setup.
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}JUMP' ) ) ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
go_env->clear_doubles( ).
ENDMETHOD.
METHOD fields_match_spec.
DATA(lo_struct) = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_name( '{{P}}JUMP' ) ).
DATA(lt_fields) = lo_struct->get_ddic_field_list( ).
cl_abap_unit_assert=>assert_equals( exp = 8 act = lines( lt_fields ) ).
READ TABLE lt_fields INTO DATA(ls_field) WITH KEY fieldname = 'FEE_AMOUNT'.
cl_abap_unit_assert=>assert_equals( exp = 'P' act = ls_field-inttype ).
cl_abap_unit_assert=>assert_equals( exp = 9 act = ls_field-leng ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_field-decimals ).
READ TABLE lt_fields INTO ls_field WITH KEY fieldname = 'SESSION_ID'.
cl_abap_unit_assert=>assert_equals( exp = 'X' act = ls_field-keyflag ).
ENDMETHOD.
METHOD insert_and_select.
DATA(ls_jump) = VALUE {{p}}jump( session_id = 'S1'
visitor_id = 'V1'
jump_date = '20250401'
jump_minutes = 30
fee_amount = '9.50'
paid = 'X' ).
INSERT {{p}}jump FROM @ls_jump.
cl_abap_unit_assert=>assert_equals( exp = 0 act = sy-subrc ).
SELECT SINGLE * FROM {{p}}jump WHERE session_id = 'S1' INTO @DATA(ls_read).
cl_abap_unit_assert=>assert_equals( exp = ls_jump-visitor_id act = ls_read-visitor_id ).
cl_abap_unit_assert=>assert_equals( exp = ls_jump-jump_minutes act = ls_read-jump_minutes ).
ENDMETHOD.
METHOD duplicate_key_fails.
DATA(ls_jump) = VALUE {{p}}jump( session_id = 'S2'
visitor_id = 'V2'
jump_date = '20250402' ).
INSERT {{p}}jump FROM @ls_jump.
INSERT {{p}}jump FROM @ls_jump.
cl_abap_unit_assert=>assert_equals( exp = 4 act = sy-subrc ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,57 @@
# 1. Goal
The trampoline park records each jump session of its visitors in one database
table. The booking desk writes the sessions. The reporting tools read the
sessions. Create this database table.
# 2. Open questions
None.
# 3. Context
- Package $TMP, client 001.
- The park has no table for the jump sessions.
- The table is a transparent table.
# 4. Contract
- Create the transparent database table {{P}}JUMP in package $TMP.
- The table has exactly these fields:
| Field | Type | Key | Not null |
| --- | --- | --- | --- |
| client | ABAP client, length 3 | yes | yes |
| session_id | CHAR, length 10 | yes | yes |
| visitor_id | CHAR, length 10 | no | no |
| jump_date | DATS, length 8 | no | no |
| jump_minutes | INT4, length 10 | no | no |
| locker_no | NUMC, length 4 | no | no |
| fee_amount | DEC, length 9, 2 decimal places | no | no |
| paid | CHAR, length 1 | no | no |
- Enhancement category: not extensible.
- Delivery class: A. Data maintenance: restricted.
# 5. Business rules
1. One row of the table is one jump session.
2. client and session_id are the key fields. A session_id is unique for each
client.
3. client and session_id are not null. All other fields can be initial.
4. visitor_id identifies the visitor. It has 10 characters.
5. jump_date is the day of the session. Its format is YYYYMMDD.
6. jump_minutes is the number of minutes of the session. It is a whole number.
7. locker_no is the number of the locker of the visitor. It has 4 characters.
8. fee_amount is the price of the session. It has 9 digits and 2 decimal places.
9. paid is a flag with one character. The value 'X' means that the visitor paid
the fee. An initial value means that the visitor did not pay.
10. A second row with the same client and the same session_id is not possible.
The insert of this row gives the return code 4.
# 6. Constraints
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
- Coding standards: Clean ABAP. No syntax error. No ATC priority 1 or 2
findings.
- Out of scope: no other objects. Do not change any other object.
# 7. Acceptance
- The table {{P}}JUMP is active.
- The table has the fields, the key fields and the data types of the contract.
- The hidden tests pass.
- Write ABAP Unit tests in a global test class. Use CL_OSQL_TEST_ENVIRONMENT.

View File

@@ -0,0 +1,53 @@
{
"id": "G1920",
"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}}JUMP",
"fields": [
"client",
"session_id",
"visitor_id",
"jump_date",
"jump_minutes",
"locker_no",
"fee_amount",
"paid"
]
}
],
"out_of_scope": [],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}JUMP_HIDDEN",
"file": "hidden/jump_hidden.clas.abap",
"description": "Hidden tests for the table {{P}}JUMP"
}
],
"reference": [
{
"type": "TABL",
"name": "{{P}}JUMP",
"file": "reference/jump.tabl.asabap",
"description": "Jump session table"
},
{
"type": "CLAS",
"name": "{{P}}JUMP_TEST",
"file": "reference/jump_test.clas.abap",
"description": "Own tests for the table"
}
],
"craft_checks": []
}