ADT fallback: Accept headers for FUNC; G0189 accepted; regen2 results
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
17
tasks_gen/eval/G0124/empirical.json
Normal file
17
tasks_gen/eval/G0124/empirical.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"deepseek-v4.1-flash:cloud": {
|
||||
"score": 0,
|
||||
"parts": {
|
||||
"total": 0,
|
||||
"failed_gates": [
|
||||
"G1_active",
|
||||
"G2_contract",
|
||||
"G3_hidden_runs"
|
||||
]
|
||||
},
|
||||
"hidden": "0/0",
|
||||
"tool_calls": 60,
|
||||
"seconds": 318.4,
|
||||
"run_dir": "runs/emp/11009_G0124_llm_deepseek-v4.1-flash_cloud"
|
||||
}
|
||||
}
|
||||
127
tasks_gen/eval/G0124/faulty/m0_fleet_dist.prog.abap
Normal file
127
tasks_gen/eval/G0124/faulty/m0_fleet_dist.prog.abap
Normal file
@@ -0,0 +1,127 @@
|
||||
REPORT {{p}}fleet_dist.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_line,
|
||||
veh_id TYPE {{p}}veh-veh_id,
|
||||
depot TYPE {{p}}veh-depot,
|
||||
distance TYPE i,
|
||||
readings TYPE i,
|
||||
END OF ty_line,
|
||||
tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY,
|
||||
tt_depot TYPE RANGE OF {{p}}veh-depot.
|
||||
|
||||
DATA gv_depot TYPE {{p}}veh-depot.
|
||||
|
||||
PARAMETERS p_from TYPE d OBLIGATORY.
|
||||
PARAMETERS p_to TYPE d OBLIGATORY.
|
||||
SELECT-OPTIONS s_depot FOR gv_depot.
|
||||
|
||||
CLASS lcl_report DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
METHODS select_distances
|
||||
IMPORTING iv_from TYPE d
|
||||
iv_to TYPE d
|
||||
it_depot TYPE tt_depot
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
METHODS display
|
||||
CHANGING ct_lines TYPE tt_line.
|
||||
PRIVATE SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_raw,
|
||||
veh_id TYPE {{p}}veh-veh_id,
|
||||
depot TYPE {{p}}veh-depot,
|
||||
max_odo TYPE {{p}}odom-odometer,
|
||||
min_odo TYPE {{p}}odom-odometer,
|
||||
readings TYPE i,
|
||||
END OF ty_raw,
|
||||
tt_raw TYPE STANDARD TABLE OF ty_raw WITH EMPTY KEY.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_report IMPLEMENTATION.
|
||||
METHOD select_distances.
|
||||
DATA lt_raw TYPE tt_raw.
|
||||
SELECT v~veh_id, v~depot, MAX( o~odometer ) AS max_odo, MIN( o~odometer ) AS min_odo,
|
||||
COUNT( * ) AS readings
|
||||
FROM {{p}}veh AS v
|
||||
INNER JOIN {{p}}odom AS o ON o~veh_id = v~veh_id
|
||||
WHERE o~read_date >= @iv_from
|
||||
OR o~read_date <= @iv_to
|
||||
AND v~depot IN @it_depot
|
||||
GROUP BY v~veh_id, v~depot
|
||||
HAVING COUNT( * ) >= 2
|
||||
INTO CORRESPONDING FIELDS OF TABLE @lt_raw.
|
||||
LOOP AT lt_raw ASSIGNING FIELD-SYMBOL(<ls_raw>).
|
||||
APPEND VALUE #( veh_id = <ls_raw>-veh_id
|
||||
depot = <ls_raw>-depot
|
||||
distance = <ls_raw>-max_odo - <ls_raw>-min_odo
|
||||
readings = <ls_raw>-readings ) TO rt_lines.
|
||||
ENDLOOP.
|
||||
SORT rt_lines BY distance DESCENDING veh_id ASCENDING.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD display.
|
||||
TRY.
|
||||
cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv)
|
||||
CHANGING t_table = ct_lines ).
|
||||
lo_alv->display( ).
|
||||
CATCH cx_salv_msg INTO DATA(lx_error).
|
||||
MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
||||
START-OF-SELECTION.
|
||||
DATA(go_report) = NEW lcl_report( ).
|
||||
DATA(gt_lines) = go_report->select_distances( iv_from = p_from iv_to = p_to it_depot = s_depot[] ).
|
||||
go_report->display( CHANGING ct_lines = gt_lines ).
|
||||
|
||||
CLASS ltc_report 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 distances_per_vehicle FOR TESTING.
|
||||
METHODS depot_filter FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltc_report IMPLEMENTATION.
|
||||
METHOD class_setup.
|
||||
go_env = cl_osql_test_environment=>create(
|
||||
i_dependency_list = VALUE #( ( '{{P}}VEH' ) ( '{{P}}ODOM' ) ) ).
|
||||
DATA lt_veh TYPE STANDARD TABLE OF {{p}}veh WITH EMPTY KEY.
|
||||
lt_veh = VALUE #( ( veh_id = 'V1' depot = 'D1' )
|
||||
( veh_id = 'V2' depot = 'D2' )
|
||||
( veh_id = 'V3' depot = 'D2' ) ).
|
||||
go_env->insert_test_data( lt_veh ).
|
||||
DATA lt_odom TYPE STANDARD TABLE OF {{p}}odom WITH EMPTY KEY.
|
||||
lt_odom = VALUE #( ( read_id = 1 veh_id = 'V1' read_date = '20260101' odometer = 100 )
|
||||
( read_id = 2 veh_id = 'V1' read_date = '20260110' odometer = 400 )
|
||||
( read_id = 3 veh_id = 'V2' read_date = '20260105' odometer = 50 )
|
||||
( read_id = 4 veh_id = 'V3' read_date = '20260102' odometer = 200 )
|
||||
( read_id = 5 veh_id = 'V3' read_date = '20260112' odometer = 500 )
|
||||
( read_id = 6 veh_id = 'V3' read_date = '20260122' odometer = 900 ) ).
|
||||
go_env->insert_test_data( lt_odom ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD distances_per_vehicle.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_distances(
|
||||
iv_from = '20260101' iv_to = '20260131' it_depot = VALUE #( ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 700 act = lt_lines[ 1 ]-distance ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_lines[ 1 ]-readings ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 300 act = lt_lines[ 2 ]-distance ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD depot_filter.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_distances(
|
||||
iv_from = '20260101' iv_to = '20260131'
|
||||
it_depot = VALUE #( ( sign = 'I' option = 'EQ' low = 'D2' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
127
tasks_gen/eval/G0124/faulty/m1_fleet_dist.prog.abap
Normal file
127
tasks_gen/eval/G0124/faulty/m1_fleet_dist.prog.abap
Normal file
@@ -0,0 +1,127 @@
|
||||
REPORT {{p}}fleet_dist.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_line,
|
||||
veh_id TYPE {{p}}veh-veh_id,
|
||||
depot TYPE {{p}}veh-depot,
|
||||
distance TYPE i,
|
||||
readings TYPE i,
|
||||
END OF ty_line,
|
||||
tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY,
|
||||
tt_depot TYPE RANGE OF {{p}}veh-depot.
|
||||
|
||||
DATA gv_depot TYPE {{p}}veh-depot.
|
||||
|
||||
PARAMETERS p_from TYPE d OBLIGATORY.
|
||||
PARAMETERS p_to TYPE d OBLIGATORY.
|
||||
SELECT-OPTIONS s_depot FOR gv_depot.
|
||||
|
||||
CLASS lcl_report DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
METHODS select_distances
|
||||
IMPORTING iv_from TYPE d
|
||||
iv_to TYPE d
|
||||
it_depot TYPE tt_depot
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
METHODS display
|
||||
CHANGING ct_lines TYPE tt_line.
|
||||
PRIVATE SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_raw,
|
||||
veh_id TYPE {{p}}veh-veh_id,
|
||||
depot TYPE {{p}}veh-depot,
|
||||
max_odo TYPE {{p}}odom-odometer,
|
||||
min_odo TYPE {{p}}odom-odometer,
|
||||
readings TYPE i,
|
||||
END OF ty_raw,
|
||||
tt_raw TYPE STANDARD TABLE OF ty_raw WITH EMPTY KEY.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_report IMPLEMENTATION.
|
||||
METHOD select_distances.
|
||||
DATA lt_raw TYPE tt_raw.
|
||||
SELECT v~veh_id, v~depot, MAX( o~odometer ) AS max_odo, MIN( o~odometer ) AS min_odo,
|
||||
COUNT( * ) AS readings
|
||||
FROM {{p}}veh AS v
|
||||
INNER JOIN {{p}}odom AS o ON o~veh_id = v~veh_id
|
||||
WHERE o~read_date >= @iv_from
|
||||
AND o~read_date <= @iv_to
|
||||
OR v~depot IN @it_depot
|
||||
GROUP BY v~veh_id, v~depot
|
||||
HAVING COUNT( * ) >= 2
|
||||
INTO CORRESPONDING FIELDS OF TABLE @lt_raw.
|
||||
LOOP AT lt_raw ASSIGNING FIELD-SYMBOL(<ls_raw>).
|
||||
APPEND VALUE #( veh_id = <ls_raw>-veh_id
|
||||
depot = <ls_raw>-depot
|
||||
distance = <ls_raw>-max_odo - <ls_raw>-min_odo
|
||||
readings = <ls_raw>-readings ) TO rt_lines.
|
||||
ENDLOOP.
|
||||
SORT rt_lines BY distance DESCENDING veh_id ASCENDING.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD display.
|
||||
TRY.
|
||||
cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv)
|
||||
CHANGING t_table = ct_lines ).
|
||||
lo_alv->display( ).
|
||||
CATCH cx_salv_msg INTO DATA(lx_error).
|
||||
MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
||||
START-OF-SELECTION.
|
||||
DATA(go_report) = NEW lcl_report( ).
|
||||
DATA(gt_lines) = go_report->select_distances( iv_from = p_from iv_to = p_to it_depot = s_depot[] ).
|
||||
go_report->display( CHANGING ct_lines = gt_lines ).
|
||||
|
||||
CLASS ltc_report 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 distances_per_vehicle FOR TESTING.
|
||||
METHODS depot_filter FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltc_report IMPLEMENTATION.
|
||||
METHOD class_setup.
|
||||
go_env = cl_osql_test_environment=>create(
|
||||
i_dependency_list = VALUE #( ( '{{P}}VEH' ) ( '{{P}}ODOM' ) ) ).
|
||||
DATA lt_veh TYPE STANDARD TABLE OF {{p}}veh WITH EMPTY KEY.
|
||||
lt_veh = VALUE #( ( veh_id = 'V1' depot = 'D1' )
|
||||
( veh_id = 'V2' depot = 'D2' )
|
||||
( veh_id = 'V3' depot = 'D2' ) ).
|
||||
go_env->insert_test_data( lt_veh ).
|
||||
DATA lt_odom TYPE STANDARD TABLE OF {{p}}odom WITH EMPTY KEY.
|
||||
lt_odom = VALUE #( ( read_id = 1 veh_id = 'V1' read_date = '20260101' odometer = 100 )
|
||||
( read_id = 2 veh_id = 'V1' read_date = '20260110' odometer = 400 )
|
||||
( read_id = 3 veh_id = 'V2' read_date = '20260105' odometer = 50 )
|
||||
( read_id = 4 veh_id = 'V3' read_date = '20260102' odometer = 200 )
|
||||
( read_id = 5 veh_id = 'V3' read_date = '20260112' odometer = 500 )
|
||||
( read_id = 6 veh_id = 'V3' read_date = '20260122' odometer = 900 ) ).
|
||||
go_env->insert_test_data( lt_odom ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD distances_per_vehicle.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_distances(
|
||||
iv_from = '20260101' iv_to = '20260131' it_depot = VALUE #( ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 700 act = lt_lines[ 1 ]-distance ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_lines[ 1 ]-readings ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 300 act = lt_lines[ 2 ]-distance ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD depot_filter.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_distances(
|
||||
iv_from = '20260101' iv_to = '20260131'
|
||||
it_depot = VALUE #( ( sign = 'I' option = 'EQ' low = 'D2' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
127
tasks_gen/eval/G0124/faulty/m2_fleet_dist.prog.abap
Normal file
127
tasks_gen/eval/G0124/faulty/m2_fleet_dist.prog.abap
Normal file
@@ -0,0 +1,127 @@
|
||||
REPORT {{p}}fleet_dist.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_line,
|
||||
veh_id TYPE {{p}}veh-veh_id,
|
||||
depot TYPE {{p}}veh-depot,
|
||||
distance TYPE i,
|
||||
readings TYPE i,
|
||||
END OF ty_line,
|
||||
tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY,
|
||||
tt_depot TYPE RANGE OF {{p}}veh-depot.
|
||||
|
||||
DATA gv_depot TYPE {{p}}veh-depot.
|
||||
|
||||
PARAMETERS p_from TYPE d OBLIGATORY.
|
||||
PARAMETERS p_to TYPE d OBLIGATORY.
|
||||
SELECT-OPTIONS s_depot FOR gv_depot.
|
||||
|
||||
CLASS lcl_report DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
METHODS select_distances
|
||||
IMPORTING iv_from TYPE d
|
||||
iv_to TYPE d
|
||||
it_depot TYPE tt_depot
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
METHODS display
|
||||
CHANGING ct_lines TYPE tt_line.
|
||||
PRIVATE SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_raw,
|
||||
veh_id TYPE {{p}}veh-veh_id,
|
||||
depot TYPE {{p}}veh-depot,
|
||||
max_odo TYPE {{p}}odom-odometer,
|
||||
min_odo TYPE {{p}}odom-odometer,
|
||||
readings TYPE i,
|
||||
END OF ty_raw,
|
||||
tt_raw TYPE STANDARD TABLE OF ty_raw WITH EMPTY KEY.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_report IMPLEMENTATION.
|
||||
METHOD select_distances.
|
||||
DATA lt_raw TYPE tt_raw.
|
||||
SELECT v~veh_id, v~depot, MAX( o~odometer ) AS max_odo, MIN( o~odometer ) AS min_odo,
|
||||
COUNT( * ) AS readings
|
||||
FROM {{p}}veh AS v
|
||||
INNER JOIN {{p}}odom AS o ON o~veh_id = v~veh_id
|
||||
WHERE o~read_date >= @iv_from
|
||||
AND o~read_date <= @iv_to
|
||||
AND v~depot IN @it_depot
|
||||
GROUP BY v~veh_id, v~depot
|
||||
HAVING COUNT( * ) < 2
|
||||
INTO CORRESPONDING FIELDS OF TABLE @lt_raw.
|
||||
LOOP AT lt_raw ASSIGNING FIELD-SYMBOL(<ls_raw>).
|
||||
APPEND VALUE #( veh_id = <ls_raw>-veh_id
|
||||
depot = <ls_raw>-depot
|
||||
distance = <ls_raw>-max_odo - <ls_raw>-min_odo
|
||||
readings = <ls_raw>-readings ) TO rt_lines.
|
||||
ENDLOOP.
|
||||
SORT rt_lines BY distance DESCENDING veh_id ASCENDING.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD display.
|
||||
TRY.
|
||||
cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv)
|
||||
CHANGING t_table = ct_lines ).
|
||||
lo_alv->display( ).
|
||||
CATCH cx_salv_msg INTO DATA(lx_error).
|
||||
MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
||||
START-OF-SELECTION.
|
||||
DATA(go_report) = NEW lcl_report( ).
|
||||
DATA(gt_lines) = go_report->select_distances( iv_from = p_from iv_to = p_to it_depot = s_depot[] ).
|
||||
go_report->display( CHANGING ct_lines = gt_lines ).
|
||||
|
||||
CLASS ltc_report 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 distances_per_vehicle FOR TESTING.
|
||||
METHODS depot_filter FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltc_report IMPLEMENTATION.
|
||||
METHOD class_setup.
|
||||
go_env = cl_osql_test_environment=>create(
|
||||
i_dependency_list = VALUE #( ( '{{P}}VEH' ) ( '{{P}}ODOM' ) ) ).
|
||||
DATA lt_veh TYPE STANDARD TABLE OF {{p}}veh WITH EMPTY KEY.
|
||||
lt_veh = VALUE #( ( veh_id = 'V1' depot = 'D1' )
|
||||
( veh_id = 'V2' depot = 'D2' )
|
||||
( veh_id = 'V3' depot = 'D2' ) ).
|
||||
go_env->insert_test_data( lt_veh ).
|
||||
DATA lt_odom TYPE STANDARD TABLE OF {{p}}odom WITH EMPTY KEY.
|
||||
lt_odom = VALUE #( ( read_id = 1 veh_id = 'V1' read_date = '20260101' odometer = 100 )
|
||||
( read_id = 2 veh_id = 'V1' read_date = '20260110' odometer = 400 )
|
||||
( read_id = 3 veh_id = 'V2' read_date = '20260105' odometer = 50 )
|
||||
( read_id = 4 veh_id = 'V3' read_date = '20260102' odometer = 200 )
|
||||
( read_id = 5 veh_id = 'V3' read_date = '20260112' odometer = 500 )
|
||||
( read_id = 6 veh_id = 'V3' read_date = '20260122' odometer = 900 ) ).
|
||||
go_env->insert_test_data( lt_odom ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD distances_per_vehicle.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_distances(
|
||||
iv_from = '20260101' iv_to = '20260131' it_depot = VALUE #( ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 700 act = lt_lines[ 1 ]-distance ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_lines[ 1 ]-readings ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 300 act = lt_lines[ 2 ]-distance ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD depot_filter.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_distances(
|
||||
iv_from = '20260101' iv_to = '20260131'
|
||||
it_depot = VALUE #( ( sign = 'I' option = 'EQ' low = 'D2' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
127
tasks_gen/eval/G0124/faulty/m3_fleet_dist.prog.abap
Normal file
127
tasks_gen/eval/G0124/faulty/m3_fleet_dist.prog.abap
Normal file
@@ -0,0 +1,127 @@
|
||||
REPORT {{p}}fleet_dist.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_line,
|
||||
veh_id TYPE {{p}}veh-veh_id,
|
||||
depot TYPE {{p}}veh-depot,
|
||||
distance TYPE i,
|
||||
readings TYPE i,
|
||||
END OF ty_line,
|
||||
tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY,
|
||||
tt_depot TYPE RANGE OF {{p}}veh-depot.
|
||||
|
||||
DATA gv_depot TYPE {{p}}veh-depot.
|
||||
|
||||
PARAMETERS p_from TYPE d OBLIGATORY.
|
||||
PARAMETERS p_to TYPE d OBLIGATORY.
|
||||
SELECT-OPTIONS s_depot FOR gv_depot.
|
||||
|
||||
CLASS lcl_report DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
METHODS select_distances
|
||||
IMPORTING iv_from TYPE d
|
||||
iv_to TYPE d
|
||||
it_depot TYPE tt_depot
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
METHODS display
|
||||
CHANGING ct_lines TYPE tt_line.
|
||||
PRIVATE SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_raw,
|
||||
veh_id TYPE {{p}}veh-veh_id,
|
||||
depot TYPE {{p}}veh-depot,
|
||||
max_odo TYPE {{p}}odom-odometer,
|
||||
min_odo TYPE {{p}}odom-odometer,
|
||||
readings TYPE i,
|
||||
END OF ty_raw,
|
||||
tt_raw TYPE STANDARD TABLE OF ty_raw WITH EMPTY KEY.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_report IMPLEMENTATION.
|
||||
METHOD select_distances.
|
||||
DATA lt_raw TYPE tt_raw.
|
||||
SELECT v~veh_id, v~depot, MAX( o~odometer ) AS max_odo, MIN( o~odometer ) AS min_odo,
|
||||
COUNT( * ) AS readings
|
||||
FROM {{p}}veh AS v
|
||||
INNER JOIN {{p}}odom AS o ON o~veh_id = v~veh_id
|
||||
WHERE o~read_date >= @iv_from
|
||||
AND o~read_date <= @iv_to
|
||||
AND v~depot IN @it_depot
|
||||
GROUP BY v~veh_id, v~depot
|
||||
HAVING COUNT( * ) >= 3
|
||||
INTO CORRESPONDING FIELDS OF TABLE @lt_raw.
|
||||
LOOP AT lt_raw ASSIGNING FIELD-SYMBOL(<ls_raw>).
|
||||
APPEND VALUE #( veh_id = <ls_raw>-veh_id
|
||||
depot = <ls_raw>-depot
|
||||
distance = <ls_raw>-max_odo - <ls_raw>-min_odo
|
||||
readings = <ls_raw>-readings ) TO rt_lines.
|
||||
ENDLOOP.
|
||||
SORT rt_lines BY distance DESCENDING veh_id ASCENDING.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD display.
|
||||
TRY.
|
||||
cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv)
|
||||
CHANGING t_table = ct_lines ).
|
||||
lo_alv->display( ).
|
||||
CATCH cx_salv_msg INTO DATA(lx_error).
|
||||
MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
||||
START-OF-SELECTION.
|
||||
DATA(go_report) = NEW lcl_report( ).
|
||||
DATA(gt_lines) = go_report->select_distances( iv_from = p_from iv_to = p_to it_depot = s_depot[] ).
|
||||
go_report->display( CHANGING ct_lines = gt_lines ).
|
||||
|
||||
CLASS ltc_report 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 distances_per_vehicle FOR TESTING.
|
||||
METHODS depot_filter FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltc_report IMPLEMENTATION.
|
||||
METHOD class_setup.
|
||||
go_env = cl_osql_test_environment=>create(
|
||||
i_dependency_list = VALUE #( ( '{{P}}VEH' ) ( '{{P}}ODOM' ) ) ).
|
||||
DATA lt_veh TYPE STANDARD TABLE OF {{p}}veh WITH EMPTY KEY.
|
||||
lt_veh = VALUE #( ( veh_id = 'V1' depot = 'D1' )
|
||||
( veh_id = 'V2' depot = 'D2' )
|
||||
( veh_id = 'V3' depot = 'D2' ) ).
|
||||
go_env->insert_test_data( lt_veh ).
|
||||
DATA lt_odom TYPE STANDARD TABLE OF {{p}}odom WITH EMPTY KEY.
|
||||
lt_odom = VALUE #( ( read_id = 1 veh_id = 'V1' read_date = '20260101' odometer = 100 )
|
||||
( read_id = 2 veh_id = 'V1' read_date = '20260110' odometer = 400 )
|
||||
( read_id = 3 veh_id = 'V2' read_date = '20260105' odometer = 50 )
|
||||
( read_id = 4 veh_id = 'V3' read_date = '20260102' odometer = 200 )
|
||||
( read_id = 5 veh_id = 'V3' read_date = '20260112' odometer = 500 )
|
||||
( read_id = 6 veh_id = 'V3' read_date = '20260122' odometer = 900 ) ).
|
||||
go_env->insert_test_data( lt_odom ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD distances_per_vehicle.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_distances(
|
||||
iv_from = '20260101' iv_to = '20260131' it_depot = VALUE #( ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 700 act = lt_lines[ 1 ]-distance ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_lines[ 1 ]-readings ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 300 act = lt_lines[ 2 ]-distance ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD depot_filter.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_distances(
|
||||
iv_from = '20260101' iv_to = '20260131'
|
||||
it_depot = VALUE #( ( sign = 'I' option = 'EQ' low = 'D2' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
127
tasks_gen/eval/G0124/faulty/m4_fleet_dist.prog.abap
Normal file
127
tasks_gen/eval/G0124/faulty/m4_fleet_dist.prog.abap
Normal file
@@ -0,0 +1,127 @@
|
||||
REPORT {{p}}fleet_dist.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_line,
|
||||
veh_id TYPE {{p}}veh-veh_id,
|
||||
depot TYPE {{p}}veh-depot,
|
||||
distance TYPE i,
|
||||
readings TYPE i,
|
||||
END OF ty_line,
|
||||
tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY,
|
||||
tt_depot TYPE RANGE OF {{p}}veh-depot.
|
||||
|
||||
DATA gv_depot TYPE {{p}}veh-depot.
|
||||
|
||||
PARAMETERS p_from TYPE d OBLIGATORY.
|
||||
PARAMETERS p_to TYPE d OBLIGATORY.
|
||||
SELECT-OPTIONS s_depot FOR gv_depot.
|
||||
|
||||
CLASS lcl_report DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
METHODS select_distances
|
||||
IMPORTING iv_from TYPE d
|
||||
iv_to TYPE d
|
||||
it_depot TYPE tt_depot
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
METHODS display
|
||||
CHANGING ct_lines TYPE tt_line.
|
||||
PRIVATE SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_raw,
|
||||
veh_id TYPE {{p}}veh-veh_id,
|
||||
depot TYPE {{p}}veh-depot,
|
||||
max_odo TYPE {{p}}odom-odometer,
|
||||
min_odo TYPE {{p}}odom-odometer,
|
||||
readings TYPE i,
|
||||
END OF ty_raw,
|
||||
tt_raw TYPE STANDARD TABLE OF ty_raw WITH EMPTY KEY.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_report IMPLEMENTATION.
|
||||
METHOD select_distances.
|
||||
DATA lt_raw TYPE tt_raw.
|
||||
SELECT v~veh_id, v~depot, MAX( o~odometer ) AS max_odo, MIN( o~odometer ) AS min_odo,
|
||||
COUNT( * ) AS readings
|
||||
FROM {{p}}veh AS v
|
||||
INNER JOIN {{p}}odom AS o ON o~veh_id = v~veh_id
|
||||
WHERE o~read_date >= @iv_from
|
||||
AND o~read_date <= @iv_to
|
||||
AND v~depot IN @it_depot
|
||||
GROUP BY v~veh_id, v~depot
|
||||
HAVING COUNT( * ) >= 2
|
||||
INTO CORRESPONDING FIELDS OF TABLE @lt_raw.
|
||||
LOOP AT lt_raw ASSIGNING FIELD-SYMBOL(<ls_raw>).
|
||||
APPEND VALUE #( veh_id = <ls_raw>-veh_id
|
||||
depot = <ls_raw>-depot
|
||||
distance = <ls_raw>-max_odo + <ls_raw>-min_odo
|
||||
readings = <ls_raw>-readings ) TO rt_lines.
|
||||
ENDLOOP.
|
||||
SORT rt_lines BY distance DESCENDING veh_id ASCENDING.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD display.
|
||||
TRY.
|
||||
cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv)
|
||||
CHANGING t_table = ct_lines ).
|
||||
lo_alv->display( ).
|
||||
CATCH cx_salv_msg INTO DATA(lx_error).
|
||||
MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
||||
START-OF-SELECTION.
|
||||
DATA(go_report) = NEW lcl_report( ).
|
||||
DATA(gt_lines) = go_report->select_distances( iv_from = p_from iv_to = p_to it_depot = s_depot[] ).
|
||||
go_report->display( CHANGING ct_lines = gt_lines ).
|
||||
|
||||
CLASS ltc_report 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 distances_per_vehicle FOR TESTING.
|
||||
METHODS depot_filter FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltc_report IMPLEMENTATION.
|
||||
METHOD class_setup.
|
||||
go_env = cl_osql_test_environment=>create(
|
||||
i_dependency_list = VALUE #( ( '{{P}}VEH' ) ( '{{P}}ODOM' ) ) ).
|
||||
DATA lt_veh TYPE STANDARD TABLE OF {{p}}veh WITH EMPTY KEY.
|
||||
lt_veh = VALUE #( ( veh_id = 'V1' depot = 'D1' )
|
||||
( veh_id = 'V2' depot = 'D2' )
|
||||
( veh_id = 'V3' depot = 'D2' ) ).
|
||||
go_env->insert_test_data( lt_veh ).
|
||||
DATA lt_odom TYPE STANDARD TABLE OF {{p}}odom WITH EMPTY KEY.
|
||||
lt_odom = VALUE #( ( read_id = 1 veh_id = 'V1' read_date = '20260101' odometer = 100 )
|
||||
( read_id = 2 veh_id = 'V1' read_date = '20260110' odometer = 400 )
|
||||
( read_id = 3 veh_id = 'V2' read_date = '20260105' odometer = 50 )
|
||||
( read_id = 4 veh_id = 'V3' read_date = '20260102' odometer = 200 )
|
||||
( read_id = 5 veh_id = 'V3' read_date = '20260112' odometer = 500 )
|
||||
( read_id = 6 veh_id = 'V3' read_date = '20260122' odometer = 900 ) ).
|
||||
go_env->insert_test_data( lt_odom ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD distances_per_vehicle.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_distances(
|
||||
iv_from = '20260101' iv_to = '20260131' it_depot = VALUE #( ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 700 act = lt_lines[ 1 ]-distance ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_lines[ 1 ]-readings ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 300 act = lt_lines[ 2 ]-distance ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD depot_filter.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_distances(
|
||||
iv_from = '20260101' iv_to = '20260131'
|
||||
it_depot = VALUE #( ( sign = 'I' option = 'EQ' low = 'D2' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
19
tasks_gen/eval/G0124/generation.json
Normal file
19
tasks_gen/eval/G0124/generation.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"id": "G0124",
|
||||
"pool": "eval",
|
||||
"object_type": "PROG",
|
||||
"category": "C",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100.0,
|
||||
"null": 0,
|
||||
"mutation": {
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"ok": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
134
tasks_gen/eval/G0124/hidden/fleet_hidden.clas.abap
Normal file
134
tasks_gen/eval/G0124/hidden/fleet_hidden.clas.abap
Normal file
@@ -0,0 +1,134 @@
|
||||
CLASS {{p}}fleet_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
TYPES tt_depot TYPE RANGE OF {{p}}veh-depot.
|
||||
METHODS run
|
||||
IMPORTING iv_from TYPE d
|
||||
iv_to TYPE d
|
||||
it_depot TYPE tt_depot 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_vehicles FOR TESTING.
|
||||
METHODS sorted_by_distance FOR TESTING.
|
||||
METHODS distance_and_readings FOR TESTING.
|
||||
METHODS depot_filter FOR TESTING.
|
||||
METHODS date_filter FOR TESTING.
|
||||
METHODS tie_break_by_veh_id FOR TESTING.
|
||||
METHODS single_reading_excluded FOR TESTING.
|
||||
METHODS unknown_vehicle_excluded FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}fleet_hidden IMPLEMENTATION.
|
||||
METHOD run.
|
||||
cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ).
|
||||
SUBMIT {{p}}fleet_dist
|
||||
WITH p_from = iv_from
|
||||
WITH p_to = iv_to
|
||||
WITH s_depot IN it_depot
|
||||
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_vehicles.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 3
|
||||
act = lines_of( run( iv_from = '20260101' iv_to = '20260131' ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sorted_by_distance.
|
||||
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `V3` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `VEH_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `V2` act = value_of( ir_data = lr_data iv_row = 3 iv_col = `VEH_ID` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD distance_and_readings.
|
||||
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `600` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `DISTANCE` ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `4` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `READINGS` ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `D1` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `DEPOT` ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `200` act = value_of( ir_data = lr_data iv_row = 3 iv_col = `DISTANCE` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD depot_filter.
|
||||
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131'
|
||||
it_depot = VALUE #( ( sign = 'I' option = 'EQ' low = 'D1' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `V1` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `VEH_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `500` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `DISTANCE` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD date_filter.
|
||||
DATA(lr_data) = run( iv_from = '20260111' iv_to = '20260131' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `V3` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `VEH_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `300` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `DISTANCE` ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `3` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `READINGS` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD tie_break_by_veh_id.
|
||||
DATA(lr_data) = run( iv_from = '20251201' iv_to = '20260131' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `V1` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `VEH_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `V3` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `VEH_ID` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD single_reading_excluded.
|
||||
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260110' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `V1` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `VEH_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `200` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `DISTANCE` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_vehicle_excluded.
|
||||
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260116' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `V3` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `VEH_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `V2` act = value_of( ir_data = lr_data iv_row = 3 iv_col = `VEH_ID` ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -1,212 +0,0 @@
|
||||
CLASS {{p}}t20_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
TYPES tt_region TYPE RANGE OF {{p}}farm-region.
|
||||
METHODS run
|
||||
IMPORTING iv_from TYPE d
|
||||
iv_to TYPE d
|
||||
it_region TYPE tt_region 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_farms_listed FOR TESTING.
|
||||
METHODS litres_summed FOR TESTING.
|
||||
METHODS delivery_count FOR TESTING.
|
||||
METHODS date_bounds FOR TESTING.
|
||||
METHODS date_range_wide FOR TESTING.
|
||||
METHODS region_filter FOR TESTING.
|
||||
METHODS region_exclude FOR TESTING.
|
||||
METHODS sorted_by_litres FOR TESTING.
|
||||
METHODS tie_break_farm_id FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t20_hidden IMPLEMENTATION.
|
||||
METHOD run.
|
||||
cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ).
|
||||
SUBMIT {{p}}milk_sum WITH p_from = iv_from WITH p_to = iv_to
|
||||
WITH s_reg IN it_region 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_farms_listed.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 5
|
||||
act = lines_of( run( iv_from = '20260101' iv_to = '20260131' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 2
|
||||
act = lines_of( run( iv_from = '20260101' iv_to = '20260131'
|
||||
it_region = VALUE #( ( sign = 'I' option = 'EQ' low = 'CH' ) ) ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD litres_summed.
|
||||
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1000`
|
||||
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `200.50`
|
||||
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `LITRES` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1001`
|
||||
act = value_of( ir_data = lr_data iv_row = 2 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `200.00`
|
||||
act = value_of( ir_data = lr_data iv_row = 2 iv_col = `LITRES` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD delivery_count.
|
||||
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `2`
|
||||
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `DELIVERIES` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1`
|
||||
act = value_of( ir_data = lr_data iv_row = 3 iv_col = `DELIVERIES` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1003`
|
||||
act = value_of( ir_data = lr_data iv_row = 5 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `0`
|
||||
act = value_of( ir_data = lr_data iv_row = 5 iv_col = `DELIVERIES` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `0.00`
|
||||
act = value_of( ir_data = lr_data iv_row = 5 iv_col = `LITRES` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD date_bounds.
|
||||
DATA(lr_one) = run( iv_from = '20260105' iv_to = '20260105' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 5 act = lines_of( lr_one ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1000`
|
||||
act = value_of( ir_data = lr_one iv_row = 1 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `120.50`
|
||||
act = value_of( ir_data = lr_one iv_row = 1 iv_col = `LITRES` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1`
|
||||
act = value_of( ir_data = lr_one iv_row = 1 iv_col = `DELIVERIES` ) ).
|
||||
|
||||
DATA(lr_two) = run( iv_from = '20260105' iv_to = '20260106' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 5 act = lines_of( lr_two ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1001`
|
||||
act = value_of( ir_data = lr_two iv_row = 1 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `200.00`
|
||||
act = value_of( ir_data = lr_two iv_row = 1 iv_col = `LITRES` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1000`
|
||||
act = value_of( ir_data = lr_two iv_row = 2 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `120.50`
|
||||
act = value_of( ir_data = lr_two iv_row = 2 iv_col = `LITRES` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD date_range_wide.
|
||||
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260228' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1001`
|
||||
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `240.00`
|
||||
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `LITRES` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `2`
|
||||
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `DELIVERIES` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1000`
|
||||
act = value_of( ir_data = lr_data iv_row = 2 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `200.50`
|
||||
act = value_of( ir_data = lr_data iv_row = 2 iv_col = `LITRES` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `2`
|
||||
act = value_of( ir_data = lr_data iv_row = 2 iv_col = `DELIVERIES` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1003`
|
||||
act = value_of( ir_data = lr_data iv_row = 5 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `0.00`
|
||||
act = value_of( ir_data = lr_data iv_row = 5 iv_col = `LITRES` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD region_filter.
|
||||
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131'
|
||||
it_region = VALUE #( ( sign = 'I' option = 'EQ' low = 'CH' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1000`
|
||||
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `200.50`
|
||||
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `LITRES` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1001`
|
||||
act = value_of( ir_data = lr_data iv_row = 2 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `200.00`
|
||||
act = value_of( ir_data = lr_data iv_row = 2 iv_col = `LITRES` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD region_exclude.
|
||||
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131'
|
||||
it_region = VALUE #( ( sign = 'E' option = 'EQ' low = 'CH' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1002`
|
||||
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `50.25`
|
||||
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `LITRES` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1004`
|
||||
act = value_of( ir_data = lr_data iv_row = 2 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `50.25`
|
||||
act = value_of( ir_data = lr_data iv_row = 2 iv_col = `LITRES` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1003`
|
||||
act = value_of( ir_data = lr_data iv_row = 3 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `0.00`
|
||||
act = value_of( ir_data = lr_data iv_row = 3 iv_col = `LITRES` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sorted_by_litres.
|
||||
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1000`
|
||||
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1001`
|
||||
act = value_of( ir_data = lr_data iv_row = 2 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1002`
|
||||
act = value_of( ir_data = lr_data iv_row = 3 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1004`
|
||||
act = value_of( ir_data = lr_data iv_row = 4 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1003`
|
||||
act = value_of( ir_data = lr_data iv_row = 5 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `Alpine Dairy`
|
||||
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `FARM_NAME` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `CH`
|
||||
act = value_of( ir_data = lr_data iv_row = 1 iv_col = `REGION` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `Hilltop Farm`
|
||||
act = value_of( ir_data = lr_data iv_row = 5 iv_col = `FARM_NAME` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `AT`
|
||||
act = value_of( ir_data = lr_data iv_row = 5 iv_col = `REGION` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD tie_break_farm_id.
|
||||
DATA(lr_data) = run( iv_from = '20260101' iv_to = '20260131' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `50.25`
|
||||
act = value_of( ir_data = lr_data iv_row = 3 iv_col = `LITRES` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `50.25`
|
||||
act = value_of( ir_data = lr_data iv_row = 4 iv_col = `LITRES` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1002`
|
||||
act = value_of( ir_data = lr_data iv_row = 3 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1004`
|
||||
act = value_of( ir_data = lr_data iv_row = 4 iv_col = `FARM_ID` ) ).
|
||||
|
||||
DATA(lr_zero) = run( iv_from = '20260105' iv_to = '20260105' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1001`
|
||||
act = value_of( ir_data = lr_zero iv_row = 2 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1002`
|
||||
act = value_of( ir_data = lr_zero iv_row = 3 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1003`
|
||||
act = value_of( ir_data = lr_zero iv_row = 4 iv_col = `FARM_ID` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1004`
|
||||
act = value_of( ir_data = lr_zero iv_row = 5 iv_col = `FARM_ID` ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -1,96 +1,81 @@
|
||||
{
|
||||
"task": "T20",
|
||||
"task": "G0124",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}MILK_SUM",
|
||||
"mutant": "BETWEEN -> >= only (rel)",
|
||||
"object": "{{P}}FLEET_DIST",
|
||||
"mutant": "line 48: AND -> OR (logic)",
|
||||
"status": "killed",
|
||||
"hidden": "0/9",
|
||||
"hidden": "2/8",
|
||||
"failed_tests": [
|
||||
"ALL_FARMS_LISTED",
|
||||
"LITRES_SUMMED",
|
||||
"DELIVERY_COUNT",
|
||||
"DATE_BOUNDS",
|
||||
"DATE_RANGE_WIDE",
|
||||
"REGION_FILTER",
|
||||
"REGION_EXCLUDE",
|
||||
"SORTED_BY_LITRES",
|
||||
"TIE_BREAK_FARM_ID"
|
||||
"DATE_FILTER",
|
||||
"DEPOT_FILTER",
|
||||
"DISTANCE_AND_READINGS",
|
||||
"SINGLE_READING_EXCLUDED",
|
||||
"SORTED_BY_DISTANCE",
|
||||
"UNKNOWN_VEHICLE_EXCLUDED"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MILK_SUM",
|
||||
"mutant": "BETWEEN -> <= only (rel)",
|
||||
"object": "{{P}}FLEET_DIST",
|
||||
"mutant": "line 49: AND -> OR (logic)",
|
||||
"status": "killed",
|
||||
"hidden": "0/9",
|
||||
"hidden": "2/8",
|
||||
"failed_tests": [
|
||||
"LITRES_SUMMED",
|
||||
"DATE_BOUNDS",
|
||||
"DATE_RANGE_WIDE",
|
||||
"SORTED_BY_LITRES",
|
||||
"TIE_BREAK_FARM_ID"
|
||||
"DATE_FILTER",
|
||||
"DEPOT_FILTER",
|
||||
"DISTANCE_AND_READINGS",
|
||||
"SINGLE_READING_EXCLUDED",
|
||||
"SORTED_BY_DISTANCE",
|
||||
"UNKNOWN_VEHICLE_EXCLUDED"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MILK_SUM",
|
||||
"mutant": "region IN -> region NOT IN (logic)",
|
||||
"object": "{{P}}FLEET_DIST",
|
||||
"mutant": "line 51: >= -> < (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "0/9",
|
||||
"hidden": "0/8",
|
||||
"failed_tests": [
|
||||
"ALL_FARMS_LISTED",
|
||||
"LITRES_SUMMED",
|
||||
"DELIVERY_COUNT",
|
||||
"DATE_BOUNDS",
|
||||
"DATE_RANGE_WIDE",
|
||||
"REGION_FILTER",
|
||||
"REGION_EXCLUDE",
|
||||
"SORTED_BY_LITRES",
|
||||
"TIE_BREAK_FARM_ID"
|
||||
"ALL_VEHICLES",
|
||||
"DATE_FILTER",
|
||||
"DEPOT_FILTER",
|
||||
"DISTANCE_AND_READINGS",
|
||||
"SINGLE_READING_EXCLUDED",
|
||||
"SORTED_BY_DISTANCE",
|
||||
"TIE_BREAK_BY_VEH_ID",
|
||||
"UNKNOWN_VEHICLE_EXCLUDED"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MILK_SUM",
|
||||
"mutant": "farm without delivery skipped (inner join)",
|
||||
"object": "{{P}}FLEET_DIST",
|
||||
"mutant": "line 51: 2 -> 3 (const)",
|
||||
"status": "killed",
|
||||
"hidden": "0/9",
|
||||
"hidden": "1/8",
|
||||
"failed_tests": [
|
||||
"ALL_FARMS_LISTED",
|
||||
"DELIVERY_COUNT",
|
||||
"DATE_BOUNDS",
|
||||
"DATE_RANGE_WIDE",
|
||||
"REGION_EXCLUDE",
|
||||
"SORTED_BY_LITRES",
|
||||
"TIE_BREAK_FARM_ID"
|
||||
"ALL_VEHICLES",
|
||||
"DEPOT_FILTER",
|
||||
"DISTANCE_AND_READINGS",
|
||||
"SINGLE_READING_EXCLUDED",
|
||||
"SORTED_BY_DISTANCE",
|
||||
"TIE_BREAK_BY_VEH_ID",
|
||||
"UNKNOWN_VEHICLE_EXCLUDED"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MILK_SUM",
|
||||
"mutant": "SORT litres DESCENDING -> ASCENDING (rel)",
|
||||
"object": "{{P}}FLEET_DIST",
|
||||
"mutant": "line 56: - -> + (arith)",
|
||||
"status": "killed",
|
||||
"hidden": "0/9",
|
||||
"hidden": "3/8",
|
||||
"failed_tests": [
|
||||
"LITRES_SUMMED",
|
||||
"DATE_BOUNDS",
|
||||
"DATE_RANGE_WIDE",
|
||||
"REGION_FILTER",
|
||||
"REGION_EXCLUDE",
|
||||
"SORTED_BY_LITRES",
|
||||
"TIE_BREAK_FARM_ID"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}MILK_SUM",
|
||||
"mutant": "secondary sort farm_id removed (tie)",
|
||||
"status": "killed",
|
||||
"hidden": "0/9",
|
||||
"failed_tests": [
|
||||
"SORTED_BY_LITRES",
|
||||
"TIE_BREAK_FARM_ID"
|
||||
"DATE_FILTER",
|
||||
"DEPOT_FILTER",
|
||||
"DISTANCE_AND_READINGS",
|
||||
"SINGLE_READING_EXCLUDED",
|
||||
"TIE_BREAK_BY_VEH_ID"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 6,
|
||||
"killed": 6,
|
||||
"valid": 5,
|
||||
"killed": 5,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
127
tasks_gen/eval/G0124/reference/fleet_dist.prog.abap
Normal file
127
tasks_gen/eval/G0124/reference/fleet_dist.prog.abap
Normal file
@@ -0,0 +1,127 @@
|
||||
REPORT {{p}}fleet_dist.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_line,
|
||||
veh_id TYPE {{p}}veh-veh_id,
|
||||
depot TYPE {{p}}veh-depot,
|
||||
distance TYPE i,
|
||||
readings TYPE i,
|
||||
END OF ty_line,
|
||||
tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY,
|
||||
tt_depot TYPE RANGE OF {{p}}veh-depot.
|
||||
|
||||
DATA gv_depot TYPE {{p}}veh-depot.
|
||||
|
||||
PARAMETERS p_from TYPE d OBLIGATORY.
|
||||
PARAMETERS p_to TYPE d OBLIGATORY.
|
||||
SELECT-OPTIONS s_depot FOR gv_depot.
|
||||
|
||||
CLASS lcl_report DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
METHODS select_distances
|
||||
IMPORTING iv_from TYPE d
|
||||
iv_to TYPE d
|
||||
it_depot TYPE tt_depot
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
METHODS display
|
||||
CHANGING ct_lines TYPE tt_line.
|
||||
PRIVATE SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_raw,
|
||||
veh_id TYPE {{p}}veh-veh_id,
|
||||
depot TYPE {{p}}veh-depot,
|
||||
max_odo TYPE {{p}}odom-odometer,
|
||||
min_odo TYPE {{p}}odom-odometer,
|
||||
readings TYPE i,
|
||||
END OF ty_raw,
|
||||
tt_raw TYPE STANDARD TABLE OF ty_raw WITH EMPTY KEY.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_report IMPLEMENTATION.
|
||||
METHOD select_distances.
|
||||
DATA lt_raw TYPE tt_raw.
|
||||
SELECT v~veh_id, v~depot, MAX( o~odometer ) AS max_odo, MIN( o~odometer ) AS min_odo,
|
||||
COUNT( * ) AS readings
|
||||
FROM {{p}}veh AS v
|
||||
INNER JOIN {{p}}odom AS o ON o~veh_id = v~veh_id
|
||||
WHERE o~read_date >= @iv_from
|
||||
AND o~read_date <= @iv_to
|
||||
AND v~depot IN @it_depot
|
||||
GROUP BY v~veh_id, v~depot
|
||||
HAVING COUNT( * ) >= 2
|
||||
INTO CORRESPONDING FIELDS OF TABLE @lt_raw.
|
||||
LOOP AT lt_raw ASSIGNING FIELD-SYMBOL(<ls_raw>).
|
||||
APPEND VALUE #( veh_id = <ls_raw>-veh_id
|
||||
depot = <ls_raw>-depot
|
||||
distance = <ls_raw>-max_odo - <ls_raw>-min_odo
|
||||
readings = <ls_raw>-readings ) TO rt_lines.
|
||||
ENDLOOP.
|
||||
SORT rt_lines BY distance DESCENDING veh_id ASCENDING.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD display.
|
||||
TRY.
|
||||
cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv)
|
||||
CHANGING t_table = ct_lines ).
|
||||
lo_alv->display( ).
|
||||
CATCH cx_salv_msg INTO DATA(lx_error).
|
||||
MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
||||
START-OF-SELECTION.
|
||||
DATA(go_report) = NEW lcl_report( ).
|
||||
DATA(gt_lines) = go_report->select_distances( iv_from = p_from iv_to = p_to it_depot = s_depot[] ).
|
||||
go_report->display( CHANGING ct_lines = gt_lines ).
|
||||
|
||||
CLASS ltc_report 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 distances_per_vehicle FOR TESTING.
|
||||
METHODS depot_filter FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltc_report IMPLEMENTATION.
|
||||
METHOD class_setup.
|
||||
go_env = cl_osql_test_environment=>create(
|
||||
i_dependency_list = VALUE #( ( '{{P}}VEH' ) ( '{{P}}ODOM' ) ) ).
|
||||
DATA lt_veh TYPE STANDARD TABLE OF {{p}}veh WITH EMPTY KEY.
|
||||
lt_veh = VALUE #( ( veh_id = 'V1' depot = 'D1' )
|
||||
( veh_id = 'V2' depot = 'D2' )
|
||||
( veh_id = 'V3' depot = 'D2' ) ).
|
||||
go_env->insert_test_data( lt_veh ).
|
||||
DATA lt_odom TYPE STANDARD TABLE OF {{p}}odom WITH EMPTY KEY.
|
||||
lt_odom = VALUE #( ( read_id = 1 veh_id = 'V1' read_date = '20260101' odometer = 100 )
|
||||
( read_id = 2 veh_id = 'V1' read_date = '20260110' odometer = 400 )
|
||||
( read_id = 3 veh_id = 'V2' read_date = '20260105' odometer = 50 )
|
||||
( read_id = 4 veh_id = 'V3' read_date = '20260102' odometer = 200 )
|
||||
( read_id = 5 veh_id = 'V3' read_date = '20260112' odometer = 500 )
|
||||
( read_id = 6 veh_id = 'V3' read_date = '20260122' odometer = 900 ) ).
|
||||
go_env->insert_test_data( lt_odom ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD distances_per_vehicle.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_distances(
|
||||
iv_from = '20260101' iv_to = '20260131' it_depot = VALUE #( ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 700 act = lt_lines[ 1 ]-distance ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = lt_lines[ 1 ]-readings ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 300 act = lt_lines[ 2 ]-distance ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD depot_filter.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_distances(
|
||||
iv_from = '20260101' iv_to = '20260131'
|
||||
it_depot = VALUE #( ( sign = 'I' option = 'EQ' low = 'D2' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'V3' act = lt_lines[ 1 ]-veh_id ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -1,170 +0,0 @@
|
||||
REPORT {{p}}milk_sum.
|
||||
|
||||
DATA gv_region TYPE {{p}}farm-region.
|
||||
|
||||
PARAMETERS p_from TYPE d OBLIGATORY.
|
||||
PARAMETERS p_to TYPE d OBLIGATORY.
|
||||
SELECT-OPTIONS s_reg FOR gv_region.
|
||||
|
||||
CLASS lcl_report DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_line,
|
||||
farm_id TYPE {{p}}farm-farm_id,
|
||||
farm_name TYPE {{p}}farm-farm_name,
|
||||
region TYPE {{p}}farm-region,
|
||||
litres TYPE {{p}}milk-litres,
|
||||
deliveries TYPE i,
|
||||
END OF ty_line,
|
||||
tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY,
|
||||
tt_region TYPE RANGE OF {{p}}farm-region.
|
||||
METHODS select_data
|
||||
IMPORTING iv_from TYPE d
|
||||
iv_to TYPE d
|
||||
it_region TYPE tt_region
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
METHODS display
|
||||
CHANGING ct_lines TYPE tt_line.
|
||||
PRIVATE SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_sum,
|
||||
farm_id TYPE {{p}}milk-farm_id,
|
||||
litres TYPE {{p}}milk-litres,
|
||||
deliveries TYPE i,
|
||||
END OF ty_sum,
|
||||
tt_sum TYPE HASHED TABLE OF ty_sum WITH UNIQUE KEY farm_id.
|
||||
METHODS sum_deliveries
|
||||
IMPORTING iv_from TYPE d
|
||||
iv_to TYPE d
|
||||
RETURNING VALUE(rt_sum) TYPE tt_sum.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_report IMPLEMENTATION.
|
||||
METHOD select_data.
|
||||
SELECT farm_id, farm_name, region
|
||||
FROM {{p}}farm
|
||||
WHERE region IN @it_region
|
||||
INTO TABLE @DATA(lt_farm).
|
||||
|
||||
DATA(lt_sum) = sum_deliveries( iv_from = iv_from iv_to = iv_to ).
|
||||
|
||||
LOOP AT lt_farm INTO DATA(ls_farm).
|
||||
DATA(ls_line) = VALUE ty_line( farm_id = ls_farm-farm_id
|
||||
farm_name = ls_farm-farm_name
|
||||
region = ls_farm-region ).
|
||||
READ TABLE lt_sum ASSIGNING FIELD-SYMBOL(<ls_sum>)
|
||||
WITH TABLE KEY farm_id = ls_farm-farm_id.
|
||||
IF sy-subrc = 0.
|
||||
ls_line-litres = <ls_sum>-litres.
|
||||
ls_line-deliveries = <ls_sum>-deliveries.
|
||||
ENDIF.
|
||||
APPEND ls_line TO rt_lines.
|
||||
ENDLOOP.
|
||||
|
||||
SORT rt_lines BY litres DESCENDING farm_id ASCENDING.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sum_deliveries.
|
||||
SELECT farm_id, litres
|
||||
FROM {{p}}milk
|
||||
WHERE deliv_date BETWEEN @iv_from AND @iv_to
|
||||
INTO TABLE @DATA(lt_milk).
|
||||
|
||||
LOOP AT lt_milk INTO DATA(ls_milk).
|
||||
READ TABLE rt_sum ASSIGNING FIELD-SYMBOL(<ls_sum>)
|
||||
WITH TABLE KEY farm_id = ls_milk-farm_id.
|
||||
IF sy-subrc <> 0.
|
||||
DATA(ls_new) = VALUE ty_sum( farm_id = ls_milk-farm_id ).
|
||||
INSERT ls_new INTO TABLE rt_sum ASSIGNING <ls_sum>.
|
||||
ENDIF.
|
||||
<ls_sum>-litres += ls_milk-litres.
|
||||
<ls_sum>-deliveries += 1.
|
||||
ENDLOOP.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD display.
|
||||
TRY.
|
||||
cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv)
|
||||
CHANGING t_table = ct_lines ).
|
||||
lo_alv->display( ).
|
||||
CATCH cx_salv_msg INTO DATA(lx_error).
|
||||
MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
||||
START-OF-SELECTION.
|
||||
DATA(go_report) = NEW lcl_report( ).
|
||||
DATA(gt_lines) = go_report->select_data( iv_from = p_from iv_to = p_to it_region = s_reg[] ).
|
||||
go_report->display( CHANGING ct_lines = gt_lines ).
|
||||
|
||||
CLASS ltc_report 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 sums_and_counts FOR TESTING.
|
||||
METHODS missing_delivery FOR TESTING.
|
||||
METHODS date_range FOR TESTING.
|
||||
METHODS tie_break FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltc_report IMPLEMENTATION.
|
||||
METHOD class_setup.
|
||||
go_env = cl_osql_test_environment=>create(
|
||||
i_dependency_list = VALUE #( ( '{{P}}FARM' ) ( '{{P}}MILK' ) ) ).
|
||||
DATA lt_farm TYPE STANDARD TABLE OF {{p}}farm WITH EMPTY KEY.
|
||||
lt_farm = VALUE #( ( farm_id = '1' farm_name = 'A' region = 'X' )
|
||||
( farm_id = '2' farm_name = 'B' region = 'X' )
|
||||
( farm_id = '3' farm_name = 'C' region = 'Y' )
|
||||
( farm_id = '4' farm_name = 'D' region = 'Y' )
|
||||
( farm_id = '5' farm_name = 'E' region = 'X' ) ).
|
||||
go_env->insert_test_data( lt_farm ).
|
||||
DATA lt_milk TYPE STANDARD TABLE OF {{p}}milk WITH EMPTY KEY.
|
||||
lt_milk = VALUE #( ( deliv_id = 1 farm_id = '1' deliv_date = '20260110' litres = 10 )
|
||||
( deliv_id = 2 farm_id = '1' deliv_date = '20260120' litres = 5 )
|
||||
( deliv_id = 3 farm_id = '2' deliv_date = '20260115' litres = 40 )
|
||||
( deliv_id = 4 farm_id = '3' deliv_date = '20260116' litres = 20 )
|
||||
( deliv_id = 5 farm_id = '5' deliv_date = '20260111' litres = 15 ) ).
|
||||
go_env->insert_test_data( lt_milk ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sums_and_counts.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_data(
|
||||
iv_from = '20260101' iv_to = '20260131' it_region = VALUE #( ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 5 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = '2' act = lt_lines[ 1 ]-farm_id ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV {{p}}milk-litres( 40 ) act = lt_lines[ 1 ]-litres ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_lines[ 1 ]-deliveries ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD missing_delivery.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_data(
|
||||
iv_from = '20260101' iv_to = '20260131' it_region = VALUE #( ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = '4' act = lt_lines[ 5 ]-farm_id ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lt_lines[ 5 ]-deliveries ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lt_lines[ 5 ]-litres ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD date_range.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_data(
|
||||
iv_from = '20260115' iv_to = '20260131' it_region = VALUE #( ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 5 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = '2' act = lt_lines[ 1 ]-farm_id ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV {{p}}milk-litres( 40 ) act = lt_lines[ 1 ]-litres ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = '1' act = lt_lines[ 3 ]-farm_id ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV {{p}}milk-litres( 5 ) act = lt_lines[ 3 ]-litres ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lt_lines[ 3 ]-deliveries ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD tie_break.
|
||||
DATA(lt_lines) = NEW lcl_report( )->select_data(
|
||||
iv_from = '20260101' iv_to = '20260131' it_region = VALUE #( ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = '1' act = lt_lines[ 3 ]-farm_id ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = '5' act = lt_lines[ 4 ]-farm_id ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -1,12 +0,0 @@
|
||||
@EndUserText.label : 'Milk delivery'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}milk {
|
||||
key client : abap.clnt not null;
|
||||
key deliv_id : abap.int4 not null;
|
||||
farm_id : abap.char(10);
|
||||
deliv_date : abap.dats;
|
||||
litres : abap.dec(13,2);
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
@EndUserText.label : 'Farm'
|
||||
@EndUserText.label : 'Odometer readings'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}farm {
|
||||
define table {{p}}odom {
|
||||
key client : abap.clnt not null;
|
||||
key farm_id : abap.char(10) not null;
|
||||
farm_name : abap.char(40);
|
||||
region : abap.char(4);
|
||||
key read_id : abap.int4 not null;
|
||||
veh_id : abap.char(10);
|
||||
read_date : abap.dats;
|
||||
odometer : abap.int4;
|
||||
}
|
||||
33
tasks_gen/eval/G0124/seed/seed_fleet.clas.abap
Normal file
33
tasks_gen/eval/G0124/seed/seed_fleet.clas.abap
Normal file
@@ -0,0 +1,33 @@
|
||||
CLASS {{p}}seed_fleet DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES if_oo_adt_classrun.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS {{p}}seed_fleet IMPLEMENTATION.
|
||||
METHOD if_oo_adt_classrun~main.
|
||||
DELETE FROM {{p}}odom.
|
||||
DELETE FROM {{p}}veh.
|
||||
INSERT {{p}}veh FROM TABLE @( VALUE #(
|
||||
( veh_id = 'V1' depot = 'D1' veh_type = 'TRUCK' )
|
||||
( veh_id = 'V2' depot = 'D1' veh_type = 'VAN' )
|
||||
( veh_id = 'V3' depot = 'D2' veh_type = 'TRUCK' )
|
||||
( veh_id = 'V4' depot = 'D2' veh_type = 'VAN' ) ) ).
|
||||
INSERT {{p}}odom FROM TABLE @( VALUE #(
|
||||
( read_id = 1 veh_id = 'V1' read_date = '20251220' odometer = 900 )
|
||||
( read_id = 2 veh_id = 'V1' read_date = '20260101' odometer = 1000 )
|
||||
( read_id = 3 veh_id = 'V1' read_date = '20260110' odometer = 1200 )
|
||||
( read_id = 4 veh_id = 'V1' read_date = '20260120' odometer = 1500 )
|
||||
( read_id = 5 veh_id = 'V2' read_date = '20260105' odometer = 500 )
|
||||
( read_id = 6 veh_id = 'V2' read_date = '20260115' odometer = 700 )
|
||||
( read_id = 7 veh_id = 'V3' read_date = '20260102' odometer = 5000 )
|
||||
( read_id = 8 veh_id = 'V3' read_date = '20260112' odometer = 5300 )
|
||||
( read_id = 9 veh_id = 'V3' read_date = '20260122' odometer = 5400 )
|
||||
( read_id = 10 veh_id = 'V3' read_date = '20260125' odometer = 5600 )
|
||||
( read_id = 11 veh_id = 'V4' read_date = '20260108' odometer = 300 )
|
||||
( read_id = 12 veh_id = 'V9' read_date = '20260106' odometer = 100 )
|
||||
( read_id = 13 veh_id = 'V9' read_date = '20260116' odometer = 400 )
|
||||
( read_id = 14 veh_id = 'V9' read_date = '20260205' odometer = 700 )
|
||||
( read_id = 15 veh_id = 'V9' read_date = '20260215' odometer = 1000 ) ) ).
|
||||
out->write( sy-dbcnt ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -1,26 +0,0 @@
|
||||
CLASS {{p}}t20_seed DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES if_oo_adt_classrun.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS {{p}}t20_seed IMPLEMENTATION.
|
||||
METHOD if_oo_adt_classrun~main.
|
||||
DELETE FROM {{p}}milk.
|
||||
DELETE FROM {{p}}farm.
|
||||
INSERT {{p}}farm FROM TABLE @( VALUE #(
|
||||
( farm_id = '1000' farm_name = 'Alpine Dairy' region = 'CH' )
|
||||
( farm_id = '1001' farm_name = 'Valley Farm' region = 'CH' )
|
||||
( farm_id = '1002' farm_name = 'Lakeside Farm' region = 'DE' )
|
||||
( farm_id = '1003' farm_name = 'Hilltop Farm' region = 'AT' )
|
||||
( farm_id = '1004' farm_name = 'Sunny Acres' region = 'DE' ) ) ).
|
||||
INSERT {{p}}milk FROM TABLE @( VALUE #(
|
||||
( deliv_id = 1 farm_id = '1000' deliv_date = '20260105' litres = '120.50' )
|
||||
( deliv_id = 2 farm_id = '1000' deliv_date = '20260112' litres = '80.00' )
|
||||
( deliv_id = 3 farm_id = '1001' deliv_date = '20260106' litres = '200.00' )
|
||||
( deliv_id = 4 farm_id = '1002' deliv_date = '20260107' litres = '50.25' )
|
||||
( deliv_id = 5 farm_id = '1003' deliv_date = '20251220' litres = '300.00' )
|
||||
( deliv_id = 6 farm_id = '1001' deliv_date = '20260215' litres = '40.00' )
|
||||
( deliv_id = 7 farm_id = '1004' deliv_date = '20260108' litres = '50.25' ) ) ).
|
||||
out->write( sy-dbcnt ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
11
tasks_gen/eval/G0124/seed/veh.tabl.asabap
Normal file
11
tasks_gen/eval/G0124/seed/veh.tabl.asabap
Normal file
@@ -0,0 +1,11 @@
|
||||
@EndUserText.label : 'Vehicle master'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}veh {
|
||||
key client : abap.clnt not null;
|
||||
key veh_id : abap.char(10) not null;
|
||||
depot : abap.char(4);
|
||||
veh_type : abap.char(10);
|
||||
}
|
||||
@@ -1,45 +1,51 @@
|
||||
# 1. Goal
|
||||
Show the milk deliveries of each farm in an ALV list. The cooperative uses the
|
||||
list to compare the farms of a region for a period.
|
||||
A facility management company operates a fleet of vehicles. The fleet manager
|
||||
needs a report that shows the distance that each vehicle drove in a period.
|
||||
The fleet manager uses the report to compare the vehicles.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Table {{P}}FARM exists in package $TMP. It contains data.
|
||||
Fields: FARM_ID (CHAR 10, key), FARM_NAME (CHAR 40), REGION (CHAR 4).
|
||||
- Table {{P}}MILK exists in package $TMP. It contains data.
|
||||
Fields: DELIV_ID (INT4, key), FARM_ID (CHAR 10), DELIV_DATE (DATS),
|
||||
LITRES (DEC 13,2).
|
||||
The tables {{P}}VEH and {{P}}ODOM exist in package $TMP. Both tables contain
|
||||
data.
|
||||
|
||||
Table {{P}}VEH holds the vehicles.
|
||||
Fields: VEH_ID (CHAR 10, key), DEPOT (CHAR 4), VEH_TYPE (CHAR 10).
|
||||
|
||||
Table {{P}}ODOM holds the odometer readings of the vehicles.
|
||||
Fields: READ_ID (INT4, key), VEH_ID (CHAR 10), READ_DATE (DATS),
|
||||
ODOMETER (INT4, the odometer value in kilometres).
|
||||
|
||||
A vehicle can have many odometer readings. An odometer reading can belong to a
|
||||
vehicle that is not in {{P}}VEH.
|
||||
|
||||
# 4. Contract
|
||||
- Create the executable program {{P}}MILK_SUM in package $TMP.
|
||||
- Create the executable program {{P}}FLEET_DIST in package $TMP.
|
||||
- Selection screen:
|
||||
- Parameter P_FROM, type DATS, mandatory: the first delivery date to include.
|
||||
- Parameter P_TO, type DATS, mandatory: the last delivery date to include.
|
||||
- Select-option S_REG for the region.
|
||||
- Parameter P_FROM, type DATS, mandatory: the first reading date to include.
|
||||
- Parameter P_TO, type DATS, mandatory: the last reading date to include.
|
||||
- Select-option S_DEPOT for the depot.
|
||||
- Show the result with CL_SALV_TABLE. The output table has these columns, with
|
||||
these names: FARM_ID, FARM_NAME, REGION, LITRES, DELIVERIES.
|
||||
these names: VEH_ID, DEPOT, DISTANCE, READINGS.
|
||||
|
||||
# 5. Business rules
|
||||
1. Include a delivery only if DELIV_DATE is on or after P_FROM and on or before
|
||||
P_TO. Both limits are included.
|
||||
2. Include a farm only if REGION is in S_REG. An empty S_REG includes every
|
||||
region. A line with sign E in S_REG excludes its region.
|
||||
3. Show one line for each included farm. A farm without an included delivery also
|
||||
gets a line.
|
||||
4. LITRES is the sum of the litres of the included deliveries of the farm. LITRES
|
||||
is 0 if the farm has no included delivery.
|
||||
5. DELIVERIES is the number of included deliveries of the farm. DELIVERIES is 0
|
||||
if the farm has no included delivery.
|
||||
6. Sort the lines by LITRES, the highest value first. If two lines have the same
|
||||
LITRES, sort them by FARM_ID, the lowest value first.
|
||||
7. FARM_NAME and REGION are the values of the farm.
|
||||
1. Include an odometer reading only if READ_DATE is on or after P_FROM and on
|
||||
or before P_TO.
|
||||
2. Include a vehicle only if the vehicle is in {{P}}VEH and its DEPOT is in
|
||||
S_DEPOT.
|
||||
3. Include a vehicle only if at least two of its readings are included.
|
||||
4. DISTANCE is the highest included ODOMETER value of the vehicle minus the
|
||||
lowest included ODOMETER value of the vehicle.
|
||||
5. READINGS is the number of included readings of the vehicle.
|
||||
6. Show one line for each included vehicle.
|
||||
7. Sort the lines by DISTANCE. The highest distance comes first. If two lines
|
||||
have the same DISTANCE, the line with the smaller VEH_ID comes first.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 7.58.
|
||||
- Coding standards: Clean ABAP. Read each table with one database access.
|
||||
- Out of scope: do not change {{P}}FARM and {{P}}MILK.
|
||||
- Release target: 8.16.
|
||||
- Coding standards: Clean ABAP.
|
||||
- Out of scope: do not change {{P}}VEH and {{P}}ODOM.
|
||||
|
||||
# 7. Acceptance
|
||||
- The program is active and has no syntax error.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"category": "C",
|
||||
"object_type": "PROG",
|
||||
"difficulty": 2,
|
||||
"release_target": "v758",
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
@@ -12,56 +12,57 @@
|
||||
"seed": [
|
||||
{
|
||||
"type": "TABL",
|
||||
"name": "{{P}}FARM",
|
||||
"file": "seed/farm.tabl.asabap",
|
||||
"description": "Farms of the cooperative"
|
||||
"name": "{{P}}VEH",
|
||||
"file": "seed/veh.tabl.asabap",
|
||||
"description": "Vehicle master"
|
||||
},
|
||||
{
|
||||
"type": "TABL",
|
||||
"name": "{{P}}MILK",
|
||||
"file": "seed/milk.tabl.asabap",
|
||||
"description": "Milk deliveries"
|
||||
"name": "{{P}}ODOM",
|
||||
"file": "seed/odom.tabl.asabap",
|
||||
"description": "Odometer readings"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T20_SEED",
|
||||
"file": "seed/t20_seed.clas.abap",
|
||||
"description": "T20 seed data",
|
||||
"name": "{{P}}SEED_FLEET",
|
||||
"file": "seed/seed_fleet.clas.abap",
|
||||
"description": "Fleet seed data",
|
||||
"run": true
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "PROG",
|
||||
"name": "{{P}}MILK_SUM",
|
||||
"name": "{{P}}FLEET_DIST",
|
||||
"parameters": [
|
||||
"p_from",
|
||||
"p_to",
|
||||
"s_reg"
|
||||
"s_depot"
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}FARM",
|
||||
"{{P}}MILK"
|
||||
"{{P}}VEH",
|
||||
"{{P}}ODOM"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T20_HIDDEN",
|
||||
"file": "hidden/t20_hidden.clas.abap",
|
||||
"description": "T20 hidden tests"
|
||||
"name": "{{P}}FLEET_HIDDEN",
|
||||
"file": "hidden/fleet_hidden.clas.abap",
|
||||
"description": "Fleet distance hidden tests"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "PROG",
|
||||
"name": "{{P}}MILK_SUM",
|
||||
"file": "reference/milk_sum.prog.abap",
|
||||
"description": "Milk litres per farm"
|
||||
"name": "{{P}}FLEET_DIST",
|
||||
"file": "reference/fleet_dist.prog.abap",
|
||||
"description": "Fleet distance per vehicle"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"internal_table_key",
|
||||
"db_operation_in_loop",
|
||||
"method_length"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user