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": "G1956",
"pool": "train",
"object_type": "INTF",
"category": "A",
"attempts": [
{
"stage": "validate",
"oracle": 0,
"null": 0
},
{
"stage": "validate",
"oracle": 71.5,
"null": 0
},
{
"stage": "validate",
"oracle": 77.0,
"null": 0
},
{
"stage": "bundle",
"errors": [
"invalid JSON: Unterminated string starting at: line 1 column 6570 (char 6569)"
],
"by_check": {
"json": 1
}
}
],
"accepted": false
}

View File

@@ -0,0 +1,138 @@
CLASS {{p}}cobbler_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PUBLIC SECTION.
INTERFACES {{p}}if_cobbler.
PRIVATE SECTION.
DATA mo_cut TYPE REF TO {{p}}if_cobbler.
METHODS setup.
METHODS service_codes FOR TESTING.
METHODS reason_codes FOR TESTING.
METHODS rule_values FOR TESTING.
METHODS base_prices FOR TESTING.
METHODS reason_type FOR TESTING.
METHODS service_type FOR TESTING.
METHODS amount_type FOR TESTING.
METHODS order_type FOR TESTING.
METHODS check_call FOR TESTING.
METHODS price_call FOR TESTING.
ENDCLASS.
CLASS {{p}}cobbler_hidden IMPLEMENTATION.
METHOD {{p}}if_cobbler~check.
rv_reason = {{p}}if_cobbler=>c_reason-ok.
ENDMETHOD.
METHOD {{p}}if_cobbler~price.
rv_price = 0.
ENDMETHOD.
METHOD setup.
mo_cut = me.
ENDMETHOD.
METHOD service_codes.
cl_abap_unit_assert=>assert_equals( exp = 'HEEL'
act = {{p}}if_cobbler=>c_service-heel ).
cl_abap_unit_assert=>assert_equals( exp = 'SOLE'
act = {{p}}if_cobbler=>c_service-sole ).
cl_abap_unit_assert=>assert_equals( exp = 'SEAM'
act = {{p}}if_cobbler=>c_service-seam ).
cl_abap_unit_assert=>assert_equals( exp = 'POLI'
act = {{p}}if_cobbler=>c_service-polish ).
ENDMETHOD.
METHOD reason_codes.
cl_abap_unit_assert=>assert_equals( exp = 'OK'
act = {{p}}if_cobbler=>c_reason-ok ).
cl_abap_unit_assert=>assert_equals( exp = 'SERVICE'
act = {{p}}if_cobbler=>c_reason-service ).
cl_abap_unit_assert=>assert_equals( exp = 'PAIRS'
act = {{p}}if_cobbler=>c_reason-pairs ).
ENDMETHOD.
METHOD rule_values.
DATA lv_min_order TYPE {{p}}if_cobbler=>ty_amount.
lv_min_order = '8.00'.
cl_abap_unit_assert=>assert_equals( exp = 12
act = {{p}}if_cobbler=>c_rule-max_pairs ).
cl_abap_unit_assert=>assert_equals( exp = 40
act = {{p}}if_cobbler=>c_rule-express_percent ).
cl_abap_unit_assert=>assert_equals( exp = 10
act = {{p}}if_cobbler=>c_rule-member_percent ).
cl_abap_unit_assert=>assert_equals( exp = lv_min_order
act = {{p}}if_cobbler=>c_rule-min_order ).
ENDMETHOD.
METHOD base_prices.
DATA lv_exp TYPE {{p}}if_cobbler=>ty_amount.
lv_exp = '12.50'.
cl_abap_unit_assert=>assert_equals( exp = lv_exp
act = {{p}}if_cobbler=>c_base_price-heel ).
lv_exp = '25.00'.
cl_abap_unit_assert=>assert_equals( exp = lv_exp
act = {{p}}if_cobbler=>c_base_price-sole ).
lv_exp = '8.00'.
cl_abap_unit_assert=>assert_equals( exp = lv_exp
act = {{p}}if_cobbler=>c_base_price-seam ).
lv_exp = '6.50'.
cl_abap_unit_assert=>assert_equals( exp = lv_exp
act = {{p}}if_cobbler=>c_base_price-polish ).
ENDMETHOD.
METHOD reason_type.
DATA(lo_elem) = CAST cl_abap_elemdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}IF_COBBLER=>TY_REASON' ) ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = lo_elem->length ).
ENDMETHOD.
METHOD service_type.
DATA(lo_elem) = CAST cl_abap_elemdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}IF_COBBLER=>TY_SERVICE' ) ).
cl_abap_unit_assert=>assert_equals( exp = 4 act = lo_elem->length ).
ENDMETHOD.
METHOD amount_type.
DATA(lo_elem) = CAST cl_abap_elemdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}IF_COBBLER=>TY_AMOUNT' ) ).
cl_abap_unit_assert=>assert_equals( exp = 8 act = lo_elem->length ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lo_elem->decimals ).
ENDMETHOD.
METHOD order_type.
DATA(lo_struct) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}IF_COBBLER=>TY_ORDER' ) ).
DATA(lt_component) = lo_struct->get_components( ).
cl_abap_unit_assert=>assert_equals( exp = 4 act = lines( lt_component ) ).
cl_abap_unit_assert=>assert_equals( exp = 'SERVICE' act = lt_component[ 1 ]-name ).
cl_abap_unit_assert=>assert_equals( exp = 'PAIRS' act = lt_component[ 2 ]-name ).
cl_abap_unit_assert=>assert_equals( exp = 'EXPRESS' act = lt_component[ 3 ]-name ).
cl_abap_unit_assert=>assert_equals( exp = 'MEMBER' act = lt_component[ 4 ]-name ).
ENDMETHOD.
METHOD check_call.
DATA ls_order TYPE {{p}}if_cobbler=>ty_order.
ls_order-service = {{p}}if_cobbler=>c_service-heel.
ls_order-pairs = 2.
ls_order-express = abap_true.
ls_order-member = abap_false.
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_cobbler=>c_reason-ok
act = mo_cut->check( ls_order ) ).
ENDMETHOD.
METHOD price_call.
DATA ls_order TYPE {{p}}if_cobbler=>ty_order.
DATA lv_price TYPE {{p}}if_cobbler=>ty_amount.
DATA lv_zero TYPE {{p}}if_cobbler=>ty_amount.
ls_order-service = {{p}}if_cobbler=>c_service-polish.
ls_order-pairs = 1.
ls_order-express = abap_false.
ls_order-member = abap_false.
lv_price = mo_cut->price( ls_order ).
cl_abap_unit_assert=>assert_equals( exp = lv_zero act = lv_price ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,130 @@
CLASS {{p}}cobbler_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PUBLIC SECTION.
INTERFACES {{p}}if_cobbler.
PRIVATE SECTION.
DATA mo_cut TYPE REF TO {{p}}if_cobbler.
METHODS setup.
METHODS service_constants FOR TESTING.
METHODS reason_constants FOR TESTING.
METHODS rule_constants FOR TESTING.
METHODS price_constants FOR TESTING.
METHODS type_lengths FOR TESTING.
METHODS order_components FOR TESTING.
METHODS check_call FOR TESTING.
METHODS price_call FOR TESTING.
ENDCLASS.
CLASS {{p}}cobbler_test IMPLEMENTATION.
METHOD {{p}}if_cobbler~check.
rv_reason = {{p}}if_cobbler=>c_reason-ok.
ENDMETHOD.
METHOD {{p}}if_cobbler~price.
rv_price = 0.
ENDMETHOD.
METHOD setup.
mo_cut = me.
ENDMETHOD.
METHOD service_constants.
cl_abap_unit_assert=>assert_equals( exp = 'HEEL'
act = {{p}}if_cobbler=>c_service-heel ).
cl_abap_unit_assert=>assert_equals( exp = 'SOLE'
act = {{p}}if_cobbler=>c_service-sole ).
cl_abap_unit_assert=>assert_equals( exp = 'SEAM'
act = {{p}}if_cobbler=>c_service-seam ).
cl_abap_unit_assert=>assert_equals( exp = 'POLI'
act = {{p}}if_cobbler=>c_service-polish ).
ENDMETHOD.
METHOD reason_constants.
cl_abap_unit_assert=>assert_equals( exp = 'OK'
act = {{p}}if_cobbler=>c_reason-ok ).
cl_abap_unit_assert=>assert_equals( exp = 'SERVICE'
act = {{p}}if_cobbler=>c_reason-service ).
cl_abap_unit_assert=>assert_equals( exp = 'PAIRS'
act = {{p}}if_cobbler=>c_reason-pairs ).
ENDMETHOD.
METHOD rule_constants.
DATA lv_min_order TYPE {{p}}if_cobbler=>ty_amount.
lv_min_order = '8.00'.
cl_abap_unit_assert=>assert_equals( exp = 12
act = {{p}}if_cobbler=>c_rule-max_pairs ).
cl_abap_unit_assert=>assert_equals( exp = 40
act = {{p}}if_cobbler=>c_rule-express_percent ).
cl_abap_unit_assert=>assert_equals( exp = 10
act = {{p}}if_cobbler=>c_rule-member_percent ).
cl_abap_unit_assert=>assert_equals( exp = lv_min_order
act = {{p}}if_cobbler=>c_rule-min_order ).
ENDMETHOD.
METHOD price_constants.
DATA lv_exp TYPE {{p}}if_cobbler=>ty_amount.
lv_exp = '12.50'.
cl_abap_unit_assert=>assert_equals( exp = lv_exp
act = {{p}}if_cobbler=>c_base_price-heel ).
lv_exp = '25.00'.
cl_abap_unit_assert=>assert_equals( exp = lv_exp
act = {{p}}if_cobbler=>c_base_price-sole ).
lv_exp = '8.00'.
cl_abap_unit_assert=>assert_equals( exp = lv_exp
act = {{p}}if_cobbler=>c_base_price-seam ).
lv_exp = '6.50'.
cl_abap_unit_assert=>assert_equals( exp = lv_exp
act = {{p}}if_cobbler=>c_base_price-polish ).
ENDMETHOD.
METHOD type_lengths.
DATA(lo_reason) = CAST cl_abap_elemdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}IF_COBBLER=>TY_REASON' ) ).
DATA(lo_service) = CAST cl_abap_elemdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}IF_COBBLER=>TY_SERVICE' ) ).
DATA(lo_amount) = CAST cl_abap_elemdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}IF_COBBLER=>TY_AMOUNT' ) ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = lo_reason->length ).
cl_abap_unit_assert=>assert_equals( exp = 4 act = lo_service->length ).
cl_abap_unit_assert=>assert_equals( exp = 8 act = lo_amount->length ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lo_amount->decimals ).
ENDMETHOD.
METHOD order_components.
DATA(lo_struct) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( '{{P}}IF_COBBLER=>TY_ORDER' ) ).
DATA(lt_component) = lo_struct->get_components( ).
cl_abap_unit_assert=>assert_equals( exp = 4 act = lines( lt_component ) ).
cl_abap_unit_assert=>assert_equals( exp = 'SERVICE' act = lt_component[ 1 ]-name ).
cl_abap_unit_assert=>assert_equals( exp = 'PAIRS' act = lt_component[ 2 ]-name ).
cl_abap_unit_assert=>assert_equals( exp = 'EXPRESS' act = lt_component[ 3 ]-name ).
cl_abap_unit_assert=>assert_equals( exp = 'MEMBER' act = lt_component[ 4 ]-name ).
ENDMETHOD.
METHOD check_call.
DATA ls_order TYPE {{p}}if_cobbler=>ty_order.
ls_order-service = {{p}}if_cobbler=>c_service-seam.
ls_order-pairs = 3.
ls_order-express = abap_false.
ls_order-member = abap_true.
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_cobbler=>c_reason-ok
act = mo_cut->check( ls_order ) ).
ENDMETHOD.
METHOD price_call.
DATA ls_order TYPE {{p}}if_cobbler=>ty_order.
DATA lv_price TYPE {{p}}if_cobbler=>ty_amount.
DATA lv_zero TYPE {{p}}if_cobbler=>ty_amount.
ls_order-service = {{p}}if_cobbler=>c_service-sole.
ls_order-pairs = 1.
ls_order-express = abap_true.
ls_order-member = abap_false.
lv_price = mo_cut->price( ls_order ).
cl_abap_unit_assert=>assert_equals( exp = lv_zero act = lv_price ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,52 @@
INTERFACE {{p}}if_cobbler PUBLIC.
TYPES ty_reason TYPE c LENGTH 10.
TYPES ty_service TYPE c LENGTH 4.
TYPES ty_amount TYPE p LENGTH 8 DECIMALS 2.
TYPES:
BEGIN OF ty_order,
service TYPE ty_service,
pairs TYPE i,
express TYPE abap_bool,
member TYPE abap_bool,
END OF ty_order.
CONSTANTS:
BEGIN OF c_service,
heel TYPE ty_service VALUE 'HEEL',
sole TYPE ty_service VALUE 'SOLE',
seam TYPE ty_service VALUE 'SEAM',
polish TYPE ty_service VALUE 'POLI',
END OF c_service.
CONSTANTS:
BEGIN OF c_reason,
ok TYPE ty_reason VALUE 'OK',
service TYPE ty_reason VALUE 'SERVICE',
pairs TYPE ty_reason VALUE 'PAIRS',
END OF c_reason.
CONSTANTS:
BEGIN OF c_rule,
max_pairs TYPE i VALUE 12,
express_percent TYPE i VALUE 40,
member_percent TYPE i VALUE 10,
min_order TYPE ty_amount VALUE '8.00',
END OF c_rule.
CONSTANTS:
BEGIN OF c_base_price,
heel TYPE ty_amount VALUE '12.50',
sole TYPE ty_amount VALUE '25.00',
seam TYPE ty_amount VALUE '8.00',
polish TYPE ty_amount VALUE '6.50',
END OF c_base_price.
METHODS check
IMPORTING is_order TYPE ty_order
RETURNING VALUE(rv_reason) TYPE ty_reason.
METHODS price
IMPORTING is_order TYPE ty_order
RETURNING VALUE(rv_price) TYPE ty_amount.
ENDINTERFACE.

View File

@@ -0,0 +1,76 @@
# 1. Goal
Define the interface {{P}}IF_COBBLER in package $TMP. A cobbler's workshop
repairs shoes. The order desk takes the repair orders and the pricing engine
prices them. The interface is the contract between the order desk and the
pricing engine. The interface carries the service codes, the reason codes,
the price parameters and the two methods CHECK and PRICE.
# 2. Open questions
None.
# 3. Context
- The interface {{P}}IF_COBBLER does not exist yet. Create it in package $TMP.
- One repair order covers one service and one number of pairs of shoes.
- The method CHECK tells the order desk whether an order can be priced. It
returns C_REASON-SERVICE if the service of the order is not one of the four
codes of C_SERVICE. It returns C_REASON-PAIRS if the number of pairs is less
than 1 or greater than C_RULE-MAX_PAIRS. Else it returns C_REASON-OK.
- The method PRICE calculates the price of an order in euro. It multiplies the
base price of the service with the number of pairs, adds
C_RULE-EXPRESS_PERCENT percent if EXPRESS is true, subtracts
C_RULE-MEMBER_PERCENT percent if MEMBER is true, rounds the result to full
10 cents (5 cents round up) and never returns less than C_RULE-MIN_ORDER.
- The workshop keeps the service codes and the price parameters in the
interface, so that the order desk and the pricing engine use the same values.
- The pricing engine that implements the interface is not part of this task.
- No database table, no CDS view, no function module and no report is needed.
# 4. Contract
- Create the interface {{P}}IF_COBBLER in package $TMP.
- The interface is public.
- The interface has the types, the constants and the methods of section 5 and
nothing else.
# 5. Business rules
1. The interface has exactly two methods: CHECK and PRICE.
2. TY_REASON is a text field of length 10.
3. TY_SERVICE is a text field of length 4.
4. TY_AMOUNT is a packed number of length 8 with 2 decimal places.
5. TY_ORDER is a structure with exactly four components in this order: SERVICE
of type TY_SERVICE, PAIRS of type i, EXPRESS of type abap_bool and MEMBER
of type abap_bool.
6. C_SERVICE holds the four service codes of the workshop. The components, the
types and the values are: HEEL of type TY_SERVICE = 'HEEL' (heel
replacement), SOLE of type TY_SERVICE = 'SOLE' (full sole), SEAM of type
TY_SERVICE = 'SEAM' (seam repair) and POLISH of type TY_SERVICE = 'POLI'
(clean and polish).
7. C_REASON holds the three reason codes of the check. The components, the
types and the values are: OK of type TY_REASON = 'OK', SERVICE of type
TY_REASON = 'SERVICE' and PAIRS of type TY_REASON = 'PAIRS'.
8. C_RULE holds the price parameters. The components, the types and the values
are: MAX_PAIRS of type i = 12, EXPRESS_PERCENT of type i = 40,
MEMBER_PERCENT of type i = 10 and MIN_ORDER of type TY_AMOUNT = 8.00.
9. C_BASE_PRICE holds the price of one pair of shoes for each service. The
components, the types and the values are: HEEL of type TY_AMOUNT = 12.50,
SOLE of type TY_AMOUNT = 25.00, SEAM of type TY_AMOUNT = 8.00 and POLISH of
type TY_AMOUNT = 6.50.
10. The method CHECK has the importing parameter IS_ORDER of type TY_ORDER and
the returning parameter RV_REASON of type TY_REASON.
11. The method PRICE has the importing parameter IS_ORDER of type TY_ORDER and
the returning parameter RV_PRICE of type TY_AMOUNT.
# 6. Constraints
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
- Coding standards: Clean ABAP. Names as in section 5. No obsolete syntax.
- Out of scope: a class that implements the interface, a database table, a CDS
view, a function module and a report.
# 7. Acceptance
- The interface is active and has no syntax error.
- The interface has exactly the types, the constants and the methods of
section 5.
- Write your own ABAP Unit tests in the global test class {{P}}COBBLER_TEST in
package $TMP. The class is public, final and it is a test class
(FOR TESTING DURATION SHORT RISK LEVEL HARMLESS). Test the constants, the
type lengths and the method signatures of {{P}}IF_COBBLER.
- The hidden tests pass.

View File

@@ -0,0 +1,43 @@
{
"id": "G1956",
"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_COBBLER"
}
],
"out_of_scope": [],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}COBBLER_HIDDEN",
"file": "hidden/cobbler_hidden.clas.abap",
"description": "Contract tests for {{P}}IF_COBBLER"
}
],
"reference": [
{
"type": "INTF",
"name": "{{P}}IF_COBBLER",
"file": "reference/if_cobbler.intf.abap",
"description": "Pricing contract of the cobbler workshop"
},
{
"type": "CLAS",
"name": "{{P}}COBBLER_TEST",
"file": "reference/cobbler_test.clas.abap",
"description": "Own tests for the interface"
}
],
"craft_checks": []
}