Stage 2 summary at 50 accepted trajectories

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-05 18:02:52 +02:00
parent 332fb4601d
commit 5bcd1bf9cd
1230 changed files with 77563 additions and 33 deletions

View File

@@ -0,0 +1,16 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Tour load'
define view entity {{P}}I_TOUR_LOAD
as select from {{p}}tour as tour
left outer join {{p}}parcel as parcel on parcel.tour_id = tour.tour_id
{
key tour.tour_id as tour_id,
tour.driver as driver,
tour.depot as depot,
count( * ) as parcel_count,
sum( parcel.weight ) as total_weight
}
group by
tour.tour_id,
tour.driver,
tour.depot

View File

@@ -0,0 +1,16 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Tour load'
define view entity {{P}}I_TOUR_LOAD
as select from {{p}}tour as tour
inner join {{p}}parcel as parcel on parcel.tour_id <> tour.tour_id
{
key tour.tour_id as tour_id,
tour.driver as driver,
tour.depot as depot,
count( * ) as parcel_count,
sum( parcel.weight ) as total_weight
}
group by
tour.tour_id,
tour.driver,
tour.depot

View File

@@ -0,0 +1,16 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Tour load'
define view entity {{P}}I_TOUR_LOAD
as select from {{p}}tour as tour
inner join {{p}}parcel as parcel on parcel.tour_id = tour.tour_id
{
key tour.tour_id as tour_id,
tour.driver as driver,
tour.depot as depot,
count( * ) as parcel_count,
max( parcel.weight ) as total_weight
}
group by
tour.tour_id,
tour.driver,
tour.depot

View File

@@ -0,0 +1,19 @@
{
"id": "G1111",
"pool": "train",
"object_type": "DDLS",
"category": "I",
"attempts": [
{
"stage": "validate",
"oracle": 100.0,
"null": 0,
"mutation": {
"valid": 3,
"killed": 3,
"ok": true
}
}
],
"accepted": true
}

View File

