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,35 @@
INTERFACE {{p}}if_log_plan PUBLIC.
TYPES:
ty_reason TYPE c LENGTH 9,
ty_count TYPE i,
BEGIN OF ty_log,
dia TYPE i,
len TYPE i,
END OF ty_log,
BEGIN OF ty_board,
thick TYPE i,
width TYPE i,
END OF ty_board.
CONSTANTS:
BEGIN OF c_reason,
ok TYPE ty_reason VALUE 'OK',
size TYPE ty_reason VALUE 'SIZE',
thick TYPE ty_reason VALUE 'THICK',
width TYPE ty_reason VALUE 'WIDTH',
len TYPE ty_reason VALUE 'LEN',
END OF c_reason,
c_min_thick TYPE i VALUE 20,
c_max_thick TYPE i VALUE 100,
c_min_len TYPE i VALUE 100.
METHODS check
IMPORTING is_log TYPE ty_log
is_board TYPE ty_board
RETURNING VALUE(rv_reason) TYPE ty_reason.
METHODS board_count
IMPORTING is_log TYPE ty_log
is_board TYPE ty_board
RETURNING VALUE(rv_count) TYPE ty_count.
ENDINTERFACE.

View File

@@ -0,0 +1,35 @@
INTERFACE {{p}}if_log_plan PUBLIC.
TYPES:
ty_reason TYPE c LENGTH 10,
ty_count TYPE i,
BEGIN OF ty_log,
dia TYPE i,
len TYPE i,
END OF ty_log,
BEGIN OF ty_board,
thick TYPE i,
width TYPE i,
END OF ty_board.
CONSTANTS:
BEGIN OF c_reason,
ok TYPE ty_reason VALUE 'ZK',
size TYPE ty_reason VALUE 'SIZE',
thick TYPE ty_reason VALUE 'THICK',
width TYPE ty_reason VALUE 'WIDTH',
len TYPE ty_reason VALUE 'LEN',
END OF c_reason,
c_min_thick TYPE i VALUE 20,
c_max_thick TYPE i VALUE 100,
c_min_len TYPE i VALUE 100.
METHODS check
IMPORTING is_log TYPE ty_log
is_board TYPE ty_board
RETURNING VALUE(rv_reason) TYPE ty_reason.
METHODS board_count
IMPORTING is_log TYPE ty_log
is_board TYPE ty_board
RETURNING VALUE(rv_count) TYPE ty_count.
ENDINTERFACE.

View File

@@ -0,0 +1,35 @@
INTERFACE {{p}}if_log_plan PUBLIC.
TYPES:
ty_reason TYPE c LENGTH 10,
ty_count TYPE i,
BEGIN OF ty_log,
dia TYPE i,
len TYPE i,
END OF ty_log,
BEGIN OF ty_board,
thick TYPE i,
width TYPE i,
END OF ty_board.
CONSTANTS:
BEGIN OF c_reason,
ok TYPE ty_reason VALUE 'OK',
size TYPE ty_reason VALUE 'SIZE',
thick TYPE ty_reason VALUE 'ZHICK',
width TYPE ty_reason VALUE 'WIDTH',
len TYPE ty_reason VALUE 'LEN',
END OF c_reason,
c_min_thick TYPE i VALUE 20,
c_max_thick TYPE i VALUE 100,
c_min_len TYPE i VALUE 100.
METHODS check
IMPORTING is_log TYPE ty_log
is_board TYPE ty_board
RETURNING VALUE(rv_reason) TYPE ty_reason.
METHODS board_count
IMPORTING is_log TYPE ty_log
is_board TYPE ty_board
RETURNING VALUE(rv_count) TYPE ty_count.
ENDINTERFACE.

View File

@@ -0,0 +1,35 @@
INTERFACE {{p}}if_log_plan PUBLIC.
TYPES:
ty_reason TYPE c LENGTH 10,
ty_count TYPE i,
BEGIN OF ty_log,
dia TYPE i,
len TYPE i,
END OF ty_log,
BEGIN OF ty_board,
thick TYPE i,
width TYPE i,
END OF ty_board.
CONSTANTS:
BEGIN OF c_reason,
ok TYPE ty_reason VALUE 'OK',
size TYPE ty_reason VALUE 'SIZE',
thick TYPE ty_reason VALUE 'THICK',
width TYPE ty_reason VALUE 'WIDTH',
len TYPE ty_reason VALUE 'ZEN',
END OF c_reason,
c_min_thick TYPE i VALUE 20,
c_max_thick TYPE i VALUE 100,
c_min_len TYPE i VALUE 100.
METHODS check
IMPORTING is_log TYPE ty_log
is_board TYPE ty_board
RETURNING VALUE(rv_reason) TYPE ty_reason.
METHODS board_count
IMPORTING is_log TYPE ty_log
is_board TYPE ty_board
RETURNING VALUE(rv_count) TYPE ty_count.
ENDINTERFACE.

