Object type mix: INTF, TABL, STRU, MSAG, exception tasks (harness G2, mutants, generator notes), balanced generator, kind-deficit job order, dashboard mix card
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
24
tasks_gen/train/G1902/generation.json
Normal file
24
tasks_gen/train/G1902/generation.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"id": "G1902",
|
||||
"pool": "train",
|
||||
"object_type": "MSAG",
|
||||
"category": "D",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 85.0,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
97
tasks_gen/train/G1902/hidden/t41_hidden.clas.abap
Normal file
97
tasks_gen/train/G1902/hidden/t41_hidden.clas.abap
Normal file
@@ -0,0 +1,97 @@
|
||||
CLASS {{p}}t41_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS msg_001_text FOR TESTING.
|
||||
METHODS msg_002_text FOR TESTING.
|
||||
METHODS msg_003_text FOR TESTING.
|
||||
METHODS msg_004_text FOR TESTING.
|
||||
METHODS msg_005_text FOR TESTING.
|
||||
METHODS placeholder_substitution FOR TESTING.
|
||||
METHODS exception_text_two_args FOR TESTING.
|
||||
METHODS exception_text_one_arg FOR TESTING.
|
||||
METHODS exception_is_catchable FOR TESTING.
|
||||
METHODS exception_is_static_check FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t41_hidden IMPLEMENTATION.
|
||||
METHOD msg_001_text.
|
||||
DATA lv_text TYPE string.
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER '001' WITH 'ABAP101' INTO lv_text.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Course ABAP101 is fully booked' act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_002_text.
|
||||
DATA lv_text TYPE string.
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER '002' WITH 'P-100' 'ABAP101' INTO lv_text.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Participant P-100 is already booked for course ABAP101'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_003_text.
|
||||
DATA lv_text TYPE string.
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER '003' WITH 'ABAP101' '3' INTO lv_text.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Course ABAP101 has only 3 free seats left'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_004_text.
|
||||
DATA lv_text TYPE string.
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER '004' WITH 'ABAP101' INTO lv_text.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Booking for course ABAP101 is confirmed'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_005_text.
|
||||
DATA lv_text TYPE string.
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER '005' WITH 'ABAP101' '20250301' INTO lv_text.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Course ABAP101 was cancelled on 20250301'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD placeholder_substitution.
|
||||
DATA lv_text TYPE string.
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER '001' WITH 'ABAP202' INTO lv_text.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Course ABAP202 is fully booked' act = lv_text ).
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER '001' WITH 'ABAP303' INTO lv_text.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Course ABAP303 is fully booked' act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exception_text_two_args.
|
||||
DATA(lo_cx) = NEW {{p}}cx_booking( iv_msgno = '002' iv_arg1 = 'P-100' iv_arg2 = 'ABAP101' ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Participant P-100 is already booked for course ABAP101'
|
||||
act = lo_cx->get_text( ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exception_text_one_arg.
|
||||
DATA(lo_cx) = NEW {{p}}cx_booking( iv_msgno = '004' iv_arg1 = 'ABAP101' ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Booking for course ABAP101 is confirmed'
|
||||
act = lo_cx->get_text( ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exception_is_catchable.
|
||||
DATA lv_caught TYPE abap_bool.
|
||||
TRY.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_booking
|
||||
EXPORTING iv_msgno = '003' iv_arg1 = 'ABAP101' iv_arg2 = '1'.
|
||||
CATCH {{p}}cx_booking INTO DATA(lo_cx).
|
||||
lv_caught = abap_true.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Course ABAP101 has only 1 free seats left'
|
||||
act = lo_cx->get_text( ) ).
|
||||
ENDTRY.
|
||||
cl_abap_unit_assert=>assert_true( lv_caught ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exception_is_static_check.
|
||||
DATA lo_cx TYPE REF TO cx_static_check.
|
||||
lo_cx = NEW {{p}}cx_booking( iv_msgno = '001' iv_arg1 = 'ABAP101' ).
|
||||
cl_abap_unit_assert=>assert_bound( lo_cx ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
58
tasks_gen/train/G1902/mutation.json
Normal file
58
tasks_gen/train/G1902/mutation.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"task": "G1902",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}MSG",
|
||||
"mutant": "message 005: &1 -> &2 (placeholder)",
|
||||
"status": "killed",
|
||||
"hidden": "9/10",
|
||||
"failed_tests": [
|
||||
"MSG_005_TEXT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MSG",
|
||||
"mutant": "message 003: &1 -> &2 (placeholder)",
|
||||
"status": "killed",
|
||||
"hidden": "8/10",
|
||||
"failed_tests": [
|
||||
"EXCEPTION_IS_CATCHABLE",
|
||||
"MSG_003_TEXT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MSG",
|
||||
"mutant": "message 004: &1 -> &2 (placeholder)",
|
||||
"status": "killed",
|
||||
"hidden": "8/10",
|
||||
"failed_tests": [
|
||||
"EXCEPTION_TEXT_ONE_ARG",
|
||||
"MSG_004_TEXT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MSG",
|
||||
"mutant": "message 002: text + ' x' (text)",
|
||||
"status": "killed",
|
||||
"hidden": "8/10",
|
||||
"failed_tests": [
|
||||
"EXCEPTION_TEXT_TWO_ARGS",
|
||||
"MSG_002_TEXT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MSG",
|
||||
"mutant": "message 001: text + ' x' (text)",
|
||||
"status": "killed",
|
||||
"hidden": "8/10",
|
||||
"failed_tests": [
|
||||
"MSG_001_TEXT",
|
||||
"PLACEHOLDER_SUBSTITUTION"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
26
tasks_gen/train/G1902/reference/cx_booking.clas.abap
Normal file
26
tasks_gen/train/G1902/reference/cx_booking.clas.abap
Normal file
@@ -0,0 +1,26 @@
|
||||
CLASS {{p}}cx_booking DEFINITION PUBLIC INHERITING FROM cx_static_check FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
METHODS constructor
|
||||
IMPORTING iv_msgno TYPE symsgno
|
||||
iv_arg1 TYPE string DEFAULT ''
|
||||
iv_arg2 TYPE string DEFAULT ''.
|
||||
METHODS if_message~get_text REDEFINITION.
|
||||
PRIVATE SECTION.
|
||||
DATA mv_msgno TYPE symsgno.
|
||||
DATA mv_arg1 TYPE string.
|
||||
DATA mv_arg2 TYPE string.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_booking IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( ).
|
||||
mv_msgno = iv_msgno.
|
||||
mv_arg1 = iv_arg1.
|
||||
mv_arg2 = iv_arg2.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD if_message~get_text.
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER mv_msgno WITH mv_arg1 mv_arg2 INTO result.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
73
tasks_gen/train/G1902/reference/t41_test.clas.abap
Normal file
73
tasks_gen/train/G1902/reference/t41_test.clas.abap
Normal file
@@ -0,0 +1,73 @@
|
||||
CLASS {{p}}t41_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS msg_001 FOR TESTING.
|
||||
METHODS msg_002 FOR TESTING.
|
||||
METHODS msg_003 FOR TESTING.
|
||||
METHODS msg_004 FOR TESTING.
|
||||
METHODS msg_005 FOR TESTING.
|
||||
METHODS exception_two_args FOR TESTING.
|
||||
METHODS exception_one_arg FOR TESTING.
|
||||
METHODS exception_is_static_check FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t41_test IMPLEMENTATION.
|
||||
METHOD msg_001.
|
||||
DATA lv_text TYPE string.
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER '001' WITH 'ABAP101' INTO lv_text.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Course ABAP101 is fully booked' act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_002.
|
||||
DATA lv_text TYPE string.
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER '002' WITH 'P-100' 'ABAP101' INTO lv_text.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Participant P-100 is already booked for course ABAP101'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_003.
|
||||
DATA lv_text TYPE string.
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER '003' WITH 'ABAP101' '3' INTO lv_text.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Course ABAP101 has only 3 free seats left'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_004.
|
||||
DATA lv_text TYPE string.
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER '004' WITH 'ABAP101' INTO lv_text.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Booking for course ABAP101 is confirmed'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_005.
|
||||
DATA lv_text TYPE string.
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER '005' WITH 'ABAP101' '20250301' INTO lv_text.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Course ABAP101 was cancelled on 20250301'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exception_two_args.
|
||||
DATA(lo_cx) = NEW {{p}}cx_booking( iv_msgno = '002' iv_arg1 = 'P-100' iv_arg2 = 'ABAP101' ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Participant P-100 is already booked for course ABAP101'
|
||||
act = lo_cx->get_text( ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exception_one_arg.
|
||||
DATA(lo_cx) = NEW {{p}}cx_booking( iv_msgno = '004' iv_arg1 = 'ABAP101' ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Booking for course ABAP101 is confirmed'
|
||||
act = lo_cx->get_text( ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exception_is_static_check.
|
||||
DATA lo_cx TYPE REF TO cx_static_check.
|
||||
lo_cx = NEW {{p}}cx_booking( iv_msgno = '001' iv_arg1 = 'ABAP101' ).
|
||||
cl_abap_unit_assert=>assert_bound( lo_cx ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
19
tasks_gen/train/G1902/seed/cx_legacy.clas.abap
Normal file
19
tasks_gen/train/G1902/seed/cx_legacy.clas.abap
Normal file
@@ -0,0 +1,19 @@
|
||||
CLASS {{p}}cx_legacy DEFINITION PUBLIC INHERITING FROM cx_static_check FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
METHODS constructor IMPORTING iv_text TYPE string.
|
||||
METHODS if_message~get_text REDEFINITION.
|
||||
PRIVATE SECTION.
|
||||
DATA mv_text TYPE string.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_legacy IMPLEMENTATION.
|
||||
METHOD constructor.
|
||||
super->constructor( ).
|
||||
mv_text = iv_text.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD if_message~get_text.
|
||||
result = mv_text.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
69
tasks_gen/train/G1902/spec.md
Normal file
69
tasks_gen/train/G1902/spec.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# 1. Goal
|
||||
|
||||
Create the message class and the class-based exception for the training course
|
||||
booking service. The booking service reports every problem with a message from
|
||||
the message class. The exception class carries the text of such a message.
|
||||
|
||||
# 2. Open questions
|
||||
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
|
||||
- All objects are in package $TMP.
|
||||
- The booking service books participants into training courses.
|
||||
- The old exception class {{P}}CX_LEGACY exists. It takes a hard-coded text and
|
||||
does not use a message class. The new exception class replaces it.
|
||||
- All texts of the booking service come from one message class.
|
||||
|
||||
# 4. Contract
|
||||
|
||||
- Create the message class {{P}}MSG with the messages of section 5.
|
||||
- Create the exception class {{P}}CX_BOOKING:
|
||||
- It is a class-based exception and inherits from CX_STATIC_CHECK.
|
||||
- The constructor has these parameters:
|
||||
- iv_msgno TYPE symsgno
|
||||
- iv_arg1 TYPE string, default ''
|
||||
- iv_arg2 TYPE string, default ''
|
||||
- The method GET_TEXT of the interface IF_MESSAGE returns the text of the
|
||||
message with the number iv_msgno from {{P}}MSG. The placeholder &1 is
|
||||
replaced by iv_arg1 and the placeholder &2 is replaced by iv_arg2.
|
||||
|
||||
# 5. Business rules
|
||||
|
||||
Message class {{P}}MSG:
|
||||
|
||||
1. Message 001, error message, text "Course &1 is fully booked". The booking
|
||||
service uses it when a course has no free seat.
|
||||
2. Message 002, error message, text "Participant &1 is already booked for
|
||||
course &2". The booking service uses it for a double booking.
|
||||
3. Message 003, warning message, text "Course &1 has only &2 free seats left".
|
||||
The booking service uses it when a course has few free seats left.
|
||||
4. Message 004, information message, text "Booking for course &1 is
|
||||
confirmed". The booking service uses it for a successful booking.
|
||||
5. Message 005, warning message, text "Course &1 was cancelled on &2". The
|
||||
booking service uses it for a cancelled course.
|
||||
|
||||
Exception class {{P}}CX_BOOKING:
|
||||
|
||||
6. The constructor stores the message number and the two placeholders.
|
||||
7. GET_TEXT returns the text of the message with the number iv_msgno from
|
||||
{{P}}MSG. The placeholder &1 is replaced by iv_arg1 and the placeholder &2 is
|
||||
replaced by iv_arg2.
|
||||
|
||||
# 6. Constraints
|
||||
|
||||
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
|
||||
- Coding standards: Clean ABAP. Keep every method below 40 statements. Do not
|
||||
produce ATC findings of priority 1 or 2.
|
||||
- Out of scope: database tables, CDS views, reports, dynpro, and the old
|
||||
exception class {{P}}CX_LEGACY.
|
||||
|
||||
# 7. Acceptance
|
||||
|
||||
- The message class {{P}}MSG is active. It contains the messages 001 to 005 with
|
||||
the exact texts of section 5.
|
||||
- The exception class {{P}}CX_BOOKING is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write ABAP Unit tests for the messages and the exception class in a global
|
||||
test class.
|
||||
103
tasks_gen/train/G1902/task.json
Normal file
103
tasks_gen/train/G1902/task.json
Normal file
@@ -0,0 +1,103 @@
|
||||
{
|
||||
"id": "G1902",
|
||||
"category": "D",
|
||||
"object_type": "MSAG",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_LEGACY",
|
||||
"file": "seed/cx_legacy.clas.abap",
|
||||
"description": "Old exception class with a hard-coded text"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "MSAG",
|
||||
"name": "{{P}}MSG",
|
||||
"messages": [
|
||||
{
|
||||
"msgno": "001"
|
||||
},
|
||||
{
|
||||
"msgno": "002"
|
||||
},
|
||||
{
|
||||
"msgno": "003"
|
||||
},
|
||||
{
|
||||
"msgno": "004"
|
||||
},
|
||||
{
|
||||
"msgno": "005"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_BOOKING",
|
||||
"description": "Class-based exception (CX_STATIC_CHECK). Constructor IMPORTING iv_msgno TYPE symsgno, iv_arg1 TYPE string DEFAULT '', iv_arg2 TYPE string DEFAULT ''. GET_TEXT of IF_MESSAGE returns the text of message iv_msgno from {{P}}MSG with &1 = iv_arg1 and &2 = iv_arg2."
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}CX_LEGACY"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T41_HIDDEN",
|
||||
"file": "hidden/t41_hidden.clas.abap",
|
||||
"description": "T41 hidden tests"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "MSAG",
|
||||
"name": "{{P}}MSG",
|
||||
"description": "Booking messages",
|
||||
"messages": [
|
||||
{
|
||||
"msgno": "001",
|
||||
"text": "Course &1 is fully booked"
|
||||
},
|
||||
{
|
||||
"msgno": "002",
|
||||
"text": "Participant &1 is already booked for course &2"
|
||||
},
|
||||
{
|
||||
"msgno": "003",
|
||||
"text": "Course &1 has only &2 free seats left"
|
||||
},
|
||||
{
|
||||
"msgno": "004",
|
||||
"text": "Booking for course &1 is confirmed"
|
||||
},
|
||||
{
|
||||
"msgno": "005",
|
||||
"text": "Course &1 was cancelled on &2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_BOOKING",
|
||||
"file": "reference/cx_booking.clas.abap",
|
||||
"description": "Booking exception class"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T41_TEST",
|
||||
"file": "reference/t41_test.clas.abap",
|
||||
"description": "T41 own tests"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user