@@ -0,0 +1,98 @@
CLASS {{p}}t31_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
CLASS-DATA go_env TYPE REF TO if_cds_test_environment.
CLASS-METHODS class_setup.
CLASS-METHODS class_teardown.
METHODS setup.
METHODS one_row_per_tour FOR TESTING.
METHODS counts_all_parcels FOR TESTING.
METHODS sums_all_weights FOR TESTING.
METHODS tour_without_parcels FOR TESTING.
METHODS driver_and_depot FOR TESTING.
METHODS single_parcel_tour FOR TESTING.
METHODS many_zones_one_row FOR TESTING.
METHODS empty_tables FOR TESTING.
ENDCLASS.
CLASS {{p}}t31_hidden IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_TOUR_LOAD' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_tour TYPE STANDARD TABLE OF {{p}}tour WITH EMPTY KEY.
DATA lt_parcel TYPE STANDARD TABLE OF {{p}}parcel WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_tour = VALUE #( ( tour_id = 'T1' driver = 'D1' depot = 'N01' )
( tour_id = 'T2' driver = 'D2' depot = 'N01' )
( tour_id = 'T3' driver = 'D3' depot = 'S02' )
( tour_id = 'T4' driver = 'D4' depot = 'S02' )
( tour_id = 'T5' driver = 'D5' depot = 'N01' ) ).
lt_parcel = VALUE #( ( tour_id = 'T1' parcel_no = 1 dest_zone = 'A' weight = '1.500' )
( tour_id = 'T1' parcel_no = 2 dest_zone = 'B' weight = '2.250' )
( tour_id = 'T1' parcel_no = 3 dest_zone = 'A' weight = '0.250' )
( tour_id = 'T2' parcel_no = 1 dest_zone = 'A' weight = '10.000' )
( tour_id = 'T4' parcel_no = 1 dest_zone = 'C' weight = '4.125' )
( tour_id = 'T5' parcel_no = 1 dest_zone = 'A' weight = '1.000' )
( tour_id = 'T5' parcel_no = 2 dest_zone = 'B' weight = '1.000' )
( tour_id = 'T5' parcel_no = 3 dest_zone = 'C' weight = '1.000' )
( tour_id = 'T5' parcel_no = 4 dest_zone = 'D' weight = '1.000' ) ).
go_env->insert_test_data( lt_tour ).
go_env->insert_test_data( lt_parcel ).
ENDMETHOD.
METHOD one_row_per_tour.
SELECT COUNT(*) FROM {{p}}i_tour_load INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 4 act = lv_rows ).
ENDMETHOD.
METHOD counts_all_parcels.
SELECT SINGLE parcel_count FROM {{p}}i_tour_load WHERE tour_id = 'T1' INTO @DATA(lv_count).
cl_abap_unit_assert=>assert_equals( exp = 3 act = lv_count ).
ENDMETHOD.
METHOD sums_all_weights.
SELECT SINGLE total_weight FROM {{p}}i_tour_load WHERE tour_id = 'T1' INTO @DATA(lv_weight).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '4.000' )
act = CONV decfloat34( lv_weight ) ).
ENDMETHOD.
METHOD tour_without_parcels.
SELECT COUNT(*) FROM {{p}}i_tour_load WHERE tour_id = 'T3' INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rows ).
ENDMETHOD.
METHOD driver_and_depot.
SELECT SINGLE driver, depot FROM {{p}}i_tour_load WHERE tour_id = 'T2' INTO @DATA(ls_row).
cl_abap_unit_assert=>assert_equals( exp = 'D2' act = ls_row-driver ).
cl_abap_unit_assert=>assert_equals( exp = 'N01' act = ls_row-depot ).
ENDMETHOD.
METHOD single_parcel_tour.
SELECT SINGLE parcel_count, total_weight FROM {{p}}i_tour_load WHERE tour_id = 'T4'
INTO @DATA(ls_row).
cl_abap_unit_assert=>assert_equals( exp = 1 act = ls_row-parcel_count ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '4.125' )
act = CONV decfloat34( ls_row-total_weight ) ).
ENDMETHOD.
METHOD many_zones_one_row.
SELECT SINGLE parcel_count, total_weight FROM {{p}}i_tour_load WHERE tour_id = 'T5'
INTO @DATA(ls_row).
cl_abap_unit_assert=>assert_equals( exp = 4 act = ls_row-parcel_count ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '4.000' )
act = CONV decfloat34( ls_row-total_weight ) ).
ENDMETHOD.
METHOD empty_tables.
go_env->clear_doubles( ).
SELECT COUNT(*) FROM {{p}}i_tour_load INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rows ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,43 @@
{
"task": "G1111",
"mutants": [
{
"object": "{{P}}I_TOUR_LOAD",
"mutant": "line 5: inner join -> left outer join (join)",
"status": "killed",
"hidden": "6/8",
"failed_tests": [
"ONE_ROW_PER_TOUR",
"TOUR_WITHOUT_PARCELS"
]
},
{
"object": "{{P}}I_TOUR_LOAD",
"mutant": "line 5: = -> <> (eq)",
"status": "killed",
"hidden": "2/8",
"failed_tests": [
"COUNTS_ALL_PARCELS",
"MANY_ZONES_ONE_ROW",
"ONE_ROW_PER_TOUR",
"SINGLE_PARCEL_TOUR",
"SUMS_ALL_WEIGHTS",
"TOUR_WITHOUT_PARCELS"
]
},
{
"object": "{{P}}I_TOUR_LOAD",
"mutant": "line 11: sum( -> max( (agg)",
"status": "killed",
"hidden": "6/8",
"failed_tests": [
"MANY_ZONES_ONE_ROW",
"SUMS_ALL_WEIGHTS"
]
}
],
"valid": 3,
"killed": 3,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,16 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Tour load'
define view entity {{P}}I_TOUR_LOAD
as select from {{p}}tour as tour
inner join {{p}}parcel as parcel on parcel.tour_id = tour.tour_id
{
key tour.tour_id as tour_id,
tour.driver as driver,
tour.depot as depot,
count( * ) as parcel_count,
sum( parcel.weight ) as total_weight
}
group by
tour.tour_id,
tour.driver,
tour.depot

View File

@@ -0,0 +1,52 @@
CLASS {{p}}t31_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
CLASS-DATA go_env TYPE REF TO if_cds_test_environment.
CLASS-METHODS class_setup.
CLASS-METHODS class_teardown.
METHODS setup.
METHODS one_row_for_multi_zone FOR TESTING.
METHODS total_of_two_parcels FOR TESTING.
ENDCLASS.
CLASS {{p}}t31_test IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_TOUR_LOAD' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
go_env->clear_doubles( ).
ENDMETHOD.
METHOD one_row_for_multi_zone.
DATA lt_tour TYPE STANDARD TABLE OF {{p}}tour WITH EMPTY KEY.
DATA lt_parcel TYPE STANDARD TABLE OF {{p}}parcel WITH EMPTY KEY.
lt_tour = VALUE #( ( tour_id = 'A' driver = 'DA' depot = 'N01' ) ).
lt_parcel = VALUE #( ( tour_id = 'A' parcel_no = 1 dest_zone = 'A' weight = '1.000' )
( tour_id = 'A' parcel_no = 2 dest_zone = 'B' weight = '2.000' ) ).
go_env->insert_test_data( lt_tour ).
go_env->insert_test_data( lt_parcel ).
SELECT COUNT(*) FROM {{p}}i_tour_load INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rows ).
ENDMETHOD.
METHOD total_of_two_parcels.
DATA lt_tour TYPE STANDARD TABLE OF {{p}}tour WITH EMPTY KEY.
DATA lt_parcel TYPE STANDARD TABLE OF {{p}}parcel WITH EMPTY KEY.
lt_tour = VALUE #( ( tour_id = 'B' driver = 'DB' depot = 'S02' ) ).
lt_parcel = VALUE #( ( tour_id = 'B' parcel_no = 1 dest_zone = 'A' weight = '1.500' )
( tour_id = 'B' parcel_no = 2 dest_zone = 'A' weight = '2.500' ) ).
go_env->insert_test_data( lt_tour ).
go_env->insert_test_data( lt_parcel ).
SELECT SINGLE parcel_count, total_weight FROM {{p}}i_tour_load WHERE tour_id = 'B'
INTO @DATA(ls_row).
cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_row-parcel_count ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '4.000' )
act = CONV decfloat34( ls_row-total_weight ) ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,18 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Tour load'
define view entity {{P}}I_TOUR_LOAD
as select from {{p}}tour as tour
inner join {{p}}parcel as parcel on parcel.tour_id = tour.tour_id
{
key tour.tour_id as tour_id,
tour.driver as driver,
tour.depot as depot,
parcel.dest_zone as dest_zone,
count( * ) as parcel_count,
sum( parcel.weight ) as total_weight
}
group by
tour.tour_id,
tour.driver,
tour.depot,
parcel.dest_zone

