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,19 @@
{
"id": "G1945",
"pool": "train",
"object_type": "MSAG",
"category": "D",
"attempts": [
{
"stage": "validate",
"oracle": 100.0,
"null": 0,
"mutation": {
"valid": 4,
"killed": 4,
"ok": true
}
}
],
"accepted": true
}

View File

@@ -0,0 +1,111 @@
CLASS {{p}}t21_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS strip_period
IMPORTING iv_text TYPE string
RETURNING VALUE(rv_text) TYPE string.
METHODS blocked_order FOR TESTING.
METHODS part_not_in_stock FOR TESTING.
METHODS invalid_quantity FOR TESTING.
METHODS load_limit_warning FOR TESTING.
METHODS released_info FOR TESTING.
METHODS exception_text FOR TESTING.
METHODS exception_attributes FOR TESTING.
METHODS exception_is_static_check FOR TESTING.
ENDCLASS.
CLASS {{p}}t21_hidden IMPLEMENTATION.
METHOD strip_period.
rv_text = iv_text.
DATA(lv_len) = strlen( rv_text ).
IF lv_len > 1.
DATA(lv_last) = substring( val = rv_text off = lv_len - 1 len = 1 ).
IF lv_last = '.'.
rv_text = substring( val = rv_text len = lv_len - 1 ).
ENDIF.
ENDIF.
ENDMETHOD.
METHOD blocked_order.
DATA lv_p1 TYPE string VALUE 'SO-4711'.
DATA lv_p2 TYPE string VALUE 'Permit missing'.
DATA lv_text TYPE string.
MESSAGE ID '{{P}}SCAF_MSG' TYPE 'E' NUMBER '001'
WITH lv_p1 lv_p2 INTO lv_text.
cl_abap_unit_assert=>assert_equals(
exp = 'Scaffolding order SO-4711 is blocked: Permit missing'
act = strip_period( lv_text ) ).
ENDMETHOD.
METHOD part_not_in_stock.
DATA lv_p1 TYPE string VALUE 'STD-200'.
DATA lv_text TYPE string.
MESSAGE ID '{{P}}SCAF_MSG' TYPE 'E' NUMBER '002'
WITH lv_p1 INTO lv_text.
cl_abap_unit_assert=>assert_equals(
exp = 'Scaffold part STD-200 is not in stock'
act = strip_period( lv_text ) ).
ENDMETHOD.
METHOD invalid_quantity.
DATA lv_p1 TYPE string VALUE '0'.
DATA lv_p2 TYPE string VALUE 'STD-200'.
DATA lv_text TYPE string.
MESSAGE ID '{{P}}SCAF_MSG' TYPE 'E' NUMBER '003'
WITH lv_p1 lv_p2 INTO lv_text.
cl_abap_unit_assert=>assert_equals(
exp = 'Quantity 0 is not valid for part STD-200'
act = strip_period( lv_text ) ).
ENDMETHOD.
METHOD load_limit_warning.
DATA lv_p1 TYPE string VALUE 'SO-4712'.
DATA lv_p2 TYPE string VALUE '750'.
DATA lv_text TYPE string.
MESSAGE ID '{{P}}SCAF_MSG' TYPE 'W' NUMBER '004'
WITH lv_p1 lv_p2 INTO lv_text.
cl_abap_unit_assert=>assert_equals(
exp = 'Order SO-4712 exceeds the load limit of 750 kg'
act = strip_period( lv_text ) ).
ENDMETHOD.
METHOD released_info.
DATA lv_p1 TYPE string VALUE 'SO-4713'.
DATA lv_p2 TYPE string VALUE 'North Gate'.
DATA lv_text TYPE string.
MESSAGE ID '{{P}}SCAF_MSG' TYPE 'I' NUMBER '005'
WITH lv_p1 lv_p2 INTO lv_text.
cl_abap_unit_assert=>assert_equals(
exp = 'Order SO-4713 was released for site North Gate'
act = strip_period( lv_text ) ).
ENDMETHOD.
METHOD exception_text.
DATA(lo_exception) = NEW {{p}}cx_scaf_order(
iv_order_id = 'SO-4711'
iv_reason = 'Permit missing' ).
cl_abap_unit_assert=>assert_equals(
exp = 'Scaffolding order SO-4711 is blocked: Permit missing'
act = strip_period( lo_exception->get_message( ) ) ).
ENDMETHOD.
METHOD exception_attributes.
DATA(lo_exception) = NEW {{p}}cx_scaf_order(
iv_order_id = 'SO-99'
iv_reason = 'Late delivery' ).
cl_abap_unit_assert=>assert_equals( exp = 'SO-99' act = lo_exception->order_id ).
cl_abap_unit_assert=>assert_equals( exp = 'Late delivery' act = lo_exception->reason ).
ENDMETHOD.
METHOD exception_is_static_check.
DATA(lo_exception) = NEW {{p}}cx_scaf_order(
iv_order_id = 'SO-1'
iv_reason = 'Test' ).
DATA lv_is_static TYPE abap_bool.
IF lo_exception IS INSTANCE OF cx_static_check.
lv_is_static = abap_true.
ENDIF.
cl_abap_unit_assert=>assert_equals( exp = abap_true act = lv_is_static ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,52 @@
{
"task": "G1945",
"mutants": [
{
"object": "{{P}}SCAF_MSG",
"mutant": "message 003: text + ' x' (text)",
"status": "killed",
"hidden": "7/8",
"failed_tests": [
"INVALID_QUANTITY"
]
},
{
"object": "{{P}}SCAF_MSG",
"mutant": "message 004: number + 50 (number)",
"status": "invalid",
"hidden": "0/0",
"failed_tests": []
},
{
"object": "{{P}}SCAF_MSG",
"mutant": "message 003: &1 -> &2 (placeholder)",
"status": "killed",
"hidden": "7/8",
"failed_tests": [
"INVALID_QUANTITY"
]
},
{
"object": "{{P}}SCAF_MSG",
"mutant": "message 005: &1 -> &2 (placeholder)",
"status": "killed",
"hidden": "7/8",
"failed_tests": [
"RELEASED_INFO"
]
},
{
"object": "{{P}}SCAF_MSG",
"mutant": "message 002: text + ' x' (text)",
"status": "killed",
"hidden": "7/8",
"failed_tests": [
"PART_NOT_IN_STOCK"
]
}
],
"valid": 4,
"killed": 4,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,33 @@
CLASS {{p}}cx_scaf_order DEFINITION
PUBLIC
INHERITING FROM cx_static_check
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
DATA order_id TYPE string READ-ONLY.
DATA reason TYPE string READ-ONLY.
METHODS constructor
IMPORTING
iv_order_id TYPE string
iv_reason TYPE string.
METHODS get_message
RETURNING
VALUE(rv_message) TYPE string.
ENDCLASS.
CLASS {{p}}cx_scaf_order IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
order_id = iv_order_id.
reason = iv_reason.
ENDMETHOD.
METHOD get_message.
MESSAGE ID '{{P}}SCAF_MSG' TYPE 'E' NUMBER '001'
WITH order_id reason INTO rv_message.
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,87 @@
CLASS {{p}}t21_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS strip_period
IMPORTING iv_text TYPE string
RETURNING VALUE(rv_text) TYPE string.
METHODS blocked_message FOR TESTING.
METHODS stock_message FOR TESTING.
METHODS warning_message FOR TESTING.
METHODS info_message FOR TESTING.
METHODS exception_message FOR TESTING.
METHODS exception_attributes FOR TESTING.
ENDCLASS.
CLASS {{p}}t21_test IMPLEMENTATION.
METHOD strip_period.
rv_text = iv_text.
DATA(lv_len) = strlen( rv_text ).
IF lv_len > 1.
DATA(lv_last) = substring( val = rv_text off = lv_len - 1 len = 1 ).
IF lv_last = '.'.
rv_text = substring( val = rv_text len = lv_len - 1 ).
ENDIF.
ENDIF.
ENDMETHOD.
METHOD blocked_message.
DATA lv_order TYPE string VALUE 'SO-100'.
DATA lv_reason TYPE string VALUE 'Missing permit'.
DATA lv_text TYPE string.
MESSAGE ID '{{P}}SCAF_MSG' TYPE 'E' NUMBER '001'
WITH lv_order lv_reason INTO lv_text.
cl_abap_unit_assert=>assert_equals(
exp = 'Scaffolding order SO-100 is blocked: Missing permit'
act = strip_period( lv_text ) ).
ENDMETHOD.
METHOD stock_message.
DATA lv_part TYPE string VALUE 'STD-300'.
DATA lv_text TYPE string.
MESSAGE ID '{{P}}SCAF_MSG' TYPE 'E' NUMBER '002'
WITH lv_part INTO lv_text.
cl_abap_unit_assert=>assert_equals(
exp = 'Scaffold part STD-300 is not in stock'
act = strip_period( lv_text ) ).
ENDMETHOD.
METHOD warning_message.
DATA lv_order TYPE string VALUE 'SO-101'.
DATA lv_limit TYPE string VALUE '900'.
DATA lv_text TYPE string.
MESSAGE ID '{{P}}SCAF_MSG' TYPE 'W' NUMBER '004'
WITH lv_order lv_limit INTO lv_text.
cl_abap_unit_assert=>assert_equals(
exp = 'Order SO-101 exceeds the load limit of 900 kg'
act = strip_period( lv_text ) ).
ENDMETHOD.
METHOD info_message.
DATA lv_order TYPE string VALUE 'SO-102'.
DATA lv_site TYPE string VALUE 'South Gate'.
DATA lv_text TYPE string.
MESSAGE ID '{{P}}SCAF_MSG' TYPE 'I' NUMBER '005'
WITH lv_order lv_site INTO lv_text.
cl_abap_unit_assert=>assert_equals(
exp = 'Order SO-102 was released for site South Gate'
act = strip_period( lv_text ) ).
ENDMETHOD.
METHOD exception_message.
DATA(lo_exception) = NEW {{p}}cx_scaf_order(
iv_order_id = 'SO-100'
iv_reason = 'Missing permit' ).
cl_abap_unit_assert=>assert_equals(
exp = 'Scaffolding order SO-100 is blocked: Missing permit'
act = strip_period( lo_exception->get_message( ) ) ).
ENDMETHOD.
METHOD exception_attributes.
DATA(lo_exception) = NEW {{p}}cx_scaf_order(
iv_order_id = 'SO-100'
iv_reason = 'Missing permit' ).
cl_abap_unit_assert=>assert_equals( exp = 'SO-100' act = lo_exception->order_id ).
cl_abap_unit_assert=>assert_equals( exp = 'Missing permit' act = lo_exception->reason ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,51 @@
# 1. Goal
A scaffolding hire company checks a scaffolding order before the yard loads
the material onto the lorry. The dispatch office must give the customer a
clear reason when it blocks an order. Create the message class that holds
these reasons and the class-based exception that carries the reason of a
blocked order.
# 2. Open questions
None.
# 3. Context
- Package $TMP.
- The dispatch program of the scaffolding hire company stops an order with the
class-based exception {{P}}CX_SCAF_ORDER.
- The company has no message class yet.
# 4. Contract
## Message class {{P}}SCAF_MSG
Create the message class {{P}}SCAF_MSG in package $TMP. It contains the
messages 001 to 005. The business rules give the exact text and the use of
each message.
## Class {{P}}CX_SCAF_ORDER
Create the class {{P}}CX_SCAF_ORDER in package $TMP.
- The class is public and final. It inherits from CX_STATIC_CHECK.
- Public read-only attributes ORDER_ID and REASON, both of type string.
- Constructor: IMPORTING iv_order_id TYPE string, iv_reason TYPE string.
- Method GET_MESSAGE: RETURNING VALUE(rv_message) TYPE string.
# 5. Business rules
1. Message 001 is an error message. Text: "Scaffolding order &1 is blocked: &2". &1 is the order id. &2 is the reason.
2. Message 002 is an error message. Text: "Scaffold part &1 is not in stock". &1 is the part number.
3. Message 003 is an error message. Text: "Quantity &1 is not valid for part &2". &1 is the quantity. &2 is the part number.
4. Message 004 is a warning message. Text: "Order &1 exceeds the load limit of &2 kg". &1 is the order id. &2 is the load limit in kilograms.
5. Message 005 is an information message. Text: "Order &1 was released for site &2". &1 is the order id. &2 is the site.
6. The constructor of {{P}}CX_SCAF_ORDER stores the order id in ORDER_ID and the reason in REASON.
7. GET_MESSAGE returns message 001 with &1 = ORDER_ID and &2 = REASON.
8. {{P}}CX_SCAF_ORDER is a static check exception. The caller must handle it.
# 6. Constraints
- Release target: SAP_BASIS 816 (SAP ABAP Platform 2025).
- Coding standards: Clean ABAP. A method has fewer than 40 statements.
- Out of scope: no other message class and no other exception class.
# 7. Acceptance
- The message class {{P}}SCAF_MSG is active and contains messages 001 to 005
with the exact texts of the business rules.
- The class {{P}}CX_SCAF_ORDER is active and has no syntax error.
- The hidden tests pass.
- Write ABAP Unit tests for the message class and for the exception class in
a global test class.

View File

@@ -0,0 +1,93 @@
{
"id": "G1945",
"category": "D",
"object_type": "MSAG",
"difficulty": 2,
"release_target": "v816",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 60,
"max_activations": 15
},
"seed": [],
"contract": [
{
"type": "MSAG",
"name": "{{P}}SCAF_MSG",
"messages": [
{
"msgno": "001"
},
{
"msgno": "002"
},
{
"msgno": "003"
},
{
"msgno": "004"
},
{
"msgno": "005"
}
]
},
{
"type": "CLAS",
"name": "{{P}}CX_SCAF_ORDER"
}
],
"out_of_scope": [],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}T21_HIDDEN",
"file": "hidden/t21_hidden.clas.abap",
"description": "Hidden tests for the message class {{P}}SCAF_MSG and the exception class {{P}}CX_SCAF_ORDER"
}
],
"reference": [
{
"type": "MSAG",
"name": "{{P}}SCAF_MSG",
"description": "Messages of the scaffolding hire company",
"messages": [
{
"msgno": "001",
"text": "Scaffolding order &1 is blocked: &2"
},
{
"msgno": "002",
"text": "Scaffold part &1 is not in stock"
},
{
"msgno": "003",
"text": "Quantity &1 is not valid for part &2"
},
{
"msgno": "004",
"text": "Order &1 exceeds the load limit of &2 kg"
},
{
"msgno": "005",
"text": "Order &1 was released for site &2"
}
]
},
{
"type": "CLAS",
"name": "{{P}}CX_SCAF_ORDER",
"file": "reference/cx_scaf_order.clas.abap",
"description": "Class-based exception of a blocked scaffolding order"
},
{
"type": "CLAS",
"name": "{{P}}T21_TEST",
"file": "reference/t21_test.clas.abap",
"description": "Own tests of the message class and of the exception class"
}
],
"craft_checks": [
"method_length"
]
}