View File

@@ -0,0 +1,35 @@
INTERFACE {{p}}if_log_plan PUBLIC.
TYPES:
ty_reason TYPE c LENGTH 10,
ty_count TYPE i,
BEGIN OF ty_log,
dia TYPE i,
len TYPE i,
END OF ty_log,
BEGIN OF ty_board,
thick TYPE i,
width TYPE i,
END OF ty_board.
CONSTANTS:
BEGIN OF c_reason,
ok TYPE ty_reason VALUE 'OK',
size TYPE ty_reason VALUE 'SIZE',
thick TYPE ty_reason VALUE 'THICK',
width TYPE ty_reason VALUE 'WIDTH',
len TYPE ty_reason VALUE 'LEN',
END OF c_reason,
c_min_thick TYPE i VALUE 20,
c_max_thick TYPE i VALUE 100,
c_min_len TYPE i VALUE 101.
METHODS check
IMPORTING is_log TYPE ty_log
is_board TYPE ty_board
RETURNING VALUE(rv_reason) TYPE ty_reason.
METHODS board_count
IMPORTING is_log TYPE ty_log
is_board TYPE ty_board
RETURNING VALUE(rv_count) TYPE ty_count.
ENDINTERFACE.

View File

@@ -0,0 +1,24 @@
{
"id": "G1938",
"pool": "train",
"object_type": "INTF",
"category": "A",
"attempts": [
{
"stage": "validate",
"oracle": 85.0,
"null": 0
},
{
"stage": "validate",
"oracle": 100.0,
"null": 0,
"mutation": {
"valid": 5,
"killed": 5,
"ok": true
}
}
],
"accepted": true
}

View File

