Snapshot: new training tasks (balanced generation), docs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
29
tasks_gen/train/G1948/generation.json
Normal file
29
tasks_gen/train/G1948/generation.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"id": "G1948",
|
||||
"pool": "train",
|
||||
"object_type": "MSAG",
|
||||
"category": "D",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"Too close to task G0137 (similarity spec 0.35, rules 0.19, names 1.00). Choose a different business topic and different object names.",
|
||||
"Too close to task G1902 (similarity spec 0.68, rules 0.61, names 1.00). Choose a different business topic and different object names."
|
||||
],
|
||||
"by_check": {
|
||||
"extra": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 4,
|
||||
"killed": 4,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
107
tasks_gen/train/G1948/hidden/t_arc_hidden.clas.abap
Normal file
107
tasks_gen/train/G1948/hidden/t_arc_hidden.clas.abap
Normal file
@@ -0,0 +1,107 @@
|
||||
CLASS {{p}}t_arc_hidden DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC
|
||||
FOR TESTING
|
||||
DURATION SHORT
|
||||
RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
METHODS text_of
|
||||
IMPORTING iv_type TYPE symsgty
|
||||
iv_msgno TYPE symsgno
|
||||
iv_value1 TYPE string
|
||||
iv_value2 TYPE string
|
||||
RETURNING VALUE(rv_text) TYPE string.
|
||||
|
||||
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 replaces_placeholders FOR TESTING.
|
||||
METHODS exception_text FOR TESTING.
|
||||
METHODS exception_message_id FOR TESTING.
|
||||
METHODS exception_keeps_values FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t_arc_hidden IMPLEMENTATION.
|
||||
|
||||
METHOD text_of.
|
||||
MESSAGE ID '{{P}}MSG_ARC' TYPE iv_type NUMBER iv_msgno
|
||||
WITH iv_value1 iv_value2 INTO rv_text.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_001_text.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Archer Robin is not licensed for bow class recurve`
|
||||
act = text_of( iv_type = 'E' iv_msgno = '001'
|
||||
iv_value1 = 'Robin' iv_value2 = 'recurve' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_002_text.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Arrows 4 are below the minimum of 12`
|
||||
act = text_of( iv_type = 'E' iv_msgno = '002'
|
||||
iv_value1 = '4' iv_value2 = '12' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_003_text.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Group of 9 archers exceeds the range limit of 6`
|
||||
act = text_of( iv_type = 'W' iv_msgno = '003'
|
||||
iv_value1 = '9' iv_value2 = '6' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_004_text.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Booking B-2048 is confirmed for 5 archers`
|
||||
act = text_of( iv_type = 'I' iv_msgno = '004'
|
||||
iv_value1 = 'B-2048' iv_value2 = '5' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD replaces_placeholders.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Archer Kim is not licensed for bow class longbow`
|
||||
act = text_of( iv_type = 'E' iv_msgno = '001'
|
||||
iv_value1 = 'Kim' iv_value2 = 'longbow' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exception_text.
|
||||
DATA(lo_error) = NEW {{p}}cx_bow_check(
|
||||
iv_msgno = '001'
|
||||
iv_value1 = 'Robin'
|
||||
iv_value2 = 'recurve' ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Archer Robin is not licensed for bow class recurve`
|
||||
act = lo_error->get_message_text( ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exception_message_id.
|
||||
DATA(lo_error) = NEW {{p}}cx_bow_check(
|
||||
iv_msgno = '002'
|
||||
iv_value1 = '4'
|
||||
iv_value2 = '12' ).
|
||||
|
||||
DATA(lo_message) = CAST if_t100_message( lo_error ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = CONV symsgid( '{{P}}MSG_ARC' )
|
||||
act = lo_message->t100key-msgid ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = '002'
|
||||
act = lo_message->t100key-msgno ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exception_keeps_values.
|
||||
DATA(lo_error) = NEW {{p}}cx_bow_check(
|
||||
iv_msgno = '003'
|
||||
iv_value1 = '9'
|
||||
iv_value2 = '6' ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = `9` act = lo_error->value1 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `6` act = lo_error->value2 ).
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
52
tasks_gen/train/G1948/mutation.json
Normal file
52
tasks_gen/train/G1948/mutation.json
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"task": "G1948",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}MSG_ARC",
|
||||
"mutant": "message 001: number + 50 (number)",
|
||||
"status": "invalid",
|
||||
"hidden": "0/0",
|
||||
"failed_tests": []
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MSG_ARC",
|
||||
"mutant": "message 002: text + ' x' (text)",
|
||||
"status": "killed",
|
||||
"hidden": "7/8",
|
||||
"failed_tests": [
|
||||
"MSG_002_TEXT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MSG_ARC",
|
||||
"mutant": "message 004: text + ' x' (text)",
|
||||
"status": "killed",
|
||||
"hidden": "7/8",
|
||||
"failed_tests": [
|
||||
"MSG_004_TEXT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MSG_ARC",
|
||||
"mutant": "message 004: &1 -> &2 (placeholder)",
|
||||
"status": "killed",
|
||||
"hidden": "7/8",
|
||||
"failed_tests": [
|
||||
"MSG_004_TEXT"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MSG_ARC",
|
||||
"mutant": "message 002: &1 -> &2 (placeholder)",
|
||||
"status": "killed",
|
||||
"hidden": "7/8",
|
||||
"failed_tests": [
|
||||
"MSG_002_TEXT"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 4,
|
||||
"killed": 4,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
48
tasks_gen/train/G1948/reference/cx_bow_check.clas.abap
Normal file
48
tasks_gen/train/G1948/reference/cx_bow_check.clas.abap
Normal file
@@ -0,0 +1,48 @@
|
||||
CLASS {{p}}cx_bow_check DEFINITION
|
||||
PUBLIC
|
||||
INHERITING FROM cx_static_check
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
INTERFACES if_t100_message.
|
||||
|
||||
METHODS constructor
|
||||
IMPORTING
|
||||
iv_msgno TYPE symsgno
|
||||
iv_value1 TYPE string
|
||||
iv_value2 TYPE string.
|
||||
|
||||
METHODS get_message_text
|
||||
RETURNING VALUE(rv_text) TYPE string.
|
||||
|
||||
DATA value1 TYPE string READ-ONLY.
|
||||
DATA value2 TYPE string READ-ONLY.
|
||||
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
DATA mv_msgno TYPE symsgno.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}cx_bow_check IMPLEMENTATION.
|
||||
|
||||
METHOD constructor.
|
||||
super->constructor( ).
|
||||
|
||||
mv_msgno = iv_msgno.
|
||||
value1 = iv_value1.
|
||||
value2 = iv_value2.
|
||||
|
||||
if_t100_message~t100key-msgid = '{{P}}MSG_ARC'.
|
||||
if_t100_message~t100key-msgno = iv_msgno.
|
||||
if_t100_message~t100key-attr1 = 'VALUE1'.
|
||||
if_t100_message~t100key-attr2 = 'VALUE2'.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_message_text.
|
||||
MESSAGE ID '{{P}}MSG_ARC' TYPE 'E' NUMBER mv_msgno
|
||||
WITH value1 value2 INTO rv_text.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
71
tasks_gen/train/G1948/reference/t_arc_msg.clas.abap
Normal file
71
tasks_gen/train/G1948/reference/t_arc_msg.clas.abap
Normal file
@@ -0,0 +1,71 @@
|
||||
CLASS {{p}}t_arc_msg DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC
|
||||
FOR TESTING
|
||||
DURATION SHORT
|
||||
RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
METHODS text_of
|
||||
IMPORTING iv_type TYPE symsgty
|
||||
iv_msgno TYPE symsgno
|
||||
iv_value1 TYPE string
|
||||
iv_value2 TYPE string
|
||||
RETURNING VALUE(rv_text) TYPE string.
|
||||
|
||||
METHODS msg_001 FOR TESTING.
|
||||
METHODS msg_002 FOR TESTING.
|
||||
METHODS msg_003 FOR TESTING.
|
||||
METHODS msg_004 FOR TESTING.
|
||||
METHODS exception_text FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t_arc_msg IMPLEMENTATION.
|
||||
|
||||
METHOD text_of.
|
||||
MESSAGE ID '{{P}}MSG_ARC' TYPE iv_type NUMBER iv_msgno
|
||||
WITH iv_value1 iv_value2 INTO rv_text.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_001.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Archer Robin is not licensed for bow class recurve`
|
||||
act = text_of( iv_type = 'E' iv_msgno = '001'
|
||||
iv_value1 = 'Robin' iv_value2 = 'recurve' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_002.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Arrows 4 are below the minimum of 12`
|
||||
act = text_of( iv_type = 'E' iv_msgno = '002'
|
||||
iv_value1 = '4' iv_value2 = '12' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_003.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Group of 9 archers exceeds the range limit of 6`
|
||||
act = text_of( iv_type = 'W' iv_msgno = '003'
|
||||
iv_value1 = '9' iv_value2 = '6' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_004.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Booking B-2048 is confirmed for 5 archers`
|
||||
act = text_of( iv_type = 'I' iv_msgno = '004'
|
||||
iv_value1 = 'B-2048' iv_value2 = '5' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exception_text.
|
||||
DATA(lo_error) = NEW {{p}}cx_bow_check(
|
||||
iv_msgno = '004'
|
||||
iv_value1 = 'B-2048'
|
||||
iv_value2 = '5' ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Booking B-2048 is confirmed for 5 archers`
|
||||
act = lo_error->get_message_text( ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
58
tasks_gen/train/G1948/spec.md
Normal file
58
tasks_gen/train/G1948/spec.md
Normal file
@@ -0,0 +1,58 @@
|
||||
# 1. Goal
|
||||
The archery club "Green Quiver" checks a range booking before it confirms the
|
||||
shooting session. The club keeps all its messages in one message class. The club
|
||||
also needs a class-based exception that carries one of these messages, so that
|
||||
the caller of the range check can handle a rejection.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- All objects are in package $TMP.
|
||||
- The club keeps all its messages in one message class.
|
||||
- Every message of the club has at most two placeholders.
|
||||
- The range check raises the exception with the message that describes the
|
||||
rejection.
|
||||
|
||||
# 4. Contract
|
||||
- Create the message class {{P}}MSG_ARC in package $TMP. It contains the
|
||||
messages 001, 002, 003 and 004.
|
||||
- Create the exception class {{P}}CX_BOW_CHECK in package $TMP.
|
||||
- The class is public and final. It inherits from CX_STATIC_CHECK.
|
||||
- The class implements the interface IF_T100_MESSAGE.
|
||||
- The class has a public constructor with these importing parameters:
|
||||
- iv_msgno TYPE symsgno
|
||||
- iv_value1 TYPE string
|
||||
- iv_value2 TYPE string
|
||||
- The class has the public read-only attributes value1 and value2, both of type
|
||||
string. The constructor copies iv_value1 to value1 and iv_value2 to value2.
|
||||
- The method get_message_text( ) returns the text of the message with the number
|
||||
iv_msgno of the message class {{P}}MSG_ARC. In this text, &1 is replaced by
|
||||
iv_value1 and &2 is replaced by iv_value2.
|
||||
|
||||
# 5. Business rules
|
||||
1. Message 001 is an error message. The range check uses it when the archer is
|
||||
not licensed for the planned bow class. Its text is
|
||||
"Archer &1 is not licensed for bow class &2". &1 is the name of the archer.
|
||||
&2 is the bow class.
|
||||
2. Message 002 is an error message. The range check uses it when too few arrows
|
||||
are available. Its text is "Arrows &1 are below the minimum of &2". &1 is
|
||||
the number of arrows. &2 is the minimum number of arrows.
|
||||
3. Message 003 is a warning message. The range check uses it when the group is
|
||||
too large. Its text is "Group of &1 archers exceeds the range limit of &2".
|
||||
&1 is the group size. &2 is the limit of the range.
|
||||
4. Message 004 is an information message. The range check uses it when the
|
||||
booking is confirmed. Its text is "Booking &1 is confirmed for &2 archers".
|
||||
&1 is the booking number. &2 is the number of archers.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16.
|
||||
- Use clean ABAP. Keep every method below 40 statements.
|
||||
- Out of scope: do not create or change other objects.
|
||||
|
||||
# 7. Acceptance
|
||||
- The message class {{P}}MSG_ARC is active and contains the messages 001 to 004.
|
||||
- The class {{P}}CX_BOW_CHECK is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write ABAP Unit tests for the messages and for the exception class in a global
|
||||
test class.
|
||||
90
tasks_gen/train/G1948/task.json
Normal file
90
tasks_gen/train/G1948/task.json
Normal file
@@ -0,0 +1,90 @@
|
||||
{
|
||||
"id": "G1948",
|
||||
"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}}MSG_ARC",
|
||||
"messages": [
|
||||
{
|
||||
"msgno": "001"
|
||||
},
|
||||
{
|
||||
"msgno": "002"
|
||||
},
|
||||
{
|
||||
"msgno": "003"
|
||||
},
|
||||
{
|
||||
"msgno": "004"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_BOW_CHECK",
|
||||
"implements": [
|
||||
"IF_T100_MESSAGE"
|
||||
],
|
||||
"description": "Exception class that carries a message of the message class {{P}}MSG_ARC"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T_ARC_HIDDEN",
|
||||
"file": "hidden/t_arc_hidden.clas.abap",
|
||||
"description": "Hidden tests for the messages and the exception class"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "MSAG",
|
||||
"name": "{{P}}MSG_ARC",
|
||||
"description": "Messages of the archery club Green Quiver",
|
||||
"messages": [
|
||||
{
|
||||
"msgno": "001",
|
||||
"text": "Archer &1 is not licensed for bow class &2"
|
||||
},
|
||||
{
|
||||
"msgno": "002",
|
||||
"text": "Arrows &1 are below the minimum of &2"
|
||||
},
|
||||
{
|
||||
"msgno": "003",
|
||||
"text": "Group of &1 archers exceeds the range limit of &2"
|
||||
},
|
||||
{
|
||||
"msgno": "004",
|
||||
"text": "Booking &1 is confirmed for &2 archers"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}CX_BOW_CHECK",
|
||||
"file": "reference/cx_bow_check.clas.abap",
|
||||
"description": "Exception class that carries a message of the message class {{P}}MSG_ARC"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T_ARC_MSG",
|
||||
"file": "reference/t_arc_msg.clas.abap",
|
||||
"description": "Own ABAP Unit tests for the messages and the exception class"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user