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,35 @@
{
"id": "G1953",
"pool": "train",
"object_type": "INTF",
"category": "A",
"attempts": [
{
"stage": "bundle",
"errors": [
"Too close to task G1916 (similarity spec 0.61, rules 0.65, names 0.33). Choose a different business topic and different object names.",
"Too close to task G1918 (similarity spec 0.53, rules 0.60, names 0.00). Choose a different business topic and different object names.",
"Too close to task G1933 (similarity spec 0.56, rules 0.64, names 0.00). Choose a different business topic and different object names."
],
"by_check": {
"extra": 3
}
},
{
"stage": "validate",
"oracle": 0,
"null": 0
},
{
"stage": "validate",
"oracle": 79.9,
"null": 0
},
{
"stage": "validate",
"oracle": 81.4,
"null": 0
}
],
"accepted": false
}

View File

@@ -0,0 +1,149 @@
CLASS {{p}}t44_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PUBLIC SECTION.
INTERFACES {{p}}if_piano_tuning.
PRIVATE SECTION.
DATA mo_cut TYPE REF TO {{p}}if_piano_tuning.
METHODS setup.
METHODS code_values FOR TESTING.
METHODS number_values FOR TESTING.
METHODS type_lengths FOR TESTING.
METHODS visit_components FOR TESTING.
METHODS summary_components FOR TESTING.
METHODS visit_table FOR TESTING.
METHODS check_visit_signature FOR TESTING.
METHODS check_visits_signature FOR TESTING.
METHODS summarise_signature FOR TESTING.
METHODS count_blocked_signature FOR TESTING.
METHODS model_signature FOR TESTING.
ENDCLASS.
CLASS {{p}}t44_hidden IMPLEMENTATION.
METHOD {{p}}if_piano_tuning~check_visit.
rv_code = {{p}}if_piano_tuning=>c_code-ok.
ENDMETHOD.
METHOD {{p}}if_piano_tuning~check_visits.
rv_code = {{p}}if_piano_tuning=>c_code-ok.
ENDMETHOD.
METHOD {{p}}if_piano_tuning~summarise.
rs_summary = VALUE #( accepted = lines( it_visits )
first_code = {{p}}if_piano_tuning=>c_code-ok ).
ENDMETHOD.
METHOD {{p}}if_piano_tuning~count_blocked.
ev_count = lines( it_visits ).
ev_code = {{p}}if_piano_tuning=>c_code-ok.
ENDMETHOD.
METHOD {{p}}if_piano_tuning~is_tuning_model.
rv_tuning = abap_true.
ENDMETHOD.
METHOD setup.
mo_cut = me.
ENDMETHOD.
METHOD code_values.
cl_abap_unit_assert=>assert_equals( exp = 'OK' act = {{p}}if_piano_tuning=>c_code-ok ).
cl_abap_unit_assert=>assert_equals( exp = 'NO_VISIT' act = {{p}}if_piano_tuning=>c_code-no_visit ).
cl_abap_unit_assert=>assert_equals( exp = 'MODEL' act = {{p}}if_piano_tuning=>c_code-model ).
cl_abap_unit_assert=>assert_equals( exp = 'PITCH' act = {{p}}if_piano_tuning=>c_code-pitch ).
cl_abap_unit_assert=>assert_equals( exp = 'DISTANCE' act = {{p}}if_piano_tuning=>c_code-distance ).
cl_abap_unit_assert=>assert_equals( exp = 'COUNT' act = {{p}}if_piano_tuning=>c_code-too_many ).
ENDMETHOD.
METHOD number_values.
cl_abap_unit_assert=>assert_equals( exp = 25 act = {{p}}if_piano_tuning=>c_max_pitch ).
cl_abap_unit_assert=>assert_equals( exp = 60 act = {{p}}if_piano_tuning=>c_max_distance ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = {{p}}if_piano_tuning=>c_max_pianos ).
ENDMETHOD.
METHOD type_lengths.
DATA lv_code TYPE {{p}}if_piano_tuning=>ty_code.
DATA lv_model TYPE {{p}}if_piano_tuning=>ty_model.
DATA lv_visit_id TYPE {{p}}if_piano_tuning=>ty_visit_id.
cl_abap_unit_assert=>assert_equals(
exp = 10
act = cl_abap_typedescr=>describe_by_data( lv_code )->length ).
cl_abap_unit_assert=>assert_equals(
exp = 4
act = cl_abap_typedescr=>describe_by_data( lv_model )->length ).
cl_abap_unit_assert=>assert_equals(
exp = 8
act = cl_abap_typedescr=>describe_by_data( lv_visit_id )->length ).
ENDMETHOD.
METHOD visit_components.
DATA ls_visit TYPE {{p}}if_piano_tuning=>ty_visit.
ls_visit-visit_id = 'V-000001'.
ls_visit-model = 'UPRI'.
ls_visit-pitch_dev = 12.
ls_visit-distance_km = 30.
ls_visit-piano_count = 2.
cl_abap_unit_assert=>assert_equals( exp = 'UPRI' act = ls_visit-model ).
cl_abap_unit_assert=>assert_equals( exp = 12 act = ls_visit-pitch_dev ).
cl_abap_unit_assert=>assert_equals( exp = 30 act = ls_visit-distance_km ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_visit-piano_count ).
ENDMETHOD.
METHOD summary_components.
DATA ls_summary TYPE {{p}}if_piano_tuning=>ty_summary.
ls_summary-accepted = 7.
ls_summary-rejected = 3.
ls_summary-first_code = {{p}}if_piano_tuning=>c_code-pitch.
cl_abap_unit_assert=>assert_equals( exp = 7 act = ls_summary-accepted ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = ls_summary-rejected ).
ENDMETHOD.
METHOD visit_table.
DATA lt_visits TYPE {{p}}if_piano_tuning=>tt_visits.
DATA ls_visit TYPE {{p}}if_piano_tuning=>ty_visit.
ls_visit-visit_id = 'V-000002'.
INSERT ls_visit INTO TABLE lt_visits.
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_visits ) ).
ENDMETHOD.
METHOD check_visit_signature.
DATA ls_visit TYPE {{p}}if_piano_tuning=>ty_visit.
ls_visit-visit_id = 'V-000003'.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_piano_tuning=>c_code-ok
act = mo_cut->check_visit( is_visit = ls_visit ) ).
ENDMETHOD.
METHOD check_visits_signature.
DATA lt_visits TYPE {{p}}if_piano_tuning=>tt_visits.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_piano_tuning=>c_code-ok
act = mo_cut->check_visits( it_visits = lt_visits ) ).
ENDMETHOD.
METHOD summarise_signature.
DATA lt_visits TYPE {{p}}if_piano_tuning=>tt_visits.
DATA ls_summary TYPE {{p}}if_piano_tuning=>ty_summary.
ls_summary = mo_cut->summarise( it_visits = lt_visits ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = ls_summary-accepted ).
ENDMETHOD.
METHOD count_blocked_signature.
DATA lt_visits TYPE {{p}}if_piano_tuning=>tt_visits.
DATA lv_count TYPE i.
DATA lv_code TYPE {{p}}if_piano_tuning=>ty_code.
mo_cut->count_blocked(
EXPORTING it_visits = lt_visits
IMPORTING ev_count = lv_count
ev_code = lv_code ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_count ).
ENDMETHOD.
METHOD model_signature.
DATA lv_model TYPE {{p}}if_piano_tuning=>ty_model.
lv_model = 'UPRI'.
cl_abap_unit_assert=>assert_equals(
exp = abap_true
act = mo_cut->is_tuning_model( iv_model = lv_model ) ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,8 @@
{
"task": "T44",
"mutants": [],
"valid": 0,
"killed": 0,
"kill_rate": 0.0,
"ok": true
}

View File

@@ -0,0 +1,53 @@
INTERFACE {{p}}if_piano_tuning PUBLIC.
TYPES:
ty_code TYPE c LENGTH 10,
ty_model TYPE c LENGTH 4,
ty_visit_id TYPE c LENGTH 8,
BEGIN OF ty_visit,
visit_id TYPE ty_visit_id,
model TYPE ty_model,
pitch_dev TYPE i,
distance_km TYPE i,
piano_count TYPE i,
END OF ty_visit,
tt_visits TYPE STANDARD TABLE OF ty_visit WITH EMPTY KEY,
BEGIN OF ty_summary,
accepted TYPE i,
rejected TYPE i,
first_code TYPE ty_code,
END OF ty_summary.
CONSTANTS:
BEGIN OF c_code,
ok TYPE ty_code VALUE 'OK',
no_visit TYPE ty_code VALUE 'NO_VISIT',
model TYPE ty_code VALUE 'MODEL',
pitch TYPE ty_code VALUE 'PITCH',
distance TYPE ty_code VALUE 'DISTANCE',
too_many TYPE ty_code VALUE 'COUNT',
END OF c_code,
c_max_pitch TYPE i VALUE 25,
c_max_distance TYPE i VALUE 60,
c_max_pianos TYPE i VALUE 3.
METHODS check_visit
IMPORTING is_visit TYPE ty_visit
RETURNING VALUE(rv_code) TYPE ty_code.
METHODS check_visits
IMPORTING it_visits TYPE tt_visits
RETURNING VALUE(rv_code) TYPE ty_code.
METHODS summarise
IMPORTING it_visits TYPE tt_visits
RETURNING VALUE(rs_summary) TYPE ty_summary.
METHODS count_blocked
IMPORTING it_visits TYPE tt_visits
EXPORTING ev_count TYPE i
ev_code TYPE ty_code.
METHODS is_tuning_model
IMPORTING iv_model TYPE ty_model
RETURNING VALUE(rv_tuning) TYPE abap_bool.
ENDINTERFACE.

View File

@@ -0,0 +1,110 @@
CLASS {{p}}piano_tuning_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PUBLIC SECTION.
INTERFACES {{p}}if_piano_tuning.
PRIVATE SECTION.
DATA mo_cut TYPE REF TO {{p}}if_piano_tuning.
METHODS setup.
METHODS code_values FOR TESTING.
METHODS number_values FOR TESTING.
METHODS type_lengths FOR TESTING.
METHODS visit_structure FOR TESTING.
METHODS methods_are_callable FOR TESTING.
ENDCLASS.
CLASS {{p}}piano_tuning_test IMPLEMENTATION.
METHOD {{p}}if_piano_tuning~check_visit.
rv_code = {{p}}if_piano_tuning=>c_code-ok.
ENDMETHOD.
METHOD {{p}}if_piano_tuning~check_visits.
rv_code = {{p}}if_piano_tuning=>c_code-ok.
ENDMETHOD.
METHOD {{p}}if_piano_tuning~summarise.
rs_summary = VALUE #( accepted = lines( it_visits )
first_code = {{p}}if_piano_tuning=>c_code-ok ).
ENDMETHOD.
METHOD {{p}}if_piano_tuning~count_blocked.
ev_count = lines( it_visits ).
ev_code = {{p}}if_piano_tuning=>c_code-ok.
ENDMETHOD.
METHOD {{p}}if_piano_tuning~is_tuning_model.
rv_tuning = abap_true.
ENDMETHOD.
METHOD setup.
mo_cut = me.
ENDMETHOD.
METHOD code_values.
cl_abap_unit_assert=>assert_equals( exp = 'OK' act = {{p}}if_piano_tuning=>c_code-ok ).
cl_abap_unit_assert=>assert_equals( exp = 'NO_VISIT' act = {{p}}if_piano_tuning=>c_code-no_visit ).
cl_abap_unit_assert=>assert_equals( exp = 'MODEL' act = {{p}}if_piano_tuning=>c_code-model ).
cl_abap_unit_assert=>assert_equals( exp = 'PITCH' act = {{p}}if_piano_tuning=>c_code-pitch ).
cl_abap_unit_assert=>assert_equals( exp = 'DISTANCE' act = {{p}}if_piano_tuning=>c_code-distance ).
cl_abap_unit_assert=>assert_equals( exp = 'COUNT' act = {{p}}if_piano_tuning=>c_code-too_many ).
ENDMETHOD.
METHOD number_values.
cl_abap_unit_assert=>assert_equals( exp = 25 act = {{p}}if_piano_tuning=>c_max_pitch ).
cl_abap_unit_assert=>assert_equals( exp = 60 act = {{p}}if_piano_tuning=>c_max_distance ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = {{p}}if_piano_tuning=>c_max_pianos ).
ENDMETHOD.
METHOD type_lengths.
DATA lv_code TYPE {{p}}if_piano_tuning=>ty_code.
DATA lv_model TYPE {{p}}if_piano_tuning=>ty_model.
DATA lv_visit_id TYPE {{p}}if_piano_tuning=>ty_visit_id.
cl_abap_unit_assert=>assert_equals(
exp = 10
act = cl_abap_typedescr=>describe_by_data( lv_code )->length ).
cl_abap_unit_assert=>assert_equals(
exp = 4
act = cl_abap_typedescr=>describe_by_data( lv_model )->length ).
cl_abap_unit_assert=>assert_equals(
exp = 8
act = cl_abap_typedescr=>describe_by_data( lv_visit_id )->length ).
ENDMETHOD.
METHOD visit_structure.
DATA ls_visit TYPE {{p}}if_piano_tuning=>ty_visit.
DATA lt_visits TYPE {{p}}if_piano_tuning=>tt_visits.
ls_visit-visit_id = 'V-000010'.
ls_visit-model = 'UPRI'.
ls_visit-pitch_dev = 12.
ls_visit-distance_km = 30.
ls_visit-piano_count = 2.
INSERT ls_visit INTO TABLE lt_visits.
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_visits ) ).
ENDMETHOD.
METHOD methods_are_callable.
DATA ls_visit TYPE {{p}}if_piano_tuning=>ty_visit.
DATA lt_visits TYPE {{p}}if_piano_tuning=>tt_visits.
DATA ls_summary TYPE {{p}}if_piano_tuning=>ty_summary.
DATA lv_count TYPE i.
DATA lv_code TYPE {{p}}if_piano_tuning=>ty_code.
DATA lv_model TYPE {{p}}if_piano_tuning=>ty_model.
lv_model = 'UPRI'.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_piano_tuning=>c_code-ok
act = mo_cut->check_visit( ls_visit ) ).
cl_abap_unit_assert=>assert_equals(
exp = {{p}}if_piano_tuning=>c_code-ok
act = mo_cut->check_visits( lt_visits ) ).
ls_summary = mo_cut->summarise( lt_visits ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = ls_summary-accepted ).
mo_cut->count_blocked(
EXPORTING it_visits = lt_visits
IMPORTING ev_count = lv_count
ev_code = lv_code ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_count ).
cl_abap_unit_assert=>assert_equals(
exp = abap_true
act = mo_cut->is_tuning_model( lv_model ) ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,65 @@
# 1. Goal
A mobile piano tuning service visits its customers at home. The booking desk and
the technician app must use the same contract when they check a tuning visit.
The contract is one interface. It fixes the result codes, the visit structure
and the check methods that both consumers use.
# 2. Open questions
None.
# 3. Context
- Package $TMP.
- The interface {{P}}IF_PIANO_TUNING does not exist yet. Create it.
- The booking desk checks one visit with CHECK_VISIT. The technician app checks a
whole round with CHECK_VISITS. The month report calls SUMMARISE and
COUNT_BLOCKED for a round. The appointment form calls IS_TUNING_MODEL.
- A result code tells the consumer why a visit is not planned: NO_VISIT for a
missing visit id, MODEL for a piano model that the service does not tune,
PITCH for a pitch deviation outside the tolerance, DISTANCE for a distance
above the maximum, and COUNT for a number of pianos above the maximum.
# 4. Contract
- Create the interface {{P}}IF_PIANO_TUNING in package $TMP.
- Public types: TY_CODE, TY_MODEL, TY_VISIT_ID, TY_VISIT, TT_VISITS, TY_SUMMARY.
- Public constants: C_CODE, C_MAX_PITCH, C_MAX_DISTANCE, C_MAX_PIANOS.
- Public methods: CHECK_VISIT, CHECK_VISITS, SUMMARISE, COUNT_BLOCKED,
IS_TUNING_MODEL.
- Do not add other public components.
# 5. Business rules
1. TY_CODE is a character type of length 10.
2. TY_MODEL is a character type of length 4.
3. TY_VISIT_ID is a character type of length 8.
4. TY_VISIT is a structure type with exactly these components, in this order:
VISIT_ID (type ty_visit_id), MODEL (type ty_model), PITCH_DEV (type i, the
deviation from concert pitch in cents), DISTANCE_KM (type i, the distance
from the depot in kilometres), PIANO_COUNT (type i).
5. TT_VISITS is a table type with the line type TY_VISIT.
6. TY_SUMMARY is a structure type with exactly these components, in this order:
ACCEPTED (type i), REJECTED (type i), FIRST_CODE (type ty_code).
7. C_CODE is a constant structure with exactly these components, all of type
ty_code: OK = 'OK', NO_VISIT = 'NO_VISIT', MODEL = 'MODEL', PITCH = 'PITCH',
DISTANCE = 'DISTANCE', TOO_MANY = 'COUNT'.
8. C_MAX_PITCH is a constant of type i with the value 25.
9. C_MAX_DISTANCE is a constant of type i with the value 60.
10. C_MAX_PIANOS is a constant of type i with the value 3.
11. CHECK_VISIT has the importing parameter IS_VISIT of type ty_visit and the
returning parameter RV_CODE of type ty_code.
12. CHECK_VISITS has the importing parameter IT_VISITS of type tt_visits and the
returning parameter RV_CODE of type ty_code.
13. SUMMARISE has the importing parameter IT_VISITS of type tt_visits and the
returning parameter RS_SUMMARY of type ty_summary.
14. COUNT_BLOCKED has the importing parameter IT_VISITS of type tt_visits and
the exporting parameters EV_COUNT of type i and EV_CODE of type ty_code.
15. IS_TUNING_MODEL has the importing parameter IV_MODEL of type ty_model and
the returning parameter RV_TUNING of type abap_bool.
# 6. Constraints
- Release target: SAP_BASIS 816.
- Coding standards: Clean ABAP. No comment that restates the code.
- Out of scope: do not change other objects in package $TMP.
# 7. Acceptance
- The interface {{P}}IF_PIANO_TUNING is active and has no syntax error.
- The hidden tests pass.
- Write your own ABAP Unit tests for the interface.

View File

@@ -0,0 +1,48 @@
{
"id": "G1953",
"category": "A",
"object_type": "INTF",
"difficulty": 3,
"release_target": "v816",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 60,
"max_activations": 15
},
"seed": [],
"contract": [
{
"type": "INTF",
"name": "{{P}}IF_PIANO_TUNING"
}
],
"out_of_scope": [
"Other objects in package $TMP"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}T44_HIDDEN",
"file": "hidden/t44_hidden.clas.abap",
"description": "T44 hidden tests. The global test class itself implements the interface, so it compiles only when every signature matches. The tests read the constant values, the component names and the type lengths with RTTI."
}
],
"reference": [
{
"type": "INTF",
"name": "{{P}}IF_PIANO_TUNING",
"file": "reference/if_piano_tuning.intf.abap",
"description": "Piano tuning visit contract"
},
{
"type": "CLAS",
"name": "{{P}}PIANO_TUNING_TEST",
"file": "reference/piano_tuning_test.clas.abap",
"description": "Own global test class for the interface contract"
}
],
"craft_checks": [
"naming",
"interface_contract"
]
}