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,33 @@
{
"id": "G1916",
"pool": "train",
"object_type": "INTF",
"category": "A",
"attempts": [
{
"stage": "validate",
"oracle": 0,
"null": 0
},
{
"stage": "bundle",
"errors": [
"hidden/solar_check_hidden.clas.abap line 174: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"DATA\""
],
"by_check": {
"abaplint": 1
}
},
{
"stage": "validate",
"oracle": 0,
"null": 0
},
{
"stage": "validate",
"oracle": 0,
"null": 0
}
],
"accepted": false
}

View File

@@ -0,0 +1,179 @@
CLASS {{p}}solar_check_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PUBLIC SECTION.
INTERFACES {{p}}if_solar_check.
PRIVATE SECTION.
METHODS assert_reason
IMPORTING iv_exp TYPE {{p}}if_solar_check=>ty_reason
iv_act TYPE {{p}}if_solar_check=>ty_reason.
METHODS assert_roof
IMPORTING iv_exp TYPE {{p}}if_solar_check=>ty_roof
iv_act TYPE {{p}}if_solar_check=>ty_roof.
METHODS reason_codes FOR TESTING.
METHODS roof_codes FOR TESTING.
METHODS limit_values FOR TESTING.
METHODS reason_length FOR TESTING.
METHODS roof_length FOR TESTING.
METHODS request_structure FOR TESTING.
METHODS request_table FOR TESTING.
METHODS reason_table FOR TESTING.
METHODS check_via_interface FOR TESTING.
METHODS check_many_via_interface FOR TESTING.
ENDCLASS.
CLASS {{p}}solar_check_hidden IMPLEMENTATION.
METHOD {{p}}if_solar_check~check.
rv_reason = {{p}}if_solar_check=>c_reason-ok.
IF is_request-panel_count < {{p}}if_solar_check=>c_min_panels.
rv_reason = {{p}}if_solar_check=>c_reason-panels.
ENDIF.
ENDMETHOD.
METHOD {{p}}if_solar_check~check_many.
DATA ls_request TYPE {{p}}if_solar_check=>ty_request.
LOOP AT it_request INTO ls_request.
IF ls_request-tilt_angle < 0.
APPEND {{p}}if_solar_check=>c_reason-tilt TO rt_reason.
ELSE.
APPEND {{p}}if_solar_check=>c_reason-ok TO rt_reason.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD assert_reason.
cl_abap_unit_assert=>assert_equals( exp = iv_exp act = iv_act ).
ENDMETHOD.
METHOD assert_roof.
cl_abap_unit_assert=>assert_equals( exp = iv_exp act = iv_act ).
ENDMETHOD.
METHOD reason_codes.
assert_reason( iv_exp = 'OK' iv_act = {{p}}if_solar_check=>c_reason-ok ).
assert_reason( iv_exp = 'EMPTY' iv_act = {{p}}if_solar_check=>c_reason-empty_input ).
assert_reason( iv_exp = 'ROOF' iv_act = {{p}}if_solar_check=>c_reason-roof_type ).
assert_reason( iv_exp = 'SIZE' iv_act = {{p}}if_solar_check=>c_reason-roof_size ).
assert_reason( iv_exp = 'PANELS' iv_act = {{p}}if_solar_check=>c_reason-panels ).
assert_reason( iv_exp = 'TILT' iv_act = {{p}}if_solar_check=>c_reason-tilt ).
assert_reason( iv_exp = 'BATTERY' iv_act = {{p}}if_solar_check=>c_reason-battery ).
ENDMETHOD.
METHOD roof_codes.
assert_roof( iv_exp = 'TILE' iv_act = {{p}}if_solar_check=>c_roof_tile ).
assert_roof( iv_exp = 'SLAT' iv_act = {{p}}if_solar_check=>c_roof_slate ).
assert_roof( iv_exp = 'FLAT' iv_act = {{p}}if_solar_check=>c_roof_flat ).
ENDMETHOD.
METHOD limit_values.
cl_abap_unit_assert=>assert_equals( exp = 4 act = {{p}}if_solar_check=>c_min_panels ).
cl_abap_unit_assert=>assert_equals( exp = 60 act = {{p}}if_solar_check=>c_max_panels ).
cl_abap_unit_assert=>assert_equals( exp = 5 act = {{p}}if_solar_check=>c_min_tilt ).
cl_abap_unit_assert=>assert_equals( exp = 60 act = {{p}}if_solar_check=>c_max_tilt ).
cl_abap_unit_assert=>assert_equals( exp = 20 act = {{p}}if_solar_check=>c_max_battery ).
ENDMETHOD.
METHOD reason_length.
DATA lv_reason TYPE {{p}}if_solar_check=>ty_reason.
DATA(lo_descr) = cl_abap_typedescr=>describe_by_data( lv_reason ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = lo_descr->length ).
cl_abap_unit_assert=>assert_equals( exp = cl_abap_typedescr=>typekind_char
act = lo_descr->type_kind ).
ENDMETHOD.
METHOD roof_length.
DATA lv_roof TYPE {{p}}if_solar_check=>ty_roof.
DATA(lo_descr) = cl_abap_typedescr=>describe_by_data( lv_roof ).
cl_abap_unit_assert=>assert_equals( exp = 4 act = lo_descr->length ).
cl_abap_unit_assert=>assert_equals( exp = cl_abap_typedescr=>typekind_char
act = lo_descr->type_kind ).
ENDMETHOD.
METHOD request_structure.
DATA ls_request TYPE {{p}}if_solar_check=>ty_request.
ls_request = VALUE #( roof_type = {{p}}if_solar_check=>c_roof_tile
roof_size = 80
panel_count = 20
tilt_angle = 30
battery_kwh = 10 ).
DATA(lo_descr) = cl_abap_typedescr=>describe_by_data( ls_request ).
DATA(lo_struct) = CAST cl_abap_structdescr( lo_descr ).
DATA(lt_comp) = lo_struct->get_components( ).
cl_abap_unit_assert=>assert_equals( exp = 5 act = lines( lt_comp ) ).
cl_abap_unit_assert=>assert_equals( exp = 'ROOF_TYPE' act = lt_comp[ 1 ]-name ).
cl_abap_unit_assert=>assert_equals( exp = 'ROOF_SIZE' act = lt_comp[ 2 ]-name ).
cl_abap_unit_assert=>assert_equals( exp = 'PANEL_COUNT' act = lt_comp[ 3 ]-name ).
cl_abap_unit_assert=>assert_equals( exp = 'TILT_ANGLE' act = lt_comp[ 4 ]-name ).
cl_abap_unit_assert=>assert_equals( exp = 'BATTERY_KWH' act = lt_comp[ 5 ]-name ).
cl_abap_unit_assert=>assert_equals( exp = cl_abap_typedescr=>typekind_char
act = lt_comp[ 1 ]-type_kind ).
cl_abap_unit_assert=>assert_equals( exp = 4 act = lt_comp[ 1 ]-length ).
cl_abap_unit_assert=>assert_equals( exp = cl_abap_typedescr=>typekind_int
act = lt_comp[ 2 ]-type_kind ).
cl_abap_unit_assert=>assert_equals( exp = 4 act = lt_comp[ 2 ]-length ).
cl_abap_unit_assert=>assert_equals( exp = cl_abap_typedescr=>typekind_int
act = lt_comp[ 3 ]-type_kind ).
cl_abap_unit_assert=>assert_equals( exp = 4 act = lt_comp[ 3 ]-length ).
cl_abap_unit_assert=>assert_equals( exp = cl_abap_typedescr=>typekind_int
act = lt_comp[ 4 ]-type_kind ).
cl_abap_unit_assert=>assert_equals( exp = 4 act = lt_comp[ 4 ]-length ).
cl_abap_unit_assert=>assert_equals( exp = cl_abap_typedescr=>typekind_int
act = lt_comp[ 5 ]-type_kind ).
cl_abap_unit_assert=>assert_equals( exp = 4 act = lt_comp[ 5 ]-length ).
ENDMETHOD.
METHOD request_table.
DATA lv_kind TYPE c LENGTH 1.
DATA lt_request TYPE {{p}}if_solar_check=>tt_request.
lt_request = VALUE #( ( roof_type = {{p}}if_solar_check=>c_roof_flat
roof_size = 120
panel_count = 30
tilt_angle = 15
battery_kwh = 10 ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_request ) ).
DESCRIBE TABLE lt_request KIND lv_kind.
cl_abap_unit_assert=>assert_equals( exp = 'T' act = lv_kind ).
ENDMETHOD.
METHOD reason_table.
DATA lv_kind TYPE c LENGTH 1.
DATA lt_reason TYPE {{p}}if_solar_check=>tt_reason.
lt_reason = VALUE #( ( {{p}}if_solar_check=>c_reason-ok ) ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_reason ) ).
DESCRIBE TABLE lt_reason KIND lv_kind.
cl_abap_unit_assert=>assert_equals( exp = 'T' act = lv_kind ).
ENDMETHOD.
METHOD check_via_interface.
DATA lo_cut TYPE REF TO {{p}}if_solar_check.
DATA ls_request TYPE {{p}}if_solar_check=>ty_request.
lo_cut = me.
ls_request = VALUE #( roof_type = {{p}}if_solar_check=>c_roof_flat
roof_size = 120
panel_count = 30
tilt_angle = 15
battery_kwh = 10 ).
assert_reason( iv_exp = {{p}}if_solar_check=>c_reason-ok
iv_act = lo_cut->check( ls_request ) ).
ENDMETHOD.
METHOD check_many_via_interface.
DATA lo_cut TYPE REF TO {{p}}if_solar_check.
DATA lt_request TYPE {{p}}if_solar_check=>tt_request.
DATA lt_reason TYPE {{p}}if_solar_check=>tt_reason.
lo_cut = me.
lt_request = VALUE #( ( roof_type = {{p}}if_solar_check=>c_roof_tile
roof_size = 80
panel_count = 20
tilt_angle = 30
battery_kwh = 0 ) ).
lt_reason = lo_cut->check_many( lt_request ).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_reason ) ).
assert_reason( iv_exp = {{p}}if_solar_check=>c_reason-ok
iv_act = lt_reason[ 1 ] ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,41 @@
INTERFACE {{p}}if_solar_check PUBLIC.
TYPES:
ty_reason TYPE c LENGTH 10,
ty_roof TYPE c LENGTH 4,
BEGIN OF ty_request,
roof_type TYPE ty_roof,
roof_size TYPE i,
panel_count TYPE i,
tilt_angle TYPE i,
battery_kwh TYPE i,
END OF ty_request,
tt_request TYPE STANDARD TABLE OF ty_request WITH EMPTY KEY,
tt_reason TYPE STANDARD TABLE OF ty_reason WITH EMPTY KEY.
CONSTANTS:
BEGIN OF c_reason,
ok TYPE ty_reason VALUE 'OK',
empty_input TYPE ty_reason VALUE 'EMPTY',
roof_type TYPE ty_reason VALUE 'ROOF',
roof_size TYPE ty_reason VALUE 'SIZE',
panels TYPE ty_reason VALUE 'PANELS',
tilt TYPE ty_reason VALUE 'TILT',
battery TYPE ty_reason VALUE 'BATTERY',
END OF c_reason,
c_roof_tile TYPE ty_roof VALUE 'TILE',
c_roof_slate TYPE ty_roof VALUE 'SLAT',
c_roof_flat TYPE ty_roof VALUE 'FLAT',
c_min_panels TYPE i VALUE 4,
c_max_panels TYPE i VALUE 60,
c_min_tilt TYPE i VALUE 5,
c_max_tilt TYPE i VALUE 60,
c_max_battery TYPE i VALUE 20.
METHODS check
IMPORTING is_request TYPE ty_request
RETURNING VALUE(rv_reason) TYPE ty_reason.
METHODS check_many
IMPORTING it_request TYPE tt_request
RETURNING VALUE(rt_reason) TYPE tt_reason.
ENDINTERFACE.

View File

@@ -0,0 +1,114 @@
CLASS {{p}}solar_check_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PUBLIC SECTION.
INTERFACES {{p}}if_solar_check.
PRIVATE SECTION.
METHODS assert_reason
IMPORTING iv_exp TYPE {{p}}if_solar_check=>ty_reason
iv_act TYPE {{p}}if_solar_check=>ty_reason.
METHODS assert_roof
IMPORTING iv_exp TYPE {{p}}if_solar_check=>ty_roof
iv_act TYPE {{p}}if_solar_check=>ty_roof.
METHODS reason_codes FOR TESTING.
METHODS roof_codes FOR TESTING.
METHODS limit_values FOR TESTING.
METHODS reason_length FOR TESTING.
METHODS request_structure FOR TESTING.
METHODS check_via_interface FOR TESTING.
ENDCLASS.
CLASS {{p}}solar_check_test IMPLEMENTATION.
METHOD {{p}}if_solar_check~check.
rv_reason = {{p}}if_solar_check=>c_reason-ok.
IF is_request-panel_count < {{p}}if_solar_check=>c_min_panels.
rv_reason = {{p}}if_solar_check=>c_reason-panels.
ENDIF.
ENDMETHOD.
METHOD {{p}}if_solar_check~check_many.
DATA ls_request TYPE {{p}}if_solar_check=>ty_request.
LOOP AT it_request INTO ls_request.
IF ls_request-tilt_angle < 0.
APPEND {{p}}if_solar_check=>c_reason-tilt TO rt_reason.
ELSE.
APPEND {{p}}if_solar_check=>c_reason-ok TO rt_reason.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD assert_reason.
cl_abap_unit_assert=>assert_equals( exp = iv_exp act = iv_act ).
ENDMETHOD.
METHOD assert_roof.
cl_abap_unit_assert=>assert_equals( exp = iv_exp act = iv_act ).
ENDMETHOD.
METHOD reason_codes.
assert_reason( iv_exp = 'OK' iv_act = {{p}}if_solar_check=>c_reason-ok ).
assert_reason( iv_exp = 'EMPTY' iv_act = {{p}}if_solar_check=>c_reason-empty_input ).
assert_reason( iv_exp = 'ROOF' iv_act = {{p}}if_solar_check=>c_reason-roof_type ).
assert_reason( iv_exp = 'SIZE' iv_act = {{p}}if_solar_check=>c_reason-roof_size ).
assert_reason( iv_exp = 'PANELS' iv_act = {{p}}if_solar_check=>c_reason-panels ).
assert_reason( iv_exp = 'TILT' iv_act = {{p}}if_solar_check=>c_reason-tilt ).
assert_reason( iv_exp = 'BATTERY' iv_act = {{p}}if_solar_check=>c_reason-battery ).
ENDMETHOD.
METHOD roof_codes.
assert_roof( iv_exp = 'TILE' iv_act = {{p}}if_solar_check=>c_roof_tile ).
assert_roof( iv_exp = 'SLAT' iv_act = {{p}}if_solar_check=>c_roof_slate ).
assert_roof( iv_exp = 'FLAT' iv_act = {{p}}if_solar_check=>c_roof_flat ).
ENDMETHOD.
METHOD limit_values.
cl_abap_unit_assert=>assert_equals( exp = 4 act = {{p}}if_solar_check=>c_min_panels ).
cl_abap_unit_assert=>assert_equals( exp = 60 act = {{p}}if_solar_check=>c_max_panels ).
cl_abap_unit_assert=>assert_equals( exp = 5 act = {{p}}if_solar_check=>c_min_tilt ).
cl_abap_unit_assert=>assert_equals( exp = 60 act = {{p}}if_solar_check=>c_max_tilt ).
cl_abap_unit_assert=>assert_equals( exp = 20 act = {{p}}if_solar_check=>c_max_battery ).
ENDMETHOD.
METHOD reason_length.
DATA lv_reason TYPE {{p}}if_solar_check=>ty_reason.
DATA(lo_descr) = cl_abap_typedescr=>describe_by_data( lv_reason ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = lo_descr->length ).
cl_abap_unit_assert=>assert_equals( exp = cl_abap_typedescr=>typekind_char
act = lo_descr->type_kind ).
ENDMETHOD.
METHOD request_structure.
DATA ls_request TYPE {{p}}if_solar_check=>ty_request.
ls_request = VALUE #( roof_type = {{p}}if_solar_check=>c_roof_tile
roof_size = 80
panel_count = 20
tilt_angle = 30
battery_kwh = 10 ).
DATA(lo_descr) = cl_abap_typedescr=>describe_by_data( ls_request ).
DATA(lo_struct) = CAST cl_abap_structdescr( lo_descr ).
DATA(lt_comp) = lo_struct->get_components( ).
cl_abap_unit_assert=>assert_equals( exp = 5 act = lines( lt_comp ) ).
cl_abap_unit_assert=>assert_equals( exp = 'ROOF_TYPE' act = lt_comp[ 1 ]-name ).
cl_abap_unit_assert=>assert_equals( exp = 'ROOF_SIZE' act = lt_comp[ 2 ]-name ).
cl_abap_unit_assert=>assert_equals( exp = 'PANEL_COUNT' act = lt_comp[ 3 ]-name ).
cl_abap_unit_assert=>assert_equals( exp = 'TILT_ANGLE' act = lt_comp[ 4 ]-name ).
cl_abap_unit_assert=>assert_equals( exp = 'BATTERY_KWH' act = lt_comp[ 5 ]-name ).
ENDMETHOD.
METHOD check_via_interface.
DATA lo_cut TYPE REF TO {{p}}if_solar_check.
DATA ls_request TYPE {{p}}if_solar_check=>ty_request.
lo_cut = me.
ls_request = VALUE #( roof_type = {{p}}if_solar_check=>c_roof_flat
roof_size = 120
panel_count = 30
tilt_angle = 15
battery_kwh = 10 ).
assert_reason( iv_exp = {{p}}if_solar_check=>c_reason-ok
iv_act = lo_cut->check( ls_request ) ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,87 @@
# 1. Goal
A rooftop solar installer checks a planned photovoltaic system before it sends a
quotation. The quotation program works against one interface. The interface
carries the request type, the reason codes, the limits and the check methods.
# 2. Open questions
None.
# 3. Context
- Package $TMP. The interface does not exist yet.
- The quotation program fills a request, calls the check through the interface
{{P}}IF_SOLAR_CHECK and reads the reason code.
- The interface is the only object of this task.
# 4. Contract
- Create the interface {{P}}IF_SOLAR_CHECK in package $TMP.
- The interface is global and public.
- The interface contains exactly the types, the constants and the methods of
section 5. Do not add other components.
# 5. Business rules
## 5.1 Types
1. TY_REASON is a character type of length 10. It carries one reason code.
2. TY_ROOF is a character type of length 4. It carries one roof type.
3. TY_REQUEST is a structure type with exactly these five components in this
order:
| component | type | meaning |
| ----------- | ------- | ------------------------------ |
| roof_type | ty_roof | the kind of the roof |
| roof_size | i | the roof size in square metres |
| panel_count | i | the number of planned panels |
| tilt_angle | i | the roof pitch in degrees |
| battery_kwh | i | the battery capacity in kWh |
4. TT_REQUEST is a standard table of TY_REQUEST.
5. TT_REASON is a standard table of TY_REASON.
## 5.2 Constants
6. C_REASON is a constant structure. Each component has the type TY_REASON and
this value:
| component | value |
| ----------- | ------- |
| ok | OK |
| empty_input | EMPTY |
| roof_type | ROOF |
| roof_size | SIZE |
| panels | PANELS |
| tilt | TILT |
| battery | BATTERY |
7. C_ROOF_TILE is a constant of type TY_ROOF with the value TILE.
8. C_ROOF_SLATE is a constant of type TY_ROOF with the value SLAT.
9. C_ROOF_FLAT is a constant of type TY_ROOF with the value FLAT.
10. C_MIN_PANELS is a constant of type i with the value 4.
11. C_MAX_PANELS is a constant of type i with the value 60.
12. C_MIN_TILT is a constant of type i with the value 5.
13. C_MAX_TILT is a constant of type i with the value 60.
14. C_MAX_BATTERY is a constant of type i with the value 20.
## 5.3 Methods
15. The method CHECK has the importing parameter IS_REQUEST of the type
TY_REQUEST and the returning parameter RV_REASON of the type TY_REASON.
16. The method CHECK_MANY has the importing parameter IT_REQUEST of the type
TT_REQUEST and the returning parameter RT_REASON of the type TT_REASON.
# 6. Constraints
- Release target: ABAP Platform 2025 (SAP_BASIS 816).
- Coding standards: Clean ABAP. No comment that restates the code.
- Out of scope: do not create a class, a report, a function module or a
database table for this task.
# 7. Acceptance
- The interface {{P}}IF_SOLAR_CHECK is active and has no syntax error.
- The hidden tests pass.
- Write your own ABAP Unit tests for the interface in a global test class.

View File

@@ -0,0 +1,46 @@
{
"id": "G1916",
"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_SOLAR_CHECK"
}
],
"out_of_scope": [],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}SOLAR_CHECK_HIDDEN",
"file": "hidden/solar_check_hidden.clas.abap",
"description": "Hidden tests for the interface {{P}}IF_SOLAR_CHECK"
}
],
"reference": [
{
"type": "INTF",
"name": "{{P}}IF_SOLAR_CHECK",
"file": "reference/if_solar_check.intf.abap",
"description": "Solar check contract"
},
{
"type": "CLAS",
"name": "{{P}}SOLAR_CHECK_TEST",
"file": "reference/solar_check_test.clas.abap",
"description": "Own ABAP Unit tests for the interface"
}
],
"craft_checks": [
"method_length",
"db_operation_in_loop"
]
}