Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
79
tasks_gen/train/G1061/faulty/m0_watch_order_pool.clas.abap
Normal file
79
tasks_gen/train/G1061/faulty/m0_watch_order_pool.clas.abap
Normal file
@@ -0,0 +1,79 @@
|
||||
CLASS {{p}}watch_order_pool DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_watch_order.
|
||||
|
||||
PRIVATE SECTION.
|
||||
TYPES ty_orders TYPE SORTED TABLE OF {{p}}if_watch_order=>ty_order
|
||||
WITH UNIQUE KEY order_id.
|
||||
TYPES ty_totals TYPE SORTED TABLE OF {{p}}if_watch_order=>ty_customer_total
|
||||
WITH UNIQUE KEY customer.
|
||||
|
||||
METHODS unique_orders
|
||||
IMPORTING it_orders TYPE {{p}}if_watch_order=>tt_orders
|
||||
RETURNING VALUE(rt_orders) TYPE ty_orders.
|
||||
METHODS add_orders
|
||||
IMPORTING it_orders TYPE {{p}}if_watch_order=>tt_orders
|
||||
CHANGING ct_orders TYPE ty_orders.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}watch_order_pool IMPLEMENTATION.
|
||||
METHOD {{p}}if_watch_order~merge_orders.
|
||||
DATA(lt_merged) = unique_orders( it_intake ).
|
||||
add_orders( EXPORTING it_orders = it_workshop
|
||||
CHANGING ct_orders = lt_merged ).
|
||||
rt_merged = lt_merged.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_watch_order~open_orders.
|
||||
DATA(lt_orders) = unique_orders( it_orders ).
|
||||
LOOP AT lt_orders INTO DATA(ls_order).
|
||||
IF ls_order-status <> {{p}}if_watch_order=>c_status-open.
|
||||
APPEND ls_order TO rt_open.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_watch_order~customer_totals.
|
||||
DATA(lt_orders) = unique_orders( it_orders ).
|
||||
DATA lt_totals TYPE ty_totals.
|
||||
LOOP AT lt_orders INTO DATA(ls_order).
|
||||
IF ls_order-status = {{p}}if_watch_order=>c_status-open.
|
||||
READ TABLE lt_totals ASSIGNING FIELD-SYMBOL(<ls_total>)
|
||||
WITH TABLE KEY customer = ls_order-customer.
|
||||
IF sy-subrc = 0.
|
||||
<ls_total>-total_min = <ls_total>-total_min + ls_order-duration_min.
|
||||
ELSE.
|
||||
INSERT VALUE {{p}}if_watch_order=>ty_customer_total(
|
||||
customer = ls_order-customer
|
||||
total_min = ls_order-duration_min )
|
||||
INTO TABLE lt_totals.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
rt_totals = lt_totals.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_watch_order~find_order.
|
||||
DATA(lt_orders) = unique_orders( it_orders ).
|
||||
DATA ls_found TYPE {{p}}if_watch_order=>ty_order.
|
||||
READ TABLE lt_orders INTO ls_found WITH TABLE KEY order_id = iv_order_id.
|
||||
rs_order = ls_found.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD add_orders.
|
||||
LOOP AT it_orders INTO DATA(ls_order).
|
||||
IF line_exists( ct_orders[ order_id = ls_order-order_id ] ).
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
INSERT ls_order INTO TABLE ct_orders.
|
||||
ENDLOOP.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unique_orders.
|
||||
DATA lt_orders TYPE ty_orders.
|
||||
add_orders( EXPORTING it_orders = it_orders
|
||||
CHANGING ct_orders = lt_orders ).
|
||||
rt_orders = lt_orders.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
79
tasks_gen/train/G1061/faulty/m1_watch_order_pool.clas.abap
Normal file
79
tasks_gen/train/G1061/faulty/m1_watch_order_pool.clas.abap
Normal file
@@ -0,0 +1,79 @@
|
||||
CLASS {{p}}watch_order_pool DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_watch_order.
|
||||
|
||||
PRIVATE SECTION.
|
||||
TYPES ty_orders TYPE SORTED TABLE OF {{p}}if_watch_order=>ty_order
|
||||
WITH UNIQUE KEY order_id.
|
||||
TYPES ty_totals TYPE SORTED TABLE OF {{p}}if_watch_order=>ty_customer_total
|
||||
WITH UNIQUE KEY customer.
|
||||
|
||||
METHODS unique_orders
|
||||
IMPORTING it_orders TYPE {{p}}if_watch_order=>tt_orders
|
||||
RETURNING VALUE(rt_orders) TYPE ty_orders.
|
||||
METHODS add_orders
|
||||
IMPORTING it_orders TYPE {{p}}if_watch_order=>tt_orders
|
||||
CHANGING ct_orders TYPE ty_orders.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}watch_order_pool IMPLEMENTATION.
|
||||
METHOD {{p}}if_watch_order~merge_orders.
|
||||
DATA(lt_merged) = unique_orders( it_intake ).
|
||||
add_orders( EXPORTING it_orders = it_workshop
|
||||
CHANGING ct_orders = lt_merged ).
|
||||
rt_merged = lt_merged.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_watch_order~open_orders.
|
||||
DATA(lt_orders) = unique_orders( it_orders ).
|
||||
LOOP AT lt_orders INTO DATA(ls_order).
|
||||
IF ls_order-status = {{p}}if_watch_order=>c_status-open.
|
||||
APPEND ls_order TO rt_open.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_watch_order~customer_totals.
|
||||
DATA(lt_orders) = unique_orders( it_orders ).
|
||||
DATA lt_totals TYPE ty_totals.
|
||||
LOOP AT lt_orders INTO DATA(ls_order).
|
||||
IF ls_order-status <> {{p}}if_watch_order=>c_status-open.
|
||||
READ TABLE lt_totals ASSIGNING FIELD-SYMBOL(<ls_total>)
|
||||
WITH TABLE KEY customer = ls_order-customer.
|
||||
IF sy-subrc = 0.
|
||||
<ls_total>-total_min = <ls_total>-total_min + ls_order-duration_min.
|
||||
ELSE.
|
||||
INSERT VALUE {{p}}if_watch_order=>ty_customer_total(
|
||||
customer = ls_order-customer
|
||||
total_min = ls_order-duration_min )
|
||||
INTO TABLE lt_totals.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
rt_totals = lt_totals.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_watch_order~find_order.
|
||||
DATA(lt_orders) = unique_orders( it_orders ).
|
||||
DATA ls_found TYPE {{p}}if_watch_order=>ty_order.
|
||||
READ TABLE lt_orders INTO ls_found WITH TABLE KEY order_id = iv_order_id.
|
||||
rs_order = ls_found.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD add_orders.
|
||||
LOOP AT it_orders INTO DATA(ls_order).
|
||||
IF line_exists( ct_orders[ order_id = ls_order-order_id ] ).
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
INSERT ls_order INTO TABLE ct_orders.
|
||||
ENDLOOP.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unique_orders.
|
||||
DATA lt_orders TYPE ty_orders.
|
||||
add_orders( EXPORTING it_orders = it_orders
|
||||
CHANGING ct_orders = lt_orders ).
|
||||
rt_orders = lt_orders.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
79
tasks_gen/train/G1061/faulty/m2_watch_order_pool.clas.abap
Normal file
79
tasks_gen/train/G1061/faulty/m2_watch_order_pool.clas.abap
Normal file
@@ -0,0 +1,79 @@
|
||||
CLASS {{p}}watch_order_pool DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_watch_order.
|
||||
|
||||
PRIVATE SECTION.
|
||||
TYPES ty_orders TYPE SORTED TABLE OF {{p}}if_watch_order=>ty_order
|
||||
WITH UNIQUE KEY order_id.
|
||||
TYPES ty_totals TYPE SORTED TABLE OF {{p}}if_watch_order=>ty_customer_total
|
||||
WITH UNIQUE KEY customer.
|
||||
|
||||
METHODS unique_orders
|
||||
IMPORTING it_orders TYPE {{p}}if_watch_order=>tt_orders
|
||||
RETURNING VALUE(rt_orders) TYPE ty_orders.
|
||||
METHODS add_orders
|
||||
IMPORTING it_orders TYPE {{p}}if_watch_order=>tt_orders
|
||||
CHANGING ct_orders TYPE ty_orders.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}watch_order_pool IMPLEMENTATION.
|
||||
METHOD {{p}}if_watch_order~merge_orders.
|
||||
DATA(lt_merged) = unique_orders( it_intake ).
|
||||
add_orders( EXPORTING it_orders = it_workshop
|
||||
CHANGING ct_orders = lt_merged ).
|
||||
rt_merged = lt_merged.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_watch_order~open_orders.
|
||||
DATA(lt_orders) = unique_orders( it_orders ).
|
||||
LOOP AT lt_orders INTO DATA(ls_order).
|
||||
IF ls_order-status = {{p}}if_watch_order=>c_status-open.
|
||||
APPEND ls_order TO rt_open.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_watch_order~customer_totals.
|
||||
DATA(lt_orders) = unique_orders( it_orders ).
|
||||
DATA lt_totals TYPE ty_totals.
|
||||
LOOP AT lt_orders INTO DATA(ls_order).
|
||||
IF ls_order-status = {{p}}if_watch_order=>c_status-open.
|
||||
READ TABLE lt_totals ASSIGNING FIELD-SYMBOL(<ls_total>)
|
||||
WITH TABLE KEY customer = ls_order-customer.
|
||||
IF sy-subrc = 0.
|
||||
<ls_total>-total_min = <ls_total>-total_min - ls_order-duration_min.
|
||||
ELSE.
|
||||
INSERT VALUE {{p}}if_watch_order=>ty_customer_total(
|
||||
customer = ls_order-customer
|
||||
total_min = ls_order-duration_min )
|
||||
INTO TABLE lt_totals.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
rt_totals = lt_totals.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_watch_order~find_order.
|
||||
DATA(lt_orders) = unique_orders( it_orders ).
|
||||
DATA ls_found TYPE {{p}}if_watch_order=>ty_order.
|
||||
READ TABLE lt_orders INTO ls_found WITH TABLE KEY order_id = iv_order_id.
|
||||
rs_order = ls_found.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD add_orders.
|
||||
LOOP AT it_orders INTO DATA(ls_order).
|
||||
IF line_exists( ct_orders[ order_id = ls_order-order_id ] ).
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
INSERT ls_order INTO TABLE ct_orders.
|
||||
ENDLOOP.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unique_orders.
|
||||
DATA lt_orders TYPE ty_orders.
|
||||
add_orders( EXPORTING it_orders = it_orders
|
||||
CHANGING ct_orders = lt_orders ).
|
||||
rt_orders = lt_orders.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
24
tasks_gen/train/G1061/generation.json
Normal file
24
tasks_gen/train/G1061/generation.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"id": "G1061",
|
||||
"pool": "train",
|
||||
"object_type": "CLAS",
|
||||
"category": "C",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 88.5,
|
||||
"null": 0
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 3,
|
||||
"killed": 3,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
142
tasks_gen/train/G1061/hidden/watch_order_hidden.clas.abap
Normal file
142
tasks_gen/train/G1061/hidden/watch_order_hidden.clas.abap
Normal file
@@ -0,0 +1,142 @@
|
||||
CLASS {{p}}watch_order_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}if_watch_order.
|
||||
METHODS setup.
|
||||
METHODS merge_keeps_intake_first FOR TESTING.
|
||||
METHODS merge_sorts_by_order_id FOR TESTING.
|
||||
METHODS merge_removes_duplicates FOR TESTING.
|
||||
METHODS merge_empty_input FOR TESTING.
|
||||
METHODS open_orders_filters_status FOR TESTING.
|
||||
METHODS open_orders_removes_dups FOR TESTING.
|
||||
METHODS totals_sum_open_only FOR TESTING.
|
||||
METHODS totals_sorted_by_customer FOR TESTING.
|
||||
METHODS totals_ignore_duplicate FOR TESTING.
|
||||
METHODS find_order_returns_first FOR TESTING.
|
||||
METHODS find_order_not_found FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}watch_order_hidden IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}watch_order_pool( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD merge_keeps_intake_first.
|
||||
DATA(lt_intake) = VALUE {{p}}if_watch_order=>tt_orders(
|
||||
( order_id = 'A1' customer = 'MUELLER' duration_min = 30 status = 'O' )
|
||||
( order_id = 'A2' customer = 'SCHMIDT' duration_min = 20 status = 'O' ) ).
|
||||
DATA(lt_workshop) = VALUE {{p}}if_watch_order=>tt_orders(
|
||||
( order_id = 'A2' customer = 'OTHER' duration_min = 99 status = 'C' )
|
||||
( order_id = 'A3' customer = 'WEBER' duration_min = 10 status = 'O' ) ).
|
||||
DATA(lt_merged) = mo_cut->merge_orders( it_intake = lt_intake
|
||||
it_workshop = lt_workshop ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = lines( lt_merged ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'SCHMIDT' act = lt_merged[ 2 ]-customer ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 20 act = lt_merged[ 2 ]-duration_min ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD merge_sorts_by_order_id.
|
||||
DATA(lt_intake) = VALUE {{p}}if_watch_order=>tt_orders(
|
||||
( order_id = 'B3' customer = 'GAMMA' duration_min = 1 status = 'O' )
|
||||
( order_id = 'B1' customer = 'ALPHA' duration_min = 2 status = 'O' ) ).
|
||||
DATA(lt_workshop) = VALUE {{p}}if_watch_order=>tt_orders(
|
||||
( order_id = 'B2' customer = 'BETA' duration_min = 3 status = 'O' ) ).
|
||||
DATA(lt_merged) = mo_cut->merge_orders( it_intake = lt_intake
|
||||
it_workshop = lt_workshop ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'B1' act = lt_merged[ 1 ]-order_id ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'B2' act = lt_merged[ 2 ]-order_id ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'B3' act = lt_merged[ 3 ]-order_id ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD merge_removes_duplicates.
|
||||
DATA(lt_intake) = VALUE {{p}}if_watch_order=>tt_orders(
|
||||
( order_id = 'C1' customer = 'FIRST' duration_min = 5 status = 'O' )
|
||||
( order_id = 'C1' customer = 'SECOND' duration_min = 7 status = 'O' ) ).
|
||||
DATA(lt_workshop) = VALUE {{p}}if_watch_order=>tt_orders( ).
|
||||
DATA(lt_merged) = mo_cut->merge_orders( it_intake = lt_intake
|
||||
it_workshop = lt_workshop ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_merged ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'FIRST' act = lt_merged[ 1 ]-customer ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD merge_empty_input.
|
||||
DATA(lt_merged) = mo_cut->merge_orders(
|
||||
it_intake = VALUE {{p}}if_watch_order=>tt_orders( )
|
||||
it_workshop = VALUE {{p}}if_watch_order=>tt_orders( ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lines( lt_merged ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD open_orders_filters_status.
|
||||
DATA(lt_orders) = VALUE {{p}}if_watch_order=>tt_orders(
|
||||
( order_id = 'D1' customer = 'ALPHA' duration_min = 1 status = 'C' )
|
||||
( order_id = 'D2' customer = 'BETA' duration_min = 2 status = 'O' )
|
||||
( order_id = 'D3' customer = 'GAMMA' duration_min = 3 status = 'O' ) ).
|
||||
DATA(lt_open) = mo_cut->open_orders( lt_orders ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_open ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'D2' act = lt_open[ 1 ]-order_id ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'D3' act = lt_open[ 2 ]-order_id ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD open_orders_removes_dups.
|
||||
DATA(lt_orders) = VALUE {{p}}if_watch_order=>tt_orders(
|
||||
( order_id = 'E1' customer = 'FIRST' duration_min = 1 status = 'O' )
|
||||
( order_id = 'E1' customer = 'SECOND' duration_min = 2 status = 'O' ) ).
|
||||
DATA(lt_open) = mo_cut->open_orders( lt_orders ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_open ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'FIRST' act = lt_open[ 1 ]-customer ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD totals_sum_open_only.
|
||||
DATA(lt_orders) = VALUE {{p}}if_watch_order=>tt_orders(
|
||||
( order_id = 'F1' customer = 'ALPHA' duration_min = 10 status = 'O' )
|
||||
( order_id = 'F2' customer = 'ALPHA' duration_min = 5 status = 'O' )
|
||||
( order_id = 'F3' customer = 'ALPHA' duration_min = 100 status = 'C' )
|
||||
( order_id = 'F4' customer = 'BETA' duration_min = 7 status = 'O' ) ).
|
||||
DATA(lt_totals) = mo_cut->customer_totals( lt_orders ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_totals ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 15 act = lt_totals[ 1 ]-total_min ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 7 act = lt_totals[ 2 ]-total_min ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD totals_sorted_by_customer.
|
||||
DATA(lt_orders) = VALUE {{p}}if_watch_order=>tt_orders(
|
||||
( order_id = 'G1' customer = 'ZETA' duration_min = 1 status = 'O' )
|
||||
( order_id = 'G2' customer = 'ALPHA' duration_min = 2 status = 'O' )
|
||||
( order_id = 'G3' customer = 'MIKE' duration_min = 3 status = 'O' ) ).
|
||||
DATA(lt_totals) = mo_cut->customer_totals( lt_orders ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'ALPHA' act = lt_totals[ 1 ]-customer ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'MIKE' act = lt_totals[ 2 ]-customer ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'ZETA' act = lt_totals[ 3 ]-customer ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD totals_ignore_duplicate.
|
||||
DATA(lt_orders) = VALUE {{p}}if_watch_order=>tt_orders(
|
||||
( order_id = 'H1' customer = 'ALPHA' duration_min = 10 status = 'O' )
|
||||
( order_id = 'H1' customer = 'ALPHA' duration_min = 10 status = 'O' ) ).
|
||||
DATA(lt_totals) = mo_cut->customer_totals( lt_orders ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_totals ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 10 act = lt_totals[ 1 ]-total_min ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD find_order_returns_first.
|
||||
DATA(lt_orders) = VALUE {{p}}if_watch_order=>tt_orders(
|
||||
( order_id = 'I1' customer = 'FIRST' duration_min = 4 status = 'O' )
|
||||
( order_id = 'I1' customer = 'SECOND' duration_min = 9 status = 'O' )
|
||||
( order_id = 'I2' customer = 'OTHER' duration_min = 1 status = 'O' ) ).
|
||||
DATA(ls_order) = mo_cut->find_order( it_orders = lt_orders
|
||||
iv_order_id = 'I1' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'FIRST' act = ls_order-customer ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4 act = ls_order-duration_min ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD find_order_not_found.
|
||||
DATA(lt_orders) = VALUE {{p}}if_watch_order=>tt_orders(
|
||||
( order_id = 'J1' customer = 'ALPHA' duration_min = 1 status = 'O' ) ).
|
||||
DATA(ls_order) = mo_cut->find_order( it_orders = lt_orders
|
||||
iv_order_id = 'ZZ' ).
|
||||
cl_abap_unit_assert=>assert_initial( ls_order-order_id ).
|
||||
cl_abap_unit_assert=>assert_initial( ls_order-customer ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = ls_order-duration_min ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
46
tasks_gen/train/G1061/mutation.json
Normal file
46
tasks_gen/train/G1061/mutation.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"task": "G1061",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}WATCH_ORDER_POOL",
|
||||
"mutant": "line 31: = -> <> (eq)",
|
||||
"status": "killed",
|
||||
"hidden": "9/11",
|
||||
"failed_tests": [
|
||||
"OPEN_ORDERS_FILTERS_STATUS",
|
||||
"OPEN_ORDERS_REMOVES_DUPS"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}WATCH_ORDER_POOL",
|
||||
"mutant": "line 41: = -> <> (eq)",
|
||||
"status": "killed",
|
||||
"hidden": "8/11",
|
||||
"failed_tests": [
|
||||
"TOTALS_IGNORE_DUPLICATE",
|
||||
"TOTALS_SORTED_BY_CUSTOMER",
|
||||
"TOTALS_SUM_OPEN_ONLY"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}WATCH_ORDER_POOL",
|
||||
"mutant": "line 45: + -> - (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "10/11",
|
||||
"failed_tests": [
|
||||
"TOTALS_SUM_OPEN_ONLY"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}WATCH_ORDER_POOL",
|
||||
"mutant": "line 66: = -> <> (eq)",
|
||||
"status": "invalid",
|
||||
"hidden": "0/0",
|
||||
"failed_tests": []
|
||||
}
|
||||
],
|
||||
"valid": 3,
|
||||
"killed": 3,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
79
tasks_gen/train/G1061/reference/watch_order_pool.clas.abap
Normal file
79
tasks_gen/train/G1061/reference/watch_order_pool.clas.abap
Normal file
@@ -0,0 +1,79 @@
|
||||
CLASS {{p}}watch_order_pool DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_watch_order.
|
||||
|
||||
PRIVATE SECTION.
|
||||
TYPES ty_orders TYPE SORTED TABLE OF {{p}}if_watch_order=>ty_order
|
||||
WITH UNIQUE KEY order_id.
|
||||
TYPES ty_totals TYPE SORTED TABLE OF {{p}}if_watch_order=>ty_customer_total
|
||||
WITH UNIQUE KEY customer.
|
||||
|
||||
METHODS unique_orders
|
||||
IMPORTING it_orders TYPE {{p}}if_watch_order=>tt_orders
|
||||
RETURNING VALUE(rt_orders) TYPE ty_orders.
|
||||
METHODS add_orders
|
||||
IMPORTING it_orders TYPE {{p}}if_watch_order=>tt_orders
|
||||
CHANGING ct_orders TYPE ty_orders.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}watch_order_pool IMPLEMENTATION.
|
||||
METHOD {{p}}if_watch_order~merge_orders.
|
||||
DATA(lt_merged) = unique_orders( it_intake ).
|
||||
add_orders( EXPORTING it_orders = it_workshop
|
||||
CHANGING ct_orders = lt_merged ).
|
||||
rt_merged = lt_merged.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_watch_order~open_orders.
|
||||
DATA(lt_orders) = unique_orders( it_orders ).
|
||||
LOOP AT lt_orders INTO DATA(ls_order).
|
||||
IF ls_order-status = {{p}}if_watch_order=>c_status-open.
|
||||
APPEND ls_order TO rt_open.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_watch_order~customer_totals.
|
||||
DATA(lt_orders) = unique_orders( it_orders ).
|
||||
DATA lt_totals TYPE ty_totals.
|
||||
LOOP AT lt_orders INTO DATA(ls_order).
|
||||
IF ls_order-status = {{p}}if_watch_order=>c_status-open.
|
||||
READ TABLE lt_totals ASSIGNING FIELD-SYMBOL(<ls_total>)
|
||||
WITH TABLE KEY customer = ls_order-customer.
|
||||
IF sy-subrc = 0.
|
||||
<ls_total>-total_min = <ls_total>-total_min + ls_order-duration_min.
|
||||
ELSE.
|
||||
INSERT VALUE {{p}}if_watch_order=>ty_customer_total(
|
||||
customer = ls_order-customer
|
||||
total_min = ls_order-duration_min )
|
||||
INTO TABLE lt_totals.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
rt_totals = lt_totals.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD {{p}}if_watch_order~find_order.
|
||||
DATA(lt_orders) = unique_orders( it_orders ).
|
||||
DATA ls_found TYPE {{p}}if_watch_order=>ty_order.
|
||||
READ TABLE lt_orders INTO ls_found WITH TABLE KEY order_id = iv_order_id.
|
||||
rs_order = ls_found.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD add_orders.
|
||||
LOOP AT it_orders INTO DATA(ls_order).
|
||||
IF line_exists( ct_orders[ order_id = ls_order-order_id ] ).
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
INSERT ls_order INTO TABLE ct_orders.
|
||||
ENDLOOP.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unique_orders.
|
||||
DATA lt_orders TYPE ty_orders.
|
||||
add_orders( EXPORTING it_orders = it_orders
|
||||
CHANGING ct_orders = lt_orders ).
|
||||
rt_orders = lt_orders.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -0,0 +1,63 @@
|
||||
CLASS ltc_watch_order_pool DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}if_watch_order.
|
||||
METHODS setup.
|
||||
METHODS merge_keeps_first_entry FOR TESTING.
|
||||
METHODS open_orders_are_sorted FOR TESTING.
|
||||
METHODS totals_only_open_orders FOR TESTING.
|
||||
METHODS find_order_returns_entry FOR TESTING.
|
||||
METHODS find_order_unknown_is_empty FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_watch_order_pool IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}watch_order_pool( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD merge_keeps_first_entry.
|
||||
DATA(lt_intake) = VALUE {{p}}if_watch_order=>tt_orders(
|
||||
( order_id = 'A1' customer = 'MUELLER' duration_min = 30 status = 'O' ) ).
|
||||
DATA(lt_workshop) = VALUE {{p}}if_watch_order=>tt_orders(
|
||||
( order_id = 'A1' customer = 'OTHER' duration_min = 99 status = 'O' ) ).
|
||||
DATA(lt_merged) = mo_cut->merge_orders( it_intake = lt_intake
|
||||
it_workshop = lt_workshop ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_merged ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'MUELLER' act = lt_merged[ 1 ]-customer ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD open_orders_are_sorted.
|
||||
DATA(lt_orders) = VALUE {{p}}if_watch_order=>tt_orders(
|
||||
( order_id = 'B2' customer = 'BETA' duration_min = 2 status = 'O' )
|
||||
( order_id = 'B1' customer = 'ALPHA' duration_min = 1 status = 'O' )
|
||||
( order_id = 'B3' customer = 'GAMMA' duration_min = 3 status = 'C' ) ).
|
||||
DATA(lt_open) = mo_cut->open_orders( lt_orders ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_open ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'B1' act = lt_open[ 1 ]-order_id ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD totals_only_open_orders.
|
||||
DATA(lt_orders) = VALUE {{p}}if_watch_order=>tt_orders(
|
||||
( order_id = 'C1' customer = 'ALPHA' duration_min = 10 status = 'O' )
|
||||
( order_id = 'C2' customer = 'ALPHA' duration_min = 90 status = 'C' ) ).
|
||||
DATA(lt_totals) = mo_cut->customer_totals( lt_orders ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_totals ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 10 act = lt_totals[ 1 ]-total_min ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD find_order_returns_entry.
|
||||
DATA(lt_orders) = VALUE {{p}}if_watch_order=>tt_orders(
|
||||
( order_id = 'D1' customer = 'ALPHA' duration_min = 5 status = 'O' ) ).
|
||||
DATA(ls_order) = mo_cut->find_order( it_orders = lt_orders
|
||||
iv_order_id = 'D1' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'ALPHA' act = ls_order-customer ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD find_order_unknown_is_empty.
|
||||
DATA(lt_orders) = VALUE {{p}}if_watch_order=>tt_orders(
|
||||
( order_id = 'E1' customer = 'ALPHA' duration_min = 5 status = 'O' ) ).
|
||||
DATA(ls_order) = mo_cut->find_order( it_orders = lt_orders
|
||||
iv_order_id = 'E9' ).
|
||||
cl_abap_unit_assert=>assert_initial( ls_order-order_id ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
38
tasks_gen/train/G1061/seed/if_watch_order.intf.abap
Normal file
38
tasks_gen/train/G1061/seed/if_watch_order.intf.abap
Normal file
@@ -0,0 +1,38 @@
|
||||
INTERFACE {{p}}if_watch_order PUBLIC.
|
||||
TYPES ty_order_id TYPE c LENGTH 10.
|
||||
TYPES ty_customer TYPE c LENGTH 20.
|
||||
TYPES ty_status TYPE c LENGTH 1.
|
||||
TYPES:
|
||||
BEGIN OF ty_order,
|
||||
order_id TYPE ty_order_id,
|
||||
customer TYPE ty_customer,
|
||||
duration_min TYPE i,
|
||||
status TYPE ty_status,
|
||||
END OF ty_order.
|
||||
TYPES tt_orders TYPE STANDARD TABLE OF ty_order WITH EMPTY KEY.
|
||||
TYPES:
|
||||
BEGIN OF ty_customer_total,
|
||||
customer TYPE ty_customer,
|
||||
total_min TYPE i,
|
||||
END OF ty_customer_total.
|
||||
TYPES tt_customer_totals TYPE STANDARD TABLE OF ty_customer_total WITH EMPTY KEY.
|
||||
CONSTANTS:
|
||||
BEGIN OF c_status,
|
||||
open TYPE ty_status VALUE 'O',
|
||||
closed TYPE ty_status VALUE 'C',
|
||||
END OF c_status.
|
||||
METHODS merge_orders
|
||||
IMPORTING it_intake TYPE tt_orders
|
||||
it_workshop TYPE tt_orders
|
||||
RETURNING VALUE(rt_merged) TYPE tt_orders.
|
||||
METHODS open_orders
|
||||
IMPORTING it_orders TYPE tt_orders
|
||||
RETURNING VALUE(rt_open) TYPE tt_orders.
|
||||
METHODS customer_totals
|
||||
IMPORTING it_orders TYPE tt_orders
|
||||
RETURNING VALUE(rt_totals) TYPE tt_customer_totals.
|
||||
METHODS find_order
|
||||
IMPORTING it_orders TYPE tt_orders
|
||||
iv_order_id TYPE ty_order_id
|
||||
RETURNING VALUE(rs_order) TYPE ty_order.
|
||||
ENDINTERFACE.
|
||||
77
tasks_gen/train/G1061/spec.md
Normal file
77
tasks_gen/train/G1061/spec.md
Normal file
@@ -0,0 +1,77 @@
|
||||
# 1. Goal
|
||||
A watch and clock workshop repairs customer orders. Two intake points send
|
||||
their order lists: the front desk and a partner shop. The workshop program
|
||||
needs one merged list of all orders and the total repair time of each
|
||||
customer. The class {{P}}WATCH_ORDER_POOL does this work.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The interface {{P}}IF_WATCH_ORDER exists in package $TMP. It is active.
|
||||
- The interface contains the types TY_ORDER_ID (CHAR 10), TY_CUSTOMER
|
||||
(CHAR 20), TY_STATUS (CHAR 1), TY_ORDER, TT_ORDERS, TY_CUSTOMER_TOTAL and
|
||||
TT_CUSTOMER_TOTALS. Read the interface for the exact definition.
|
||||
- TY_ORDER has the components ORDER_ID, CUSTOMER, DURATION_MIN (integer) and
|
||||
STATUS.
|
||||
- TY_CUSTOMER_TOTAL has the components CUSTOMER and TOTAL_MIN (integer).
|
||||
- The interface contains the constant structure C_STATUS with the components
|
||||
OPEN (value 'O') and CLOSED (value 'C').
|
||||
- All objects are in package $TMP.
|
||||
|
||||
# 4. Contract
|
||||
- Create the class {{P}}WATCH_ORDER_POOL in package $TMP.
|
||||
- The class is public and final. It has a public constructor without
|
||||
parameters.
|
||||
- The class implements the interface {{P}}IF_WATCH_ORDER.
|
||||
- Do not add other public methods.
|
||||
|
||||
The interface methods do these tasks:
|
||||
- merge_orders: merge the two intake lists into one order list.
|
||||
- open_orders: select the open orders of one order list.
|
||||
- customer_totals: calculate the total repair time of each customer.
|
||||
- find_order: find one order in a list by its order ID.
|
||||
|
||||
# 5. Business rules
|
||||
General:
|
||||
- An order ID is never empty. A customer name is never empty.
|
||||
- DURATION_MIN is never negative.
|
||||
|
||||
merge_orders:
|
||||
1. Read the orders of IT_INTAKE first. Then read the orders of IT_WORKSHOP.
|
||||
2. If one order ID occurs more than once, keep the first occurrence and
|
||||
ignore all later occurrences. This rule holds inside one list and across
|
||||
the two lists.
|
||||
3. The result contains all orders. The result is sorted in ascending order of
|
||||
ORDER_ID.
|
||||
|
||||
open_orders:
|
||||
1. Use the orders of IT_ORDERS.
|
||||
2. If one order ID occurs more than once, keep the first occurrence.
|
||||
3. Keep only the orders with STATUS = C_STATUS-OPEN.
|
||||
4. The result is sorted in ascending order of ORDER_ID.
|
||||
|
||||
customer_totals:
|
||||
1. Use only the orders of IT_ORDERS with STATUS = C_STATUS-OPEN.
|
||||
2. If one order ID occurs more than once, count it one time only (the first
|
||||
occurrence).
|
||||
3. Sum DURATION_MIN for each customer.
|
||||
4. The result has one row for each customer with at least one open order.
|
||||
5. The result is sorted in ascending order of CUSTOMER.
|
||||
|
||||
find_order:
|
||||
1. Search IT_ORDERS for the order with ORDER_ID = IV_ORDER_ID.
|
||||
2. If one order ID occurs more than once, return the first occurrence.
|
||||
3. If no order has this order ID, return a structure with initial components:
|
||||
ORDER_ID initial, CUSTOMER initial, DURATION_MIN = 0, STATUS initial.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
|
||||
- Coding standards: Clean ABAP. Method length below 40 statements. No global
|
||||
variables. No comment that restates the code.
|
||||
- Out of scope: do not change {{P}}IF_WATCH_ORDER.
|
||||
|
||||
# 7. Acceptance
|
||||
- The class is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write your own ABAP Unit tests for the class.
|
||||
51
tasks_gen/train/G1061/task.json
Normal file
51
tasks_gen/train/G1061/task.json
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"id": "G1061",
|
||||
"category": "C",
|
||||
"object_type": "CLAS",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "INTF",
|
||||
"name": "{{P}}IF_WATCH_ORDER",
|
||||
"file": "seed/if_watch_order.intf.abap",
|
||||
"description": "Order types, status constants and the method contract of the watch workshop"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}WATCH_ORDER_POOL",
|
||||
"implements": "{{P}}IF_WATCH_ORDER"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}IF_WATCH_ORDER"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}WATCH_ORDER_HIDDEN",
|
||||
"file": "hidden/watch_order_hidden.clas.abap",
|
||||
"description": "Hidden tests for the merged order list, the open orders, the customer totals and the order lookup"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}WATCH_ORDER_POOL",
|
||||
"file": "reference/watch_order_pool.clas.abap",
|
||||
"description": "Reference solution that works with sorted and keyed internal tables",
|
||||
"testclasses_file": "reference/watch_order_pool.testclasses.abap"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"internal_table_kind"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user