View File

@@ -0,0 +1,12 @@
@EndUserText.label : 'Parcel of a tour'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}parcel {
key client : abap.clnt not null;
key tour_id : abap.char(10) not null;
key parcel_no : abap.int4 not null;
dest_zone : abap.char(4);
weight : abap.dec(8,3);
}

View File

@@ -0,0 +1,12 @@
@EndUserText.label : 'Tour header'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}tour {
key client : abap.clnt not null;
key tour_id : abap.char(10) not null;
driver : abap.char(10);
depot : abap.char(4);
tour_date : abap.dats;
}

View File

@@ -0,0 +1,43 @@
# 1. Goal
The CDS view entity {{P}}I_TOUR_LOAD in package $TMP shows the load of the
delivery tours of a courier depot. Users report that the view gives wrong
numbers. Fix the view. The name of the view stays the same.
# 2. Open questions
None.
# 3. Context
- Table {{P}}TOUR (tour header), package $TMP. Key: TOUR_ID (CHAR 10).
Fields: DRIVER (CHAR 10), DEPOT (CHAR 4), TOUR_DATE (DATS).
- Table {{P}}PARCEL (parcel of a tour), package $TMP. Key: TOUR_ID (CHAR 10),
PARCEL_NO (INT4). Fields: DEST_ZONE (CHAR 4, destination zone of the
parcel), WEIGHT (DEC 8,3).
- The CDS view entity {{P}}I_TOUR_LOAD reads the two tables.
- The view is active, but the result is wrong.
# 4. Contract
- Fix the CDS view entity {{P}}I_TOUR_LOAD in package $TMP. The object name
stays the same.
- Elements, with these names: TOUR_ID (key), DRIVER, DEPOT, PARCEL_COUNT,
TOTAL_WEIGHT.
- No authorization check (#NOT_REQUIRED).
# 5. Business rules
1. The view shows one row for each tour that has at least one parcel.
2. PARCEL_COUNT is the number of parcels of the tour.
3. TOTAL_WEIGHT is the sum of the weights of all parcels of the tour, with
3 decimals.
4. The destination zone of a parcel must not change the result of the view.
A tour with parcels in more than one zone appears exactly once.
5. All other behavior of the view stays the same.
# 6. Constraints
- Release target: SAP_BASIS 816.
- Coding standards: Clean ABAP. The view must be active and must not have a
syntax error.
- Out of scope: do not change the tables {{P}}TOUR and {{P}}PARCEL.
# 7. Acceptance
- The view is active and has no syntax error.
- The hidden tests pass.
- Write ABAP Unit tests with CL_CDS_TEST_ENVIRONMENT in a global test class.

View File

@@ -0,0 +1,72 @@
{
"id": "G1111",
"category": "I",
"object_type": "DDLS",
"difficulty": 2,
"release_target": "v816",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 60,
"max_activations": 15
},
"seed": [
{
"type": "TABL",
"name": "{{P}}TOUR",
"file": "seed/tour.tabl.asabap",
"description": "Tour header"
},
{
"type": "TABL",
"name": "{{P}}PARCEL",
"file": "seed/parcel.tabl.asabap",
"description": "Parcel of a tour"
},
{
"type": "DDLS",
"name": "{{P}}I_TOUR_LOAD",
"file": "seed/i_tour_load.ddls.asddls",
"description": "Tour load (faulty: aggregated at zone level)"
}
],
"contract": [
{
"type": "DDLS",
"name": "{{P}}I_TOUR_LOAD",
"fields": [
"TOUR_ID",
"DRIVER",
"DEPOT",
"PARCEL_COUNT",
"TOTAL_WEIGHT"
]
}
],
"out_of_scope": [
"{{P}}TOUR",
"{{P}}PARCEL"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}T31_HIDDEN",
"file": "hidden/t31_hidden.clas.abap",
"description": "T31 hidden tests"
}
],
"reference": [
{
"type": "DDLS",
"name": "{{P}}I_TOUR_LOAD",
"file": "reference/i_tour_load.ddls.asddls",
"description": "Fixed tour load"
},
{
"type": "CLAS",
"name": "{{P}}T31_TEST",
"file": "reference/t31_test.clas.abap",
"description": "T31 own tests"
}
],
"craft_checks": []
}