Fix coverage with several contract classes; table annotation and file path checks; clean task dir on write
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
29
tasks_gen/eval/G0121/generation.json
Normal file
29
tasks_gen/eval/G0121/generation.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"id": "G0121",
|
||||
"pool": "eval",
|
||||
"object_type": "FUNC",
|
||||
"category": "C",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": null,
|
||||
"null": null
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": null,
|
||||
"null": null
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": null,
|
||||
"null": null
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": null,
|
||||
"null": null
|
||||
}
|
||||
],
|
||||
"accepted": false
|
||||
}
|
||||
220
tasks_gen/eval/G0121/hidden/t14_hidden.clas.abap
Normal file
220
tasks_gen/eval/G0121/hidden/t14_hidden.clas.abap
Normal file
@@ -0,0 +1,220 @@
|
||||
CLASS {{p}}t14_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
TYPES ty_orders TYPE STANDARD TABLE OF {{p}}roasts.
|
||||
TYPES ty_totals TYPE STANDARD TABLE OF {{p}}blends.
|
||||
|
||||
METHODS run
|
||||
IMPORTING it_orders TYPE ty_orders
|
||||
EXPORTING et_totals TYPE ty_totals
|
||||
ev_grand_total TYPE decfloat34
|
||||
ev_subrc TYPE sysubrc.
|
||||
|
||||
METHODS sums_per_blend FOR TESTING.
|
||||
METHODS sorted_by_total FOR TESTING.
|
||||
METHODS tie_break_by_blend FOR TESTING.
|
||||
METHODS ignores_zero FOR TESTING.
|
||||
METHODS ignores_negative FOR TESTING.
|
||||
METHODS empty_input FOR TESTING.
|
||||
METHODS no_production_line FOR TESTING.
|
||||
METHODS grand_total FOR TESTING.
|
||||
METHODS single_line FOR TESTING.
|
||||
METHODS one_blend_many_lines FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t14_hidden IMPLEMENTATION.
|
||||
|
||||
METHOD run.
|
||||
CLEAR: et_totals, ev_grand_total.
|
||||
CALL FUNCTION '{{P}}ROAST_SUM'
|
||||
EXPORTING
|
||||
it_orders = it_orders
|
||||
IMPORTING
|
||||
et_totals = et_totals
|
||||
ev_grand_total = ev_grand_total
|
||||
EXCEPTIONS
|
||||
OTHERS = 1.
|
||||
ev_subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sums_per_blend.
|
||||
DATA lt_orders TYPE ty_orders.
|
||||
APPEND VALUE #( order_id = '0000000001' blend = 'PILS' quantity_kg = '10.000' ) TO lt_orders.
|
||||
APPEND VALUE #( order_id = '0000000002' blend = 'PILS' quantity_kg = '5.000' ) TO lt_orders.
|
||||
APPEND VALUE #( order_id = '0000000003' blend = 'WEIZ' quantity_kg = '7.000' ) TO lt_orders.
|
||||
|
||||
DATA lt_totals TYPE ty_totals.
|
||||
run( EXPORTING it_orders = lt_orders
|
||||
IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_totals ) ).
|
||||
|
||||
DATA ls_tot TYPE {{p}}blends.
|
||||
READ TABLE lt_totals INTO ls_tot INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'PILS' act = ls_tot-blend ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 15 ) act = CONV decfloat34( ls_tot-total_kg ) ).
|
||||
|
||||
READ TABLE lt_totals INTO ls_tot INDEX 2.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'WEIZ' act = ls_tot-blend ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 7 ) act = CONV decfloat34( ls_tot-total_kg ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sorted_by_total.
|
||||
DATA lt_orders TYPE ty_orders.
|
||||
APPEND VALUE #( order_id = '0000000001' blend = 'ARAB' quantity_kg = '5.000' ) TO lt_orders.
|
||||
APPEND VALUE #( order_id = '0000000002' blend = 'ROBU' quantity_kg = '30.000' ) TO lt_orders.
|
||||
APPEND VALUE #( order_id = '0000000003' blend = 'KONA' quantity_kg = '12.000' ) TO lt_orders.
|
||||
|
||||
DATA lt_totals TYPE ty_totals.
|
||||
run( EXPORTING it_orders = lt_orders
|
||||
IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = lines( lt_totals ) ).
|
||||
|
||||
DATA ls_tot TYPE {{p}}blends.
|
||||
READ TABLE lt_totals INTO ls_tot INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'ROBU' act = ls_tot-blend ).
|
||||
READ TABLE lt_totals INTO ls_tot INDEX 2.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'KONA' act = ls_tot-blend ).
|
||||
READ TABLE lt_totals INTO ls_tot INDEX 3.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'ARAB' act = ls_tot-blend ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD tie_break_by_blend.
|
||||
DATA lt_orders TYPE ty_orders.
|
||||
APPEND VALUE #( order_id = '0000000001' blend = 'ROBU' quantity_kg = '6.000' ) TO lt_orders.
|
||||
APPEND VALUE #( order_id = '0000000002' blend = 'ARAB' quantity_kg = '6.000' ) TO lt_orders.
|
||||
|
||||
DATA lt_totals TYPE ty_totals.
|
||||
run( EXPORTING it_orders = lt_orders
|
||||
IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_totals ) ).
|
||||
|
||||
DATA ls_tot TYPE {{p}}blends.
|
||||
READ TABLE lt_totals INTO ls_tot INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'ARAB' act = ls_tot-blend ).
|
||||
READ TABLE lt_totals INTO ls_tot INDEX 2.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'ROBU' act = ls_tot-blend ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD ignores_zero.
|
||||
DATA lt_orders TYPE ty_orders.
|
||||
APPEND VALUE #( order_id = '0000000001' blend = 'PILS' quantity_kg = '0.000' ) TO lt_orders.
|
||||
APPEND VALUE #( order_id = '0000000002' blend = 'WEIZ' quantity_kg = '4.000' ) TO lt_orders.
|
||||
|
||||
DATA lt_totals TYPE ty_totals.
|
||||
run( EXPORTING it_orders = lt_orders
|
||||
IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_totals ) ).
|
||||
|
||||
DATA ls_tot TYPE {{p}}blends.
|
||||
READ TABLE lt_totals INTO ls_tot INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'WEIZ' act = ls_tot-blend ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 4 ) act = CONV decfloat34( ls_tot-total_kg ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD ignores_negative.
|
||||
DATA lt_orders TYPE ty_orders.
|
||||
APPEND VALUE #( order_id = '0000000001' blend = 'PILS' quantity_kg = '-3.000' ) TO lt_orders.
|
||||
APPEND VALUE #( order_id = '0000000002' blend = 'WEIZ' quantity_kg = '4.000' ) TO lt_orders.
|
||||
|
||||
DATA lt_totals TYPE ty_totals.
|
||||
run( EXPORTING it_orders = lt_orders
|
||||
IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_totals ) ).
|
||||
|
||||
DATA ls_tot TYPE {{p}}blends.
|
||||
READ TABLE lt_totals INTO ls_tot INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'WEIZ' act = ls_tot-blend ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD empty_input.
|
||||
DATA lt_orders TYPE ty_orders.
|
||||
DATA lt_totals TYPE ty_totals.
|
||||
DATA lv_grand TYPE decfloat34 VALUE 99.
|
||||
run( EXPORTING it_orders = lt_orders
|
||||
IMPORTING et_totals = lt_totals ev_grand_total = lv_grand ev_subrc = DATA(lv_subrc) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lines( lt_totals ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_grand ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD no_production_line.
|
||||
DATA lt_orders TYPE ty_orders.
|
||||
APPEND VALUE #( order_id = '0000000001' blend = 'PILS' quantity_kg = '0.000' ) TO lt_orders.
|
||||
APPEND VALUE #( order_id = '0000000002' blend = 'WEIZ' quantity_kg = '-8.000' ) TO lt_orders.
|
||||
|
||||
DATA lt_totals TYPE ty_totals.
|
||||
DATA lv_grand TYPE decfloat34.
|
||||
run( EXPORTING it_orders = lt_orders
|
||||
IMPORTING et_totals = lt_totals ev_grand_total = lv_grand ev_subrc = DATA(lv_subrc) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lines( lt_totals ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_grand ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD grand_total.
|
||||
DATA lt_orders TYPE ty_orders.
|
||||
APPEND VALUE #( order_id = '0000000001' blend = 'PILS' quantity_kg = '10.000' ) TO lt_orders.
|
||||
APPEND VALUE #( order_id = '0000000002' blend = 'WEIZ' quantity_kg = '2.000' ) TO lt_orders.
|
||||
APPEND VALUE #( order_id = '0000000003' blend = 'KOLS' quantity_kg = '8.000' ) TO lt_orders.
|
||||
APPEND VALUE #( order_id = '0000000004' blend = 'PILS' quantity_kg = '5.000' ) TO lt_orders.
|
||||
|
||||
DATA lt_totals TYPE ty_totals.
|
||||
DATA lv_grand TYPE decfloat34.
|
||||
run( EXPORTING it_orders = lt_orders
|
||||
IMPORTING et_totals = lt_totals ev_grand_total = lv_grand ev_subrc = DATA(lv_subrc) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 25 ) act = lv_grand ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD single_line.
|
||||
DATA lt_orders TYPE ty_orders.
|
||||
APPEND VALUE #( order_id = '0000000001' blend = 'KONA' quantity_kg = '3.000' ) TO lt_orders.
|
||||
|
||||
DATA lt_totals TYPE ty_totals.
|
||||
run( EXPORTING it_orders = lt_orders
|
||||
IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_totals ) ).
|
||||
|
||||
DATA ls_tot TYPE {{p}}blends.
|
||||
READ TABLE lt_totals INTO ls_tot INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'KONA' act = ls_tot-blend ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 3 ) act = CONV decfloat34( ls_tot-total_kg ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD one_blend_many_lines.
|
||||
DATA lt_orders TYPE ty_orders.
|
||||
APPEND VALUE #( order_id = '0000000001' blend = 'PILS' quantity_kg = '1.000' ) TO lt_orders.
|
||||
APPEND VALUE #( order_id = '0000000002' blend = 'PILS' quantity_kg = '2.000' ) TO lt_orders.
|
||||
APPEND VALUE #( order_id = '0000000003' blend = 'PILS' quantity_kg = '3.000' ) TO lt_orders.
|
||||
APPEND VALUE #( order_id = '0000000004' blend = 'PILS' quantity_kg = '4.000' ) TO lt_orders.
|
||||
|
||||
DATA lt_totals TYPE ty_totals.
|
||||
run( EXPORTING it_orders = lt_orders
|
||||
IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_totals ) ).
|
||||
|
||||
DATA ls_tot TYPE {{p}}blends.
|
||||
READ TABLE lt_totals INTO ls_tot INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'PILS' act = ls_tot-blend ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 10 ) act = CONV decfloat34( ls_tot-total_kg ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
45
tasks_gen/eval/G0121/reference/roast_sum.func.abap
Normal file
45
tasks_gen/eval/G0121/reference/roast_sum.func.abap
Normal file
@@ -0,0 +1,45 @@
|
||||
FUNCTION {{p}}roast_sum
|
||||
IMPORTING
|
||||
it_orders TYPE STANDARD TABLE OF {{p}}roasts
|
||||
EXPORTING
|
||||
et_totals TYPE STANDARD TABLE OF {{p}}blends
|
||||
ev_grand_total TYPE decfloat34.
|
||||
|
||||
TYPES: BEGIN OF ty_sum,
|
||||
blend TYPE {{p}}blends-blend,
|
||||
total_kg TYPE {{p}}blends-total_kg,
|
||||
END OF ty_sum.
|
||||
|
||||
DATA lt_sum TYPE HASHED TABLE OF ty_sum WITH UNIQUE KEY blend.
|
||||
DATA ls_ord TYPE {{p}}roasts.
|
||||
DATA ls_sum TYPE ty_sum.
|
||||
DATA ls_tot TYPE {{p}}blends.
|
||||
|
||||
CLEAR: et_totals, ev_grand_total.
|
||||
|
||||
LOOP AT it_orders INTO ls_ord.
|
||||
IF ls_ord-quantity_kg <= 0.
|
||||
CONTINUE.
|
||||
ENDIF.
|
||||
|
||||
READ TABLE lt_sum INTO ls_sum WITH TABLE KEY blend = ls_ord-blend.
|
||||
IF sy-subrc = 0.
|
||||
ls_sum-total_kg = ls_sum-total_kg + ls_ord-quantity_kg.
|
||||
MODIFY TABLE lt_sum FROM ls_sum.
|
||||
ELSE.
|
||||
ls_sum-blend = ls_ord-blend.
|
||||
ls_sum-total_kg = ls_ord-quantity_kg.
|
||||
INSERT ls_sum INTO TABLE lt_sum.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
LOOP AT lt_sum INTO ls_sum.
|
||||
ls_tot-blend = ls_sum-blend.
|
||||
ls_tot-total_kg = ls_sum-total_kg.
|
||||
ev_grand_total = ev_grand_total + ls_sum-total_kg.
|
||||
APPEND ls_tot TO et_totals.
|
||||
ENDLOOP.
|
||||
|
||||
SORT et_totals BY total_kg DESCENDING blend ASCENDING.
|
||||
|
||||
ENDFUNCTION.
|
||||
109
tasks_gen/eval/G0121/reference/t14_test.clas.abap
Normal file
109
tasks_gen/eval/G0121/reference/t14_test.clas.abap
Normal file
@@ -0,0 +1,109 @@
|
||||
CLASS {{p}}t14_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
TYPES ty_orders TYPE STANDARD TABLE OF {{p}}roasts.
|
||||
TYPES ty_totals TYPE STANDARD TABLE OF {{p}}blends.
|
||||
|
||||
METHODS run
|
||||
IMPORTING it_orders TYPE ty_orders
|
||||
EXPORTING et_totals TYPE ty_totals
|
||||
ev_grand_total TYPE decfloat34
|
||||
ev_subrc TYPE sysubrc.
|
||||
|
||||
METHODS sums_per_blend FOR TESTING.
|
||||
METHODS ignores_non_positive FOR TESTING.
|
||||
METHODS sorted_by_total FOR TESTING.
|
||||
METHODS tie_break FOR TESTING.
|
||||
METHODS empty_input FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t14_test IMPLEMENTATION.
|
||||
|
||||
METHOD run.
|
||||
CLEAR: et_totals, ev_grand_total.
|
||||
CALL FUNCTION '{{P}}ROAST_SUM'
|
||||
EXPORTING
|
||||
it_orders = it_orders
|
||||
IMPORTING
|
||||
et_totals = et_totals
|
||||
ev_grand_total = ev_grand_total
|
||||
EXCEPTIONS
|
||||
OTHERS = 1.
|
||||
ev_subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sums_per_blend.
|
||||
DATA lt_orders TYPE ty_orders.
|
||||
APPEND VALUE #( order_id = '0000000001' blend = 'PILS' quantity_kg = '10.000' ) TO lt_orders.
|
||||
APPEND VALUE #( order_id = '0000000002' blend = 'PILS' quantity_kg = '5.000' ) TO lt_orders.
|
||||
|
||||
DATA lt_totals TYPE ty_totals.
|
||||
run( EXPORTING it_orders = lt_orders
|
||||
IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_totals ) ).
|
||||
|
||||
DATA ls_tot TYPE {{p}}blends.
|
||||
READ TABLE lt_totals INTO ls_tot INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'PILS' act = ls_tot-blend ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 15 ) act = CONV decfloat34( ls_tot-total_kg ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD ignores_non_positive.
|
||||
DATA lt_orders TYPE ty_orders.
|
||||
APPEND VALUE #( order_id = '0000000001' blend = 'PILS' quantity_kg = '0.000' ) TO lt_orders.
|
||||
APPEND VALUE #( order_id = '0000000002' blend = 'WEIZ' quantity_kg = '-4.000' ) TO lt_orders.
|
||||
|
||||
DATA lt_totals TYPE ty_totals.
|
||||
run( EXPORTING it_orders = lt_orders
|
||||
IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lines( lt_totals ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sorted_by_total.
|
||||
DATA lt_orders TYPE ty_orders.
|
||||
APPEND VALUE #( order_id = '0000000001' blend = 'ARAB' quantity_kg = '5.000' ) TO lt_orders.
|
||||
APPEND VALUE #( order_id = '0000000002' blend = 'ROBU' quantity_kg = '30.000' ) TO lt_orders.
|
||||
|
||||
DATA lt_totals TYPE ty_totals.
|
||||
run( EXPORTING it_orders = lt_orders
|
||||
IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
DATA ls_tot TYPE {{p}}blends.
|
||||
READ TABLE lt_totals INTO ls_tot INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'ROBU' act = ls_tot-blend ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD tie_break.
|
||||
DATA lt_orders TYPE ty_orders.
|
||||
APPEND VALUE #( order_id = '0000000001' blend = 'ROBU' quantity_kg = '6.000' ) TO lt_orders.
|
||||
APPEND VALUE #( order_id = '0000000002' blend = 'ARAB' quantity_kg = '6.000' ) TO lt_orders.
|
||||
|
||||
DATA lt_totals TYPE ty_totals.
|
||||
run( EXPORTING it_orders = lt_orders
|
||||
IMPORTING et_totals = lt_totals ev_subrc = DATA(lv_subrc) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
DATA ls_tot TYPE {{p}}blends.
|
||||
READ TABLE lt_totals INTO ls_tot INDEX 1.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'ARAB' act = ls_tot-blend ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD empty_input.
|
||||
DATA lt_orders TYPE ty_orders.
|
||||
DATA lt_totals TYPE ty_totals.
|
||||
DATA lv_grand TYPE decfloat34 VALUE 99.
|
||||
run( EXPORTING it_orders = lt_orders
|
||||
IMPORTING et_totals = lt_totals ev_grand_total = lv_grand ev_subrc = DATA(lv_subrc) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_subrc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lines( lt_totals ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_grand ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
7
tasks_gen/eval/G0121/seed/blends.tabl.abap
Normal file
7
tasks_gen/eval/G0121/seed/blends.tabl.abap
Normal file
@@ -0,0 +1,7 @@
|
||||
@EndUserText.label : 'Roast total per blend'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
define table {{p}}blends {
|
||||
key client : abap.clnt not null;
|
||||
key blend : abap.char(4) not null;
|
||||
total_kg : abap.dec(15,3);
|
||||
}
|
||||
28
tasks_gen/eval/G0121/seed/roast_seed.clas.abap
Normal file
28
tasks_gen/eval/G0121/seed/roast_seed.clas.abap
Normal file
@@ -0,0 +1,28 @@
|
||||
CLASS {{p}}roast_seed DEFINITION
|
||||
PUBLIC
|
||||
FINAL
|
||||
CREATE PUBLIC.
|
||||
|
||||
PUBLIC SECTION.
|
||||
INTERFACES if_oo_adt_classrun.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}roast_seed IMPLEMENTATION.
|
||||
METHOD if_oo_adt_classrun~main.
|
||||
DATA lt_lines TYPE STANDARD TABLE OF {{p}}roasts.
|
||||
lt_lines = VALUE #(
|
||||
( client = sy-mandt order_id = '0000000001' blend = 'PILS' quantity_kg = '120.500' )
|
||||
( client = sy-mandt order_id = '0000000002' blend = 'WEIZ' quantity_kg = '80.000' )
|
||||
( client = sy-mandt order_id = '0000000003' blend = 'PILS' quantity_kg = '60.250' )
|
||||
( client = sy-mandt order_id = '0000000004' blend = 'KOLS' quantity_kg = '45.000' )
|
||||
( client = sy-mandt order_id = '0000000005' blend = 'PILS' quantity_kg = '0.000' )
|
||||
( client = sy-mandt order_id = '0000000006' blend = 'WEIZ' quantity_kg = '20.000' )
|
||||
).
|
||||
|
||||
DELETE FROM {{p}}roasts.
|
||||
INSERT {{p}}roasts FROM TABLE @lt_lines.
|
||||
|
||||
out->write( |{ sy-dbcnt } roast lines inserted| ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
8
tasks_gen/eval/G0121/seed/roasts.tabl.abap
Normal file
8
tasks_gen/eval/G0121/seed/roasts.tabl.abap
Normal file
@@ -0,0 +1,8 @@
|
||||
@EndUserText.label : 'Roast order line'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
define table {{p}}roasts {
|
||||
key client : abap.clnt not null;
|
||||
key order_id : abap.numc(10) not null;
|
||||
blend : abap.char(4);
|
||||
quantity_kg : abap.dec(15,3);
|
||||
}
|
||||
52
tasks_gen/eval/G0121/spec.md
Normal file
52
tasks_gen/eval/G0121/spec.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# 1. Goal
|
||||
A coffee roastery plans its daily production. A planning program calls one
|
||||
function module for each production day. The function module groups the roast
|
||||
order lines of the day by coffee blend and returns the total green coffee
|
||||
quantity of each blend. The planning program shows the blend with the largest
|
||||
quantity first.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Function group {{P}}FG_ROAST exists in package $TMP.
|
||||
- Table {{P}}ROASTS exists in package $TMP. It stores the roast order lines of
|
||||
a production day.
|
||||
- Table {{P}}BLENDS exists in package $TMP. It is the line type of the result
|
||||
table.
|
||||
- The class {{P}}ROAST_SEED fills {{P}}ROASTS with sample data. Run it to get
|
||||
test data.
|
||||
|
||||
# 4. Contract
|
||||
- Create the function module {{P}}ROAST_SUM in function group {{P}}FG_ROAST.
|
||||
- Interface of {{P}}ROAST_SUM:
|
||||
- IMPORTING it_orders TYPE STANDARD TABLE OF {{P}}ROASTS
|
||||
- EXPORTING et_totals TYPE STANDARD TABLE OF {{P}}BLENDS
|
||||
- EXPORTING ev_grand_total TYPE decfloat34
|
||||
- The function module has no exceptions.
|
||||
|
||||
# 5. Business rules
|
||||
1. A line of it_orders is a production line if its quantity is greater than 0.
|
||||
A line with a quantity of 0 or less is not a production line.
|
||||
2. et_totals has exactly one line for each blend that has at least one
|
||||
production line in it_orders.
|
||||
3. The total quantity of a blend is the sum of the quantities of all its
|
||||
production lines.
|
||||
4. Sort et_totals by total quantity. The largest total quantity comes first.
|
||||
5. If two blends have the same total quantity, the blend that is smaller in the
|
||||
character order comes first.
|
||||
6. ev_grand_total is the sum of the total quantities of all lines of et_totals.
|
||||
7. If it_orders is empty, or if it_orders has no production line, et_totals is
|
||||
empty and ev_grand_total is 0.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 7.58.
|
||||
- Package: $TMP. Do not use transports.
|
||||
- Coding standard: Clean ABAP. Keep the function module short. Choose the
|
||||
internal table kind and the access path that fit the task.
|
||||
- Out of scope: do not change {{P}}ROASTS, {{P}}BLENDS, {{P}}ROAST_SEED.
|
||||
|
||||
# 7. Acceptance
|
||||
- The function module {{P}}ROAST_SUM is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write ABAP Unit tests for the function module in a global test class.
|
||||
92
tasks_gen/eval/G0121/task.json
Normal file
92
tasks_gen/eval/G0121/task.json
Normal file
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"id": "G0121",
|
||||
"category": "C",
|
||||
"object_type": "FUNC",
|
||||
"difficulty": 2,
|
||||
"release_target": "v758",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 40,
|
||||
"max_activations": 10
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "FUGR",
|
||||
"name": "{{P}}FG_ROAST",
|
||||
"description": "Roast production"
|
||||
},
|
||||
{
|
||||
"type": "TABL",
|
||||
"name": "{{P}}ROASTS",
|
||||
"file": "seed/roasts.tabl.abap",
|
||||
"description": "Roast order lines of a production day"
|
||||
},
|
||||
{
|
||||
"type": "TABL",
|
||||
"name": "{{P}}BLENDS",
|
||||
"file": "seed/blends.tabl.abap",
|
||||
"description": "Line type of the result table"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}ROAST_SEED",
|
||||
"file": "seed/roast_seed.clas.abap",
|
||||
"description": "Sample data for {{P}}ROASTS",
|
||||
"run": true
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}ROAST_SUM",
|
||||
"functionGroup": "{{P}}FG_ROAST",
|
||||
"params": [
|
||||
{
|
||||
"name": "it_orders",
|
||||
"type": "STANDARD TABLE OF {{P}}ROASTS"
|
||||
},
|
||||
{
|
||||
"name": "et_totals",
|
||||
"type": "STANDARD TABLE OF {{P}}BLENDS"
|
||||
},
|
||||
{
|
||||
"name": "ev_grand_total",
|
||||
"type": "decfloat34"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}ROASTS",
|
||||
"{{P}}BLENDS",
|
||||
"{{P}}ROAST_SEED"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T14_HIDDEN",
|
||||
"file": "hidden/t14_hidden.clas.abap",
|
||||
"description": "T14 hidden tests"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "FUNC",
|
||||
"name": "{{P}}ROAST_SUM",
|
||||
"functionGroup": "{{P}}FG_ROAST",
|
||||
"file": "reference/roast_sum.func.abap",
|
||||
"description": "Roast sum module"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}T14_TEST",
|
||||
"file": "reference/t14_test.clas.abap",
|
||||
"description": "T14 own tests"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length",
|
||||
"table_kind",
|
||||
"access_path"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user