Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
104
tasks_gen/train/G1140/hidden/mill_hidden.clas.abap
Normal file
104
tasks_gen/train/G1140/hidden/mill_hidden.clas.abap
Normal file
@@ -0,0 +1,104 @@
|
||||
CLASS {{p}}mill_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
TYPES tt_region TYPE RANGE OF {{p}}grove-region.
|
||||
METHODS run
|
||||
IMPORTING iv_from 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 amount_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_regions FOR TESTING.
|
||||
METHODS sorted_by_litres FOR TESTING.
|
||||
METHODS litres_and_kilos FOR TESTING.
|
||||
METHODS region_filter FOR TESTING.
|
||||
METHODS two_region_filter FOR TESTING.
|
||||
METHODS date_filter FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}mill_hidden IMPLEMENTATION.
|
||||
METHOD run.
|
||||
cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ).
|
||||
SUBMIT {{p}}oil_report
|
||||
WITH p_from = iv_from
|
||||
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 amount_of.
|
||||
DATA lv_amount TYPE p LENGTH 15 DECIMALS 2.
|
||||
lv_amount = value_of( ir_data = ir_data iv_row = iv_row iv_col = iv_col ).
|
||||
rv_value = CONV string( lv_amount ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD all_regions.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3 act = lines_of( run( '20260101' ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD sorted_by_litres.
|
||||
DATA(lr_data) = run( '20260101' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `NORTH` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `REGION` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `SOUTH` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `REGION` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `WEST` act = value_of( ir_data = lr_data iv_row = 3 iv_col = `REGION` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD litres_and_kilos.
|
||||
DATA(lr_data) = run( '20260101' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `290.00` act = amount_of( ir_data = lr_data iv_row = 1 iv_col = `LITRES` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `1500` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `KILOS` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD region_filter.
|
||||
DATA(lr_data) = run( iv_from = '20260101'
|
||||
it_region = VALUE #( ( sign = 'I' option = 'EQ' low = 'SOUTH' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `150.00` act = amount_of( ir_data = lr_data iv_row = 1 iv_col = `LITRES` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD two_region_filter.
|
||||
DATA(lr_data) = run( iv_from = '20260101'
|
||||
it_region = VALUE #( ( sign = 'I' option = 'EQ' low = 'WEST' )
|
||||
( sign = 'I' option = 'EQ' low = 'SOUTH' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `SOUTH` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `REGION` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `WEST` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `REGION` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD date_filter.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( run( '20260201' ) ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
44
tasks_gen/train/G1140/mutation.json
Normal file
44
tasks_gen/train/G1140/mutation.json
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"task": "T50",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}OIL_REPORT",
|
||||
"mutant": "line 33: >= -> < (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "0/6",
|
||||
"failed_tests": [
|
||||
"ALL_REGIONS",
|
||||
"SORTED_BY_LITRES",
|
||||
"LITRES_AND_KILOS",
|
||||
"REGION_FILTER",
|
||||
"TWO_REGION_FILTER",
|
||||
"DATE_FILTER"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}OIL_REPORT",
|
||||
"mutant": "line 34: AND -> OR (logic)",
|
||||
"status": "killed",
|
||||
"hidden": "3/6",
|
||||
"failed_tests": [
|
||||
"REGION_FILTER",
|
||||
"TWO_REGION_FILTER",
|
||||
"DATE_FILTER"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}OIL_REPORT",
|
||||
"mutant": "line 36: DESCENDING -> ASCENDING (order)",
|
||||
"status": "killed",
|
||||
"hidden": "4/6",
|
||||
"failed_tests": [
|
||||
"SORTED_BY_LITRES",
|
||||
"TWO_REGION_FILTER"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 3,
|
||||
"killed": 3,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
105
tasks_gen/train/G1140/reference/oil_report.prog.abap
Normal file
105
tasks_gen/train/G1140/reference/oil_report.prog.abap
Normal file
@@ -0,0 +1,105 @@
|
||||
REPORT {{p}}oil_report.
|
||||
|
||||
DATA gv_region TYPE {{p}}grove-region.
|
||||
|
||||
PARAMETERS p_from TYPE d OBLIGATORY.
|
||||
SELECT-OPTIONS s_reg FOR gv_region.
|
||||
|
||||
CLASS lcl_report DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
TYPES:
|
||||
BEGIN OF ty_line,
|
||||
region TYPE {{p}}grove-region,
|
||||
litres TYPE {{p}}press-litres,
|
||||
kilos TYPE {{p}}press-kilos,
|
||||
END OF ty_line,
|
||||
tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY.
|
||||
TYPES tt_region TYPE RANGE OF {{p}}grove-region.
|
||||
METHODS collect
|
||||
IMPORTING iv_from TYPE d
|
||||
it_region TYPE tt_region
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
METHODS show
|
||||
CHANGING ct_lines TYPE tt_line.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_report IMPLEMENTATION.
|
||||
METHOD collect.
|
||||
SELECT gr~region,
|
||||
SUM( pr~litres ) AS litres,
|
||||
SUM( pr~kilos ) AS kilos
|
||||
FROM {{p}}press AS pr
|
||||
INNER JOIN {{p}}grove AS gr ON gr~grove_id = pr~grove_id
|
||||
WHERE pr~press_date >= @iv_from
|
||||
AND gr~region IN @it_region
|
||||
GROUP BY gr~region
|
||||
ORDER BY litres DESCENDING
|
||||
INTO CORRESPONDING FIELDS OF TABLE @rt_lines.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD show.
|
||||
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->collect( iv_from = p_from it_region = s_reg[] ).
|
||||
go_report->show( 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 litres_per_region FOR TESTING.
|
||||
METHODS region_filter FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltc_report IMPLEMENTATION.
|
||||
METHOD class_setup.
|
||||
go_env = cl_osql_test_environment=>create(
|
||||
i_dependency_list = VALUE #( ( '{{P}}GROVE' ) ( '{{P}}PRESS' ) ) ).
|
||||
DATA lt_grove TYPE STANDARD TABLE OF {{p}}grove WITH EMPTY KEY.
|
||||
lt_grove = VALUE #( ( grove_id = 1 grove_name = 'A' region = 'NORTH' variety = 'ARBEQ' )
|
||||
( grove_id = 2 grove_name = 'B' region = 'NORTH' variety = 'ARBEQ' )
|
||||
( grove_id = 3 grove_name = 'C' region = 'SOUTH' variety = 'PICUA' ) ).
|
||||
go_env->insert_test_data( lt_grove ).
|
||||
DATA lt_press TYPE STANDARD TABLE OF {{p}}press WITH EMPTY KEY.
|
||||
lt_press = VALUE #( ( press_id = 1 grove_id = 1 press_date = '20260110' kilos = 1000 litres = '200.00' )
|
||||
( press_id = 2 grove_id = 2 press_date = '20260111' kilos = 500 litres = '90.00' )
|
||||
( press_id = 3 grove_id = 3 press_date = '20260112' kilos = 800 litres = '150.00' ) ).
|
||||
go_env->insert_test_data( lt_press ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD litres_per_region.
|
||||
DATA lv_expected TYPE {{p}}press-litres.
|
||||
lv_expected = '290.00'.
|
||||
DATA(lt_lines) = NEW lcl_report( )->collect(
|
||||
iv_from = '20260101' it_region = VALUE #( ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'NORTH' act = lt_lines[ 1 ]-region ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lt_lines[ 1 ]-litres ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1500 act = lt_lines[ 1 ]-kilos ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD region_filter.
|
||||
DATA lv_expected TYPE {{p}}press-litres.
|
||||
lv_expected = '150.00'.
|
||||
DATA(lt_lines) = NEW lcl_report( )->collect(
|
||||
iv_from = '20260101'
|
||||
it_region = VALUE #( ( sign = 'I' option = 'EQ' low = 'SOUTH' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lt_lines[ 1 ]-litres ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
12
tasks_gen/train/G1140/seed/grove.tabl.asabap
Normal file
12
tasks_gen/train/G1140/seed/grove.tabl.asabap
Normal file
@@ -0,0 +1,12 @@
|
||||
@EndUserText.label : 'Olive grove'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}grove {
|
||||
key client : abap.clnt not null;
|
||||
key grove_id : abap.int4 not null;
|
||||
grove_name : abap.char(30);
|
||||
region : abap.char(8);
|
||||
variety : abap.char(10);
|
||||
}
|
||||
24
tasks_gen/train/G1140/seed/mill_seed.clas.abap
Normal file
24
tasks_gen/train/G1140/seed/mill_seed.clas.abap
Normal file
@@ -0,0 +1,24 @@
|
||||
CLASS {{p}}mill_seed DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES if_oo_adt_classrun.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS {{p}}mill_seed IMPLEMENTATION.
|
||||
METHOD if_oo_adt_classrun~main.
|
||||
DELETE FROM {{p}}press.
|
||||
DELETE FROM {{p}}grove.
|
||||
INSERT {{p}}grove FROM TABLE @( VALUE #(
|
||||
( grove_id = 1 grove_name = 'North Ridge' region = 'NORTH' variety = 'ARBEQ' )
|
||||
( grove_id = 2 grove_name = 'Sunny Slope' region = 'NORTH' variety = 'ARBEQ' )
|
||||
( grove_id = 3 grove_name = 'Hill Top' region = 'SOUTH' variety = 'PICUA' )
|
||||
( grove_id = 4 grove_name = 'Valley Farm' region = 'EAST' variety = 'PICUA' )
|
||||
( grove_id = 5 grove_name = 'Old Mill' region = 'WEST' variety = 'KORON' ) ) ).
|
||||
INSERT {{p}}press FROM TABLE @( VALUE #(
|
||||
( press_id = 1 grove_id = 1 press_date = '20260110' kilos = 1000 litres = '200.00' )
|
||||
( press_id = 2 grove_id = 2 press_date = '20260210' kilos = 500 litres = '90.00' )
|
||||
( press_id = 3 grove_id = 3 press_date = '20260115' kilos = 800 litres = '150.00' )
|
||||
( press_id = 4 grove_id = 4 press_date = '20251231' kilos = 600 litres = '120.00' )
|
||||
( press_id = 5 grove_id = 5 press_date = '20260301' kilos = 400 litres = '80.00' ) ) ).
|
||||
out->write( sy-dbcnt ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
13
tasks_gen/train/G1140/seed/press.tabl.asabap
Normal file
13
tasks_gen/train/G1140/seed/press.tabl.asabap
Normal file
@@ -0,0 +1,13 @@
|
||||
@EndUserText.label : 'Olive pressing'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}press {
|
||||
key client : abap.clnt not null;
|
||||
key press_id : abap.int4 not null;
|
||||
grove_id : abap.int4 not null;
|
||||
press_date : abap.dats;
|
||||
kilos : abap.int4;
|
||||
litres : abap.dec(9,2);
|
||||
}
|
||||
41
tasks_gen/train/G1140/spec.md
Normal file
41
tasks_gen/train/G1140/spec.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# 1. Goal
|
||||
An olive oil mill presses the olives that its member groves deliver. Show the
|
||||
oil output of each growing region for a period in an ALV list. The mill manager
|
||||
uses the list to compare the regions.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Table {{P}}GROVE is in package $TMP and contains data.
|
||||
Fields: GROVE_ID (INT4, key), GROVE_NAME (CHAR 30), REGION (CHAR 8),
|
||||
VARIETY (CHAR 10).
|
||||
- Table {{P}}PRESS is in package $TMP and contains data.
|
||||
Fields: PRESS_ID (INT4, key), GROVE_ID (INT4), PRESS_DATE (DATS),
|
||||
KILOS (INT4), LITRES (DEC 9,2).
|
||||
|
||||
# 4. Contract
|
||||
- Create the executable program {{P}}OIL_REPORT in package $TMP.
|
||||
- Selection screen:
|
||||
- Parameter P_FROM, type DATS, mandatory: the first pressing date to include.
|
||||
- Select-option S_REG for the growing region.
|
||||
- Show the result with CL_SALV_TABLE. The output table has these columns with
|
||||
these names: REGION, LITRES, KILOS.
|
||||
|
||||
# 5. Business rules
|
||||
1. Include a pressing only if PRESS_DATE is on or after P_FROM and the region of
|
||||
the grove that delivered the olives is in S_REG.
|
||||
2. LITRES of a region is the sum of the litres of all included pressings.
|
||||
3. KILOS of a region is the sum of the kilos of all included pressings.
|
||||
4. Show one line for each region with at least one included pressing.
|
||||
5. Sort the lines by LITRES, the highest value first.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16.
|
||||
- Coding standards: Clean ABAP. Read the data with one database access.
|
||||
- Out of scope: do not change {{P}}GROVE and {{P}}PRESS.
|
||||
|
||||
# 7. Acceptance
|
||||
- The program is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write ABAP Unit tests as local test classes in the program.
|
||||
67
tasks_gen/train/G1140/task.json
Normal file
67
tasks_gen/train/G1140/task.json
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"id": "G1140",
|
||||
"category": "B",
|
||||
"object_type": "PROG",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "TABL",
|
||||
"name": "{{P}}GROVE",
|
||||
"file": "seed/grove.tabl.asabap",
|
||||
"description": "Olive groves of the mill members"
|
||||
},
|
||||
{
|
||||
"type": "TABL",
|
||||
"name": "{{P}}PRESS",
|
||||
"file": "seed/press.tabl.asabap",
|
||||
"description": "Pressing records of the olive mill"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}MILL_SEED",
|
||||
"file": "seed/mill_seed.clas.abap",
|
||||
"description": "Seed data for the olive mill",
|
||||
"run": true
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "PROG",
|
||||
"name": "{{P}}OIL_REPORT",
|
||||
"parameters": [
|
||||
"p_from",
|
||||
"s_reg"
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}GROVE",
|
||||
"{{P}}PRESS"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}MILL_HIDDEN",
|
||||
"file": "hidden/mill_hidden.clas.abap",
|
||||
"description": "Hidden tests for the olive oil output report"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "PROG",
|
||||
"name": "{{P}}OIL_REPORT",
|
||||
"file": "reference/oil_report.prog.abap",
|
||||
"description": "Oil output per growing region"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"db_operation_in_loop",
|
||||
"method_length"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user