@@ -0,0 +1,124 @@
CLASS {{p}}t02_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PUBLIC SECTION.
INTERFACES {{p}}if_log_plan.
PRIVATE SECTION.
METHODS reason_ok FOR TESTING.
METHODS reason_size FOR TESTING.
METHODS reason_thick FOR TESTING.
METHODS reason_width FOR TESTING.
METHODS reason_len FOR TESTING.
METHODS limits_are_set FOR TESTING.
METHODS reason_type_is_char10 FOR TESTING.
METHODS count_type_is_integer FOR TESTING.
METHODS log_type_is_two_ints FOR TESTING.
METHODS board_type_is_two_ints FOR TESTING.
METHODS signatures_match FOR TESTING.
ENDCLASS.
CLASS {{p}}t02_hidden IMPLEMENTATION.
METHOD {{p}}if_log_plan~check.
rv_reason = {{p}}if_log_plan=>c_reason-ok.
ENDMETHOD.
METHOD {{p}}if_log_plan~board_count.
rv_count = 0.
ENDMETHOD.
METHOD reason_ok.
cl_abap_unit_assert=>assert_equals( exp = 'OK'
act = {{p}}if_log_plan=>c_reason-ok ).
ENDMETHOD.
METHOD reason_size.
cl_abap_unit_assert=>assert_equals( exp = 'SIZE'
act = {{p}}if_log_plan=>c_reason-size ).
ENDMETHOD.
METHOD reason_thick.
cl_abap_unit_assert=>assert_equals( exp = 'THICK'
act = {{p}}if_log_plan=>c_reason-thick ).
ENDMETHOD.
METHOD reason_width.
cl_abap_unit_assert=>assert_equals( exp = 'WIDTH'
act = {{p}}if_log_plan=>c_reason-width ).
ENDMETHOD.
METHOD reason_len.
cl_abap_unit_assert=>assert_equals( exp = 'LEN'
act = {{p}}if_log_plan=>c_reason-len ).
ENDMETHOD.
METHOD limits_are_set.
cl_abap_unit_assert=>assert_equals( exp = 20 act = {{p}}if_log_plan=>c_min_thick ).
cl_abap_unit_assert=>assert_equals( exp = 100 act = {{p}}if_log_plan=>c_max_thick ).
cl_abap_unit_assert=>assert_equals( exp = 100 act = {{p}}if_log_plan=>c_min_len ).
cl_abap_unit_assert=>assert_equals(
exp = cl_abap_typedescr=>typekind_int
act = cl_abap_typedescr=>describe_by_data( {{p}}if_log_plan=>c_min_thick )->type_kind ).
ENDMETHOD.
METHOD reason_type_is_char10.
DATA lv_reason TYPE {{p}}if_log_plan=>ty_reason.
DATA lv_len TYPE i.
DESCRIBE FIELD lv_reason LENGTH lv_len IN CHARACTER MODE.
cl_abap_unit_assert=>assert_equals( exp = 10 act = lv_len ).
cl_abap_unit_assert=>assert_equals(
exp = cl_abap_typedescr=>typekind_char
act = cl_abap_typedescr=>describe_by_data( lv_reason )->type_kind ).
ENDMETHOD.
METHOD count_type_is_integer.
DATA lv_count TYPE {{p}}if_log_plan=>ty_count.
cl_abap_unit_assert=>assert_equals(
exp = cl_abap_typedescr=>typekind_int
act = cl_abap_typedescr=>describe_by_data( lv_count )->type_kind ).
ENDMETHOD.
METHOD log_type_is_two_ints.
DATA(ls_log) = VALUE {{p}}if_log_plan=>ty_log( dia = 300 len = 400 ).
DATA(lo_descr) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_data( ls_log ) ).
DATA(lt_comp) = lo_descr->get_components( ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_comp ) ).
cl_abap_unit_assert=>assert_equals(
exp = cl_abap_typedescr=>typekind_int
act = cl_abap_typedescr=>describe_by_data( ls_log-dia )->type_kind ).
cl_abap_unit_assert=>assert_equals(
exp = cl_abap_typedescr=>typekind_int
act = cl_abap_typedescr=>describe_by_data( ls_log-len )->type_kind ).
ENDMETHOD.
METHOD board_type_is_two_ints.
DATA(ls_board) = VALUE {{p}}if_log_plan=>ty_board( thick = 40 width = 200 ).
DATA(lo_descr) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_data( ls_board ) ).
DATA(lt_comp) = lo_descr->get_components( ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_comp ) ).
cl_abap_unit_assert=>assert_equals(
exp = cl_abap_typedescr=>typekind_int
act = cl_abap_typedescr=>describe_by_data( ls_board-thick )->type_kind ).
cl_abap_unit_assert=>assert_equals(
exp = cl_abap_typedescr=>typekind_int
act = cl_abap_typedescr=>describe_by_data( ls_board-width )->type_kind ).
ENDMETHOD.
METHOD signatures_match.
DATA(ls_log) = VALUE {{p}}if_log_plan=>ty_log( dia = 300 len = 400 ).
DATA(ls_board) = VALUE {{p}}if_log_plan=>ty_board( thick = 40 width = 200 ).
DATA(lv_reason) = me->{{p}}if_log_plan~check( is_log = ls_log is_board = ls_board ).
DATA(lv_count) = me->{{p}}if_log_plan~board_count( is_log = ls_log is_board = ls_board ).
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_log_plan=>c_reason-ok act = lv_reason ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_count ).
DATA lv_len TYPE i.
DESCRIBE FIELD lv_reason LENGTH lv_len IN CHARACTER MODE.
cl_abap_unit_assert=>assert_equals( exp = 10 act = lv_len ).
cl_abap_unit_assert=>assert_equals(
exp = cl_abap_typedescr=>typekind_int
act = cl_abap_typedescr=>describe_by_data( lv_count )->type_kind ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,55 @@
{
"task": "G1938",
"mutants": [
{
"object": "{{P}}IF_LOG_PLAN",
"mutant": "line 3: LENGTH 10 -> LENGTH 9 (length)",
"status": "killed",
"hidden": "9/11",
"failed_tests": [
"REASON_TYPE_IS_CHAR10",
"SIGNATURES_MATCH"
]
},
{
"object": "{{P}}IF_LOG_PLAN",
"mutant": "line 16: VALUE 'OK' -> VALUE 'ZK' (lit)",
"status": "killed",
"hidden": "10/11",
"failed_tests": [
"REASON_OK"
]
},
{
"object": "{{P}}IF_LOG_PLAN",
"mutant": "line 18: VALUE 'THICK' -> VALUE 'ZHICK' (lit)",
"status": "killed",
"hidden": "10/11",
"failed_tests": [
"REASON_THICK"
]
},
{
"object": "{{P}}IF_LOG_PLAN",
"mutant": "line 20: VALUE 'LEN' -> VALUE 'ZEN' (lit)",
"status": "killed",
"hidden": "10/11",
"failed_tests": [
"REASON_LEN"
]
},
{
"object": "{{P}}IF_LOG_PLAN",
"mutant": "line 24: VALUE 100 -> VALUE 101 (const)",
"status": "killed",
"hidden": "10/11",
"failed_tests": [
"LIMITS_ARE_SET"
]
}
],
"valid": 5,
"killed": 5,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,35 @@
INTERFACE {{p}}if_log_plan PUBLIC.
TYPES:
ty_reason TYPE c LENGTH 10,
ty_count TYPE i,
BEGIN OF ty_log,
dia TYPE i,
len TYPE i,
END OF ty_log,
BEGIN OF ty_board,
thick TYPE i,
width TYPE i,
END OF ty_board.
CONSTANTS:
BEGIN OF c_reason,
ok TYPE ty_reason VALUE 'OK',
size TYPE ty_reason VALUE 'SIZE',
thick TYPE ty_reason VALUE 'THICK',
width TYPE ty_reason VALUE 'WIDTH',
len TYPE ty_reason VALUE 'LEN',
END OF c_reason,
c_min_thick TYPE i VALUE 20,
c_max_thick TYPE i VALUE 100,
c_min_len TYPE i VALUE 100.
METHODS check
IMPORTING is_log TYPE ty_log
is_board TYPE ty_board
RETURNING VALUE(rv_reason) TYPE ty_reason.
METHODS board_count
IMPORTING is_log TYPE ty_log
is_board TYPE ty_board
RETURNING VALUE(rv_count) TYPE ty_count.
ENDINTERFACE.

View File

@@ -0,0 +1,70 @@
CLASS {{p}}if_log_plan_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PUBLIC SECTION.
INTERFACES {{p}}if_log_plan.
PRIVATE SECTION.
METHODS reasons_are_set FOR TESTING.
METHODS limits_are_set FOR TESTING.
METHODS types_are_set FOR TESTING.
METHODS signatures_match FOR TESTING.
ENDCLASS.
CLASS {{p}}if_log_plan_test IMPLEMENTATION.
METHOD {{p}}if_log_plan~check.
rv_reason = {{p}}if_log_plan=>c_reason-ok.
ENDMETHOD.
METHOD {{p}}if_log_plan~board_count.
rv_count = 0.
ENDMETHOD.
METHOD reasons_are_set.
cl_abap_unit_assert=>assert_equals( exp = 'OK'
act = {{p}}if_log_plan=>c_reason-ok ).
cl_abap_unit_assert=>assert_equals( exp = 'SIZE'
act = {{p}}if_log_plan=>c_reason-size ).
cl_abap_unit_assert=>assert_equals( exp = 'THICK'
act = {{p}}if_log_plan=>c_reason-thick ).
cl_abap_unit_assert=>assert_equals( exp = 'WIDTH'
act = {{p}}if_log_plan=>c_reason-width ).
cl_abap_unit_assert=>assert_equals( exp = 'LEN'
act = {{p}}if_log_plan=>c_reason-len ).
ENDMETHOD.
METHOD limits_are_set.
cl_abap_unit_assert=>assert_equals( exp = 20 act = {{p}}if_log_plan=>c_min_thick ).
cl_abap_unit_assert=>assert_equals( exp = 100 act = {{p}}if_log_plan=>c_max_thick ).
cl_abap_unit_assert=>assert_equals( exp = 100 act = {{p}}if_log_plan=>c_min_len ).
ENDMETHOD.
METHOD types_are_set.
DATA lv_len TYPE i.
DATA lv_reason TYPE {{p}}if_log_plan=>ty_reason.
DESCRIBE FIELD lv_reason LENGTH lv_len IN CHARACTER MODE.
cl_abap_unit_assert=>assert_equals( exp = 10 act = lv_len ).
DATA(ls_log) = VALUE {{p}}if_log_plan=>ty_log( dia = 300 len = 400 ).
DATA(lo_log) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_data( ls_log ) ).
cl_abap_unit_assert=>assert_equals( exp = 2
act = lines( lo_log->get_components( ) ) ).
DATA(ls_board) = VALUE {{p}}if_log_plan=>ty_board( thick = 40 width = 200 ).
DATA(lo_board) = CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_data( ls_board ) ).
cl_abap_unit_assert=>assert_equals( exp = 2
act = lines( lo_board->get_components( ) ) ).
ENDMETHOD.
METHOD signatures_match.
DATA(ls_log) = VALUE {{p}}if_log_plan=>ty_log( dia = 300 len = 400 ).
DATA(ls_board) = VALUE {{p}}if_log_plan=>ty_board( thick = 40 width = 200 ).
DATA(lv_reason) = me->{{p}}if_log_plan~check( is_log = ls_log is_board = ls_board ).
DATA(lv_count) = me->{{p}}if_log_plan~board_count( is_log = ls_log is_board = ls_board ).
cl_abap_unit_assert=>assert_equals( exp = {{p}}if_log_plan=>c_reason-ok act = lv_reason ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_count ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,63 @@
# 1. Goal
Define the interface {{P}}IF_LOG_PLAN in package $TMP. The sawmill office and the
sawyer's terminal use this interface to plan the cutting of a log. The interface
is the contract. It fixes the reason codes, the limits and the two method
signatures.
# 2. Open questions
None.
# 3. Context
- A sawmill cuts logs into boards. A log has a diameter in millimetres and a
length in centimetres. A board has a thickness in millimetres and a width in
millimetres.
- The office checks an order before the sawyer starts. The reason codes name the
first check that fails:
SIZE - a value is zero or negative.
THICK - the board thickness is outside the limits.
WIDTH - the board is wider than the log.
LEN - the log is shorter than the minimum length.
OK - the order is valid.
- If the check returns OK, the office asks for the number of boards. The number
of boards is the log diameter in millimetres divided by the board thickness in
millimetres, rounded down.
- The interface is the only object of this task. No class implements it here.
# 4. Contract
- Create the interface {{P}}IF_LOG_PLAN in package $TMP.
- The interface has exactly two methods: check and board_count.
- Do not add other methods.
# 5. Business rules
1. The interface defines the type ty_reason. ty_reason is a character type of
length 10.
2. The interface defines the type ty_count. ty_count is an integer type.
3. The interface defines the structure type ty_log. ty_log has exactly the two
components dia and len. dia is an integer, the log diameter in millimetres.
len is an integer, the log length in centimetres.
4. The interface defines the structure type ty_board. ty_board has exactly the
two components thick and width. thick is an integer, the board thickness in
millimetres. width is an integer, the board width in millimetres.
5. The interface defines the constant structure c_reason. c_reason has exactly
the five components ok, size, thick, width and len. All five components have
the type ty_reason. The values are 'OK', 'SIZE', 'THICK', 'WIDTH' and 'LEN'.
6. The interface defines the constant c_min_thick with the value 20, the constant
c_max_thick with the value 100 and the constant c_min_len with the value 100.
All three constants have the type i.
7. The interface defines the method check. check has the importing parameters
is_log (TYPE ty_log) and is_board (TYPE ty_board). check has the returning
parameter rv_reason (TYPE ty_reason).
8. The interface defines the method board_count. board_count has the importing
parameters is_log (TYPE ty_log) and is_board (TYPE ty_board). board_count has
the returning parameter rv_count (TYPE ty_count).
# 6. Constraints
- Release target: SAP_BASIS 8.16.
- Coding standards: Clean ABAP. No comment that restates the code.
- Out of scope: do not create a class that implements {{P}}IF_LOG_PLAN. Do not
create database tables or CDS views.
# 7. Acceptance
- The interface is active and has no syntax error.
- The hidden tests pass.
- Write your own ABAP Unit tests for the interface.

View File

@@ -0,0 +1,50 @@
{
"id": "G1938",
"category": "A",
"object_type": "INTF",
"difficulty": 2,
"release_target": "v816",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 60,
"max_activations": 15
},
"seed": [],
"contract": [
{
"type": "INTF",
"name": "{{P}}IF_LOG_PLAN"
}
],
"out_of_scope": [
"A class that implements {{P}}IF_LOG_PLAN",
"Database tables",
"CDS views"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}T02_HIDDEN",
"file": "hidden/t02_hidden.clas.abap",
"description": "Checks the interface {{P}}IF_LOG_PLAN: constants, types and method signatures."
}
],
"reference": [
{
"type": "INTF",
"name": "{{P}}IF_LOG_PLAN",
"file": "reference/if_log_plan.intf.abap",
"description": "Contract for the sawmill log plan"
},
{
"type": "CLAS",
"name": "{{P}}IF_LOG_PLAN_TEST",
"file": "reference/if_log_plan_test.clas.abap",
"description": "Own ABAP Unit tests for the interface"
}
],
"craft_checks": [
"method_length",
"db_operation_in_loop"
]
}