Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
57
tasks_gen/train/G1122/generation.json
Normal file
57
tasks_gen/train/G1122/generation.json
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"id": "G1122",
|
||||
"pool": "train",
|
||||
"object_type": "PROG",
|
||||
"category": "E",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"reference/porta_bill_old.prog.abap line 39: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"METHODS\"",
|
||||
"Too close to task G1090 (similarity spec 0.57, rules 0.64, names 0.20). Choose a different business topic and different object names.",
|
||||
"Too close to task G1114 (similarity spec 0.60, rules 0.61, names 0.50). Choose a different business topic and different object names."
|
||||
],
|
||||
"by_check": {
|
||||
"abaplint": 1,
|
||||
"extra": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"reference/dentlab_old.prog.abap line 88: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"DATA\"",
|
||||
"reference/dentlab_old.prog.abap line 151: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"reference/dentlab_old.prog.abap line 151: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"50\"",
|
||||
"reference/dentlab_old.prog.abap line 157: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"reference/dentlab_old.prog.abap line 157: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"50\"",
|
||||
"reference/dentlab_old.prog.abap line 163: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"reference/dentlab_old.prog.abap line 163: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"00\"",
|
||||
"Too close to task G1090 (similarity spec 0.61, rules 0.65, names 0.25). Choose a different business topic and different object names.",
|
||||
"Too close to task G1114 (similarity spec 0.60, rules 0.60, names 0.25). Choose a different business topic and different object names."
|
||||
],
|
||||
"by_check": {
|
||||
"abaplint": 7,
|
||||
"extra": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"reference/rescue_log_old.prog.abap line 119: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"DATA\"",
|
||||
"Too close to task G0142 (similarity spec 0.56, rules 0.64, names 0.20). Choose a different business topic and different object names.",
|
||||
"Too close to task G1090 (similarity spec 0.55, rules 0.66, names 0.20). Choose a different business topic and different object names.",
|
||||
"Too close to task G1114 (similarity spec 0.53, rules 0.60, names 0.20). Choose a different business topic and different object names."
|
||||
],
|
||||
"by_check": {
|
||||
"abaplint": 1,
|
||||
"extra": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 0,
|
||||
"null": 0
|
||||
}
|
||||
],
|
||||
"accepted": false
|
||||
}
|
||||
148
tasks_gen/train/G1122/hidden/ext_hidden.clas.abap
Normal file
148
tasks_gen/train/G1122/hidden/ext_hidden.clas.abap
Normal file
@@ -0,0 +1,148 @@
|
||||
CLASS {{p}}ext_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
TYPES ty_flag TYPE c LENGTH 1.
|
||||
TYPES tt_site TYPE RANGE OF {{p}}exting-site.
|
||||
METHODS run
|
||||
IMPORTING iv_from TYPE d
|
||||
iv_to TYPE d
|
||||
it_site TYPE tt_site OPTIONAL
|
||||
iv_defect TYPE ty_flag OPTIONAL
|
||||
RETURNING VALUE(rr_data) TYPE REF TO data.
|
||||
METHODS value_of
|
||||
IMPORTING ir_data TYPE REF TO data
|
||||
iv_row TYPE i
|
||||
iv_col TYPE string
|
||||
RETURNING VALUE(rv_value) TYPE string.
|
||||
METHODS lines_of
|
||||
IMPORTING ir_data TYPE REF TO data
|
||||
RETURNING VALUE(rv_lines) TYPE i.
|
||||
METHODS all_rows FOR TESTING.
|
||||
METHODS sorted_by_urgency FOR TESTING.
|
||||
METHODS date_filter FOR TESTING.
|
||||
METHODS date_bounds FOR TESTING.
|
||||
METHODS site_filter FOR TESTING.
|
||||
METHODS defect_only FOR TESTING.
|
||||
METHODS co2_replace FOR TESTING.
|
||||
METHODS refill_boundary FOR TESTING.
|
||||
METHODS pressure_service FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}ext_hidden IMPLEMENTATION.
|
||||
METHOD run.
|
||||
cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ).
|
||||
SUBMIT {{p}}ext_check_old
|
||||
WITH p_from = iv_from
|
||||
WITH p_to = iv_to
|
||||
WITH s_site IN it_site
|
||||
WITH p_defect = iv_defect
|
||||
AND RETURN.
|
||||
TRY.
|
||||
cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = rr_data ).
|
||||
CATCH cx_salv_bs_sc_runtime_info.
|
||||
ENDTRY.
|
||||
cl_salv_bs_runtime_info=>clear_all( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lines_of.
|
||||
FIELD-SYMBOLS <lt_data> TYPE STANDARD TABLE.
|
||||
IF ir_data IS BOUND.
|
||||
ASSIGN ir_data->* TO <lt_data>.
|
||||
rv_lines = lines( <lt_data> ).
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD value_of.
|
||||
FIELD-SYMBOLS <lt_data> TYPE STANDARD TABLE.
|
||||
ASSIGN ir_data->* TO <lt_data>.
|
||||
ASSIGN <lt_data>[ iv_row ] TO FIELD-SYMBOL(<ls_line>).
|
||||
ASSIGN COMPONENT iv_col OF STRUCTURE <ls_line> TO FIELD-SYMBOL(<lv_value>).
|
||||
cl_abap_unit_assert=>assert_subrc( exp = 0 msg = |Column { iv_col } missing| ).
|
||||
rv_value = condense( CONV string( <lv_value> ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD all_rows.
|
||||
DATA(lr_data) = run( iv_from = '20251201' iv_to = '20260331' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 7 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `EXT_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `REPLACE` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `STATE` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `7` act = value_of( ir_data = lr_data iv_row = 7 iv_col = `EXT_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `OK` act = value_of( ir_data = lr_data iv_row = 7 iv_col = `STATE` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sorted_by_urgency.
|
||||
DATA(lr_data) = run( iv_from = '20251201' iv_to = '20260331' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `EXT_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `5` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `EXT_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `2` act = value_of( ir_data = lr_data iv_row = 3 iv_col = `EXT_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `6` act = value_of( ir_data = lr_data iv_row = 4 iv_col = `EXT_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `3` act = value_of( ir_data = lr_data iv_row = 5 iv_col = `EXT_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `URGENCY` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `4` act = value_of( ir_data = lr_data iv_row = 7 iv_col = `URGENCY` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD date_filter.
|
||||
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `EXT_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `2` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `EXT_ID` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD date_bounds.
|
||||
DATA(lr_data) = run( iv_from = '20251228' iv_to = '20251228' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `7` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `EXT_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `OK` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `STATE` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD site_filter.
|
||||
DATA(lr_data) = run( iv_from = '20251201' iv_to = '20260331'
|
||||
it_site = VALUE #( ( sign = 'I' option = 'EQ' low = 'W2' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `3` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `EXT_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `SHORT` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `STATE` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `4` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `EXT_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `OK` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `STATE` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD defect_only.
|
||||
DATA(lr_data) = run( iv_from = '20251201' iv_to = '20260331' iv_defect = 'X' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 5 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `EXT_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `3` act = value_of( ir_data = lr_data iv_row = 5 iv_col = `EXT_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `SHORT` act = value_of( ir_data = lr_data iv_row = 5 iv_col = `STATE` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD co2_replace.
|
||||
DATA(lr_data) = run( iv_from = '20251201' iv_to = '20260331'
|
||||
it_site = VALUE #( ( sign = 'I' option = 'EQ' low = 'W1' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `CO2` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `EXT_TYPE` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `3500` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `WEIGHT_G` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `REPLACE` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `STATE` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `SERVICE` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `STATE` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `8` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `PRESSURE_BAR` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD refill_boundary.
|
||||
DATA(lr_data) = run( iv_from = '20251201' iv_to = '20260331'
|
||||
it_site = VALUE #( ( sign = 'I' option = 'EQ' low = 'W3' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `5` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `EXT_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `3999` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `WEIGHT_G` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `REFILL` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `STATE` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `7` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `EXT_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `4000` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `WEIGHT_G` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `OK` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `STATE` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD pressure_service.
|
||||
DATA(lr_data) = run( iv_from = '20251201' iv_to = '20260331'
|
||||
it_site = VALUE #( ( sign = 'I' option = 'EQ' low = 'W4' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `9` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `PRESSURE_BAR` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `SERVICE` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `STATE` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `2` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `URGENCY` ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
39
tasks_gen/train/G1122/mutation.json
Normal file
39
tasks_gen/train/G1122/mutation.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"task": "T15",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}EXT_CHECK_OLD",
|
||||
"mutant": "weight threshold: < 4000 -> <= 4000 (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "8/9",
|
||||
"failed_tests": [
|
||||
"refill_boundary"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}EXT_CHECK_OLD",
|
||||
"mutant": "sort: urgency ASCENDING -> DESCENDING (sort)",
|
||||
"status": "killed",
|
||||
"hidden": "5/9",
|
||||
"failed_tests": [
|
||||
"sorted_by_urgency",
|
||||
"site_filter",
|
||||
"defect_only",
|
||||
"date_filter"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}EXT_CHECK_OLD",
|
||||
"mutant": "defect filter: urgency = 4 -> urgency <> 4 (logic)",
|
||||
"status": "killed",
|
||||
"hidden": "8/9",
|
||||
"failed_tests": [
|
||||
"defect_only"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 3,
|
||||
"killed": 3,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
209
tasks_gen/train/G1122/reference/ext_check_old.prog.abap
Normal file
209
tasks_gen/train/G1122/reference/ext_check_old.prog.abap
Normal file
@@ -0,0 +1,209 @@
|
||||
REPORT {{p}}ext_check_old.
|
||||
|
||||
DATA gv_site TYPE {{p}}exting-site.
|
||||
|
||||
PARAMETERS: p_from TYPE d OBLIGATORY,
|
||||
p_to TYPE d OBLIGATORY.
|
||||
|
||||
SELECT-OPTIONS: s_site FOR gv_site.
|
||||
|
||||
PARAMETERS p_defect AS CHECKBOX.
|
||||
|
||||
CLASS lcl_check DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
TYPES ty_state TYPE c LENGTH 7.
|
||||
TYPES ty_urgency TYPE i.
|
||||
TYPES:
|
||||
BEGIN OF ty_line,
|
||||
ext_id TYPE {{p}}exting-ext_id,
|
||||
site TYPE {{p}}exting-site,
|
||||
ext_type TYPE {{p}}exting-ext_type,
|
||||
weight_g TYPE i,
|
||||
pressure_bar TYPE i,
|
||||
state TYPE ty_state,
|
||||
urgency TYPE ty_urgency,
|
||||
END OF ty_line,
|
||||
tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY,
|
||||
tt_site TYPE RANGE OF {{p}}exting-site.
|
||||
METHODS collect
|
||||
IMPORTING iv_from TYPE d
|
||||
iv_to TYPE d
|
||||
it_site TYPE tt_site
|
||||
iv_defect_only TYPE abap_bool
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
METHODS display
|
||||
CHANGING ct_lines TYPE tt_line.
|
||||
PRIVATE SECTION.
|
||||
TYPES tt_ext TYPE STANDARD TABLE OF {{p}}exting WITH EMPTY KEY.
|
||||
METHODS select_checks
|
||||
IMPORTING iv_from TYPE d
|
||||
iv_to TYPE d
|
||||
it_site TYPE tt_site
|
||||
RETURNING VALUE(rt_ext) TYPE tt_ext.
|
||||
METHODS to_line
|
||||
IMPORTING is_ext TYPE {{p}}exting
|
||||
RETURNING VALUE(rs_line) TYPE ty_line.
|
||||
METHODS state_of
|
||||
IMPORTING is_ext TYPE {{p}}exting
|
||||
RETURNING VALUE(rv_state) TYPE ty_state.
|
||||
METHODS urgency_of
|
||||
IMPORTING is_ext TYPE {{p}}exting
|
||||
RETURNING VALUE(rv_urgency) TYPE ty_urgency.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_check IMPLEMENTATION.
|
||||
METHOD collect.
|
||||
DATA lt_lines TYPE tt_line.
|
||||
DATA lt_ext TYPE tt_ext.
|
||||
DATA ls_ext TYPE {{p}}exting.
|
||||
lt_ext = select_checks( iv_from = iv_from iv_to = iv_to it_site = it_site ).
|
||||
LOOP AT lt_ext INTO ls_ext.
|
||||
IF iv_defect_only = abap_true AND urgency_of( ls_ext ) = 4.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
APPEND to_line( ls_ext ) TO lt_lines.
|
||||
ENDLOOP.
|
||||
SORT lt_lines BY urgency ASCENDING ext_id ASCENDING.
|
||||
rt_lines = lt_lines.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD select_checks.
|
||||
SELECT ext_id, site, ext_type, weight_g, pressure_bar, last_check, next_check
|
||||
FROM {{p}}exting
|
||||
WHERE last_check >= @iv_from
|
||||
AND last_check <= @iv_to
|
||||
AND site IN @it_site
|
||||
INTO TABLE @rt_ext.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD to_line.
|
||||
rs_line-ext_id = is_ext-ext_id.
|
||||
rs_line-site = is_ext-site.
|
||||
rs_line-ext_type = is_ext-ext_type.
|
||||
rs_line-weight_g = is_ext-weight_g.
|
||||
rs_line-pressure_bar = is_ext-pressure_bar.
|
||||
rs_line-state = state_of( is_ext ).
|
||||
rs_line-urgency = urgency_of( is_ext ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD state_of.
|
||||
IF is_ext-weight_g < 4000.
|
||||
IF is_ext-ext_type = 'CO2'.
|
||||
rv_state = 'REPLACE'.
|
||||
ELSE.
|
||||
rv_state = 'REFILL'.
|
||||
ENDIF.
|
||||
ELSEIF is_ext-pressure_bar < 10.
|
||||
rv_state = 'SERVICE'.
|
||||
ELSEIF is_ext-next_check - is_ext-last_check < 300.
|
||||
rv_state = 'SHORT'.
|
||||
ELSE.
|
||||
rv_state = 'OK'.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD urgency_of.
|
||||
CASE state_of( is_ext ).
|
||||
WHEN 'REPLACE' OR 'REFILL'.
|
||||
rv_urgency = 1.
|
||||
WHEN 'SERVICE'.
|
||||
rv_urgency = 2.
|
||||
WHEN 'SHORT'.
|
||||
rv_urgency = 3.
|
||||
WHEN OTHERS.
|
||||
rv_urgency = 4.
|
||||
ENDCASE.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD display.
|
||||
DATA lo_alv TYPE REF TO cl_salv_table.
|
||||
DATA lx_error TYPE REF TO cx_salv_msg.
|
||||
TRY.
|
||||
cl_salv_table=>factory( IMPORTING r_salv_table = lo_alv
|
||||
CHANGING t_table = ct_lines ).
|
||||
lo_alv->display( ).
|
||||
CATCH cx_salv_msg INTO lx_error.
|
||||
MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
||||
START-OF-SELECTION.
|
||||
DATA lv_defect_only TYPE abap_bool.
|
||||
DATA go_check TYPE REF TO lcl_check.
|
||||
DATA gt_lines TYPE lcl_check=>tt_line.
|
||||
IF p_defect = 'X'.
|
||||
lv_defect_only = abap_true.
|
||||
ENDIF.
|
||||
CREATE OBJECT go_check.
|
||||
gt_lines = go_check->collect( iv_from = p_from
|
||||
iv_to = p_to
|
||||
it_site = s_site[]
|
||||
iv_defect_only = lv_defect_only ).
|
||||
go_check->display( CHANGING ct_lines = gt_lines ).
|
||||
|
||||
CLASS ltc_check DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
CLASS-DATA go_env TYPE REF TO if_osql_test_environment.
|
||||
CLASS-METHODS class_setup.
|
||||
CLASS-METHODS class_teardown.
|
||||
METHODS states_in_order FOR TESTING.
|
||||
METHODS defect_filter FOR TESTING.
|
||||
METHODS date_range FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltc_check IMPLEMENTATION.
|
||||
METHOD class_setup.
|
||||
go_env = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '{{P}}EXTING' ) ) ).
|
||||
DATA lt_ext TYPE STANDARD TABLE OF {{p}}exting WITH EMPTY KEY.
|
||||
lt_ext = VALUE #(
|
||||
( ext_id = 1 site = 'A' ext_type = 'CO2' weight_g = 3000 pressure_bar = 15 last_check = '20260101' next_check = '20270101' )
|
||||
( ext_id = 2 site = 'A' ext_type = 'PW' weight_g = 6000 pressure_bar = 8 last_check = '20260102' next_check = '20270102' )
|
||||
( ext_id = 3 site = 'B' ext_type = 'PW' weight_g = 5000 pressure_bar = 12 last_check = '20260103' next_check = '20260120' )
|
||||
( ext_id = 4 site = 'B' ext_type = 'PW' weight_g = 5000 pressure_bar = 12 last_check = '20260104' next_check = '20270104' ) ).
|
||||
go_env->insert_test_data( lt_ext ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD states_in_order.
|
||||
DATA lo_check TYPE REF TO lcl_check.
|
||||
DATA lt_lines TYPE lcl_check=>tt_line.
|
||||
CREATE OBJECT lo_check.
|
||||
lt_lines = lo_check->collect( iv_from = '20260101'
|
||||
iv_to = '20261231'
|
||||
it_site = VALUE #( )
|
||||
iv_defect_only = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 4 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'REPLACE' act = lt_lines[ 1 ]-state ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'SERVICE' act = lt_lines[ 2 ]-state ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'SHORT' act = lt_lines[ 3 ]-state ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'OK' act = lt_lines[ 4 ]-state ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD defect_filter.
|
||||
DATA lo_check TYPE REF TO lcl_check.
|
||||
DATA lt_lines TYPE lcl_check=>tt_line.
|
||||
CREATE OBJECT lo_check.
|
||||
lt_lines = lo_check->collect( iv_from = '20260101'
|
||||
iv_to = '20261231'
|
||||
it_site = VALUE #( )
|
||||
iv_defect_only = abap_true ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'SHORT' act = lt_lines[ 3 ]-state ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD date_range.
|
||||
DATA lo_check TYPE REF TO lcl_check.
|
||||
DATA lt_lines TYPE lcl_check=>tt_line.
|
||||
CREATE OBJECT lo_check.
|
||||
lt_lines = lo_check->collect( iv_from = '20260103'
|
||||
iv_to = '20260103'
|
||||
it_site = VALUE #( )
|
||||
iv_defect_only = abap_false ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_lines[ 1 ]-ext_id ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
80
tasks_gen/train/G1122/seed/ext_check_old.prog.abap
Normal file
80
tasks_gen/train/G1122/seed/ext_check_old.prog.abap
Normal file
@@ -0,0 +1,80 @@
|
||||
REPORT {{p}}ext_check_old.
|
||||
|
||||
DATA gv_site TYPE {{p}}exting-site.
|
||||
|
||||
PARAMETERS: p_from TYPE d OBLIGATORY,
|
||||
p_to TYPE d OBLIGATORY.
|
||||
|
||||
SELECT-OPTIONS: s_site FOR gv_site.
|
||||
|
||||
PARAMETERS p_defect AS CHECKBOX.
|
||||
|
||||
TYPES: BEGIN OF ty_line,
|
||||
ext_id TYPE {{p}}exting-ext_id,
|
||||
site TYPE {{p}}exting-site,
|
||||
ext_type TYPE {{p}}exting-ext_type,
|
||||
weight_g TYPE i,
|
||||
pressure_bar TYPE i,
|
||||
state TYPE c LENGTH 7,
|
||||
urgency TYPE i,
|
||||
END OF ty_line.
|
||||
|
||||
DATA: gt_lines TYPE STANDARD TABLE OF ty_line WITH DEFAULT KEY,
|
||||
gs_line TYPE ty_line,
|
||||
lt_ext TYPE STANDARD TABLE OF {{p}}exting,
|
||||
ls_ext TYPE {{p}}exting,
|
||||
lv_state TYPE c LENGTH 7,
|
||||
lv_prio TYPE i,
|
||||
lo_alv TYPE REF TO cl_salv_table.
|
||||
|
||||
START-OF-SELECTION.
|
||||
|
||||
SELECT * FROM {{p}}exting INTO TABLE lt_ext.
|
||||
|
||||
LOOP AT lt_ext INTO ls_ext.
|
||||
IF ls_ext-last_check >= p_from AND ls_ext-last_check <= p_to
|
||||
AND ls_ext-site IN s_site.
|
||||
IF ls_ext-weight_g < 4000.
|
||||
IF ls_ext-ext_type = 'CO2'.
|
||||
lv_state = 'REPLACE'.
|
||||
ELSE.
|
||||
lv_state = 'REFILL'.
|
||||
ENDIF.
|
||||
lv_prio = 1.
|
||||
ELSEIF ls_ext-pressure_bar < 10.
|
||||
lv_state = 'SERVICE'.
|
||||
lv_prio = 2.
|
||||
ELSEIF ls_ext-next_check - ls_ext-last_check < 300.
|
||||
lv_state = 'SHORT'.
|
||||
lv_prio = 3.
|
||||
ELSE.
|
||||
lv_state = 'OK'.
|
||||
lv_prio = 4.
|
||||
ENDIF.
|
||||
IF p_defect = 'X' AND lv_prio = 4.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
CLEAR gs_line.
|
||||
gs_line-ext_id = ls_ext-ext_id.
|
||||
gs_line-site = ls_ext-site.
|
||||
gs_line-ext_type = ls_ext-ext_type.
|
||||
gs_line-weight_g = ls_ext-weight_g.
|
||||
gs_line-pressure_bar = ls_ext-pressure_bar.
|
||||
gs_line-state = lv_state.
|
||||
gs_line-urgency = lv_prio.
|
||||
APPEND gs_line TO gt_lines.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
SORT gt_lines BY urgency ASCENDING ext_id ASCENDING.
|
||||
|
||||
PERFORM display_alv.
|
||||
|
||||
FORM display_alv.
|
||||
TRY.
|
||||
cl_salv_table=>factory( IMPORTING r_salv_table = lo_alv
|
||||
CHANGING t_table = gt_lines ).
|
||||
lo_alv->display( ).
|
||||
CATCH cx_salv_msg.
|
||||
ENDTRY.
|
||||
ENDFORM.
|
||||
19
tasks_gen/train/G1122/seed/ext_seed.clas.abap
Normal file
19
tasks_gen/train/G1122/seed/ext_seed.clas.abap
Normal file
@@ -0,0 +1,19 @@
|
||||
CLASS {{p}}ext_seed DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES if_oo_adt_classrun.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS {{p}}ext_seed IMPLEMENTATION.
|
||||
METHOD if_oo_adt_classrun~main.
|
||||
DELETE FROM {{p}}exting.
|
||||
INSERT {{p}}exting FROM TABLE @( VALUE #(
|
||||
( ext_id = 1 site = 'W1' ext_type = 'CO2' weight_g = 3500 pressure_bar = 15 last_check = '20260105' next_check = '20270105' )
|
||||
( ext_id = 2 site = 'W1' ext_type = 'PW' weight_g = 6000 pressure_bar = 8 last_check = '20260120' next_check = '20270120' )
|
||||
( ext_id = 3 site = 'W2' ext_type = 'PW' weight_g = 9000 pressure_bar = 14 last_check = '20260201' next_check = '20260501' )
|
||||
( ext_id = 4 site = 'W2' ext_type = 'CO2' weight_g = 5000 pressure_bar = 10 last_check = '20260215' next_check = '20270215' )
|
||||
( ext_id = 5 site = 'W3' ext_type = 'PW' weight_g = 3999 pressure_bar = 13 last_check = '20260301' next_check = '20270301' )
|
||||
( ext_id = 6 site = 'W4' ext_type = 'CO2' weight_g = 7000 pressure_bar = 9 last_check = '20251220' next_check = '20261220' )
|
||||
( ext_id = 7 site = 'W3' ext_type = 'PW' weight_g = 4000 pressure_bar = 11 last_check = '20251228' next_check = '20261024' ) ) ).
|
||||
out->write( sy-dbcnt ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
15
tasks_gen/train/G1122/seed/exting.tabl.asabap
Normal file
15
tasks_gen/train/G1122/seed/exting.tabl.asabap
Normal file
@@ -0,0 +1,15 @@
|
||||
@EndUserText.label : 'Fire extinguishers'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}exting {
|
||||
key client : abap.clnt not null;
|
||||
key ext_id : abap.int4 not null;
|
||||
site : abap.char(6);
|
||||
ext_type : abap.char(2);
|
||||
weight_g : abap.int4;
|
||||
pressure_bar : abap.int4;
|
||||
last_check : abap.dats;
|
||||
next_check : abap.dats;
|
||||
}
|
||||
47
tasks_gen/train/G1122/spec.md
Normal file
47
tasks_gen/train/G1122/spec.md
Normal file
@@ -0,0 +1,47 @@
|
||||
# 1. Goal
|
||||
A safety-services company inspects fire extinguishers at customer sites. The
|
||||
inspection office runs the report {{P}}EXT_CHECK_OLD in package $TMP to see which
|
||||
extinguishers need attention. The report works, but the source is a legacy
|
||||
tangle. Rewrite the source so that a colleague can read it and change it. The
|
||||
observable behavior of the report must not change.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- {{P}}EXT_CHECK_OLD is an executable program in package $TMP. It is active.
|
||||
- {{P}}EXTING is a database table in package $TMP with the inspection master
|
||||
data: EXT_ID (INT4, key), SITE (CHAR 6), EXT_TYPE (CHAR 2), WEIGHT_G (INT4),
|
||||
PRESSURE_BAR (INT4), LAST_CHECK (DATS), NEXT_CHECK (DATS).
|
||||
- The program reads the table and writes one output line for each extinguisher.
|
||||
|
||||
# 4. Contract
|
||||
- Keep the program name {{P}}EXT_CHECK_OLD and the package $TMP.
|
||||
- Keep the selection screen unchanged:
|
||||
- P_FROM, type DATS, obligatory.
|
||||
- P_TO, type DATS, obligatory.
|
||||
- S_SITE, select-option for SITE.
|
||||
- P_DEFECT, checkbox.
|
||||
- The output is an ALV list (CL_SALV_TABLE). One output line has the columns
|
||||
EXT_ID, SITE, EXT_TYPE, WEIGHT_G, PRESSURE_BAR, STATE and URGENCY.
|
||||
- No other public name of the program changes.
|
||||
|
||||
# 5. Business rules
|
||||
The present source of {{P}}EXT_CHECK_OLD defines the rules. Read that source
|
||||
before you change anything. Every rule stays in force: the selection logic, the
|
||||
special cases, the values of the columns STATE and URGENCY, and the order of the
|
||||
output lines.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 7.58.
|
||||
- Coding standards: Clean ABAP. Split the logic into small methods with clear
|
||||
names. No method has 40 statements or more. Read the database with a single
|
||||
SELECT. Do not use obsolete language elements.
|
||||
- Out of scope: do not change the table {{P}}EXTING and the seed class
|
||||
{{P}}EXT_SEED.
|
||||
|
||||
# 7. Acceptance
|
||||
- The program is active and free of syntax errors.
|
||||
- The output is identical to the output before the change.
|
||||
- The hidden tests pass.
|
||||
- Add ABAP Unit tests as local test classes in the program.
|
||||
70
tasks_gen/train/G1122/task.json
Normal file
70
tasks_gen/train/G1122/task.json
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"id": "G1122",
|
||||
"category": "E",
|
||||
"object_type": "PROG",
|
||||
"difficulty": 2,
|
||||
"release_target": "v758",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 70,
|
||||
"max_activations": 18
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "TABL",
|
||||
"name": "{{P}}EXTING",
|
||||
"file": "seed/exting.tabl.asabap",
|
||||
"description": "Fire extinguishers and their inspection data"
|
||||
},
|
||||
{
|
||||
"type": "PROG",
|
||||
"name": "{{P}}EXT_CHECK_OLD",
|
||||
"file": "seed/ext_check_old.prog.abap",
|
||||
"description": "Legacy inspection report of the safety-services company"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}EXT_SEED",
|
||||
"file": "seed/ext_seed.clas.abap",
|
||||
"description": "Seed data for the fire extinguishers",
|
||||
"run": true
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "PROG",
|
||||
"name": "{{P}}EXT_CHECK_OLD",
|
||||
"parameters": [
|
||||
"p_from",
|
||||
"p_to",
|
||||
"s_site",
|
||||
"p_defect"
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}EXTING",
|
||||
"{{P}}EXT_SEED"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}EXT_HIDDEN",
|
||||
"file": "hidden/ext_hidden.clas.abap",
|
||||
"description": "Hidden tests for the refactored inspection report"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "PROG",
|
||||
"name": "{{P}}EXT_CHECK_OLD",
|
||||
"file": "reference/ext_check_old.prog.abap",
|
||||
"description": "Refactored inspection report"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"nesting_depth",
|
||||
"db_operation_in_loop"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user