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,15 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Ferry route load'
define view entity {{P}}I_ROUTE_LOAD
as select from {{p}}sail as sail
left outer join {{p}}veh as veh on veh.sail_id = sail.sail_id
{
key sail.route_id as route_id,
count( * ) as veh_count,
sum( veh.weight_kg ) as total_weight,
sum( veh.fee ) as total_fee
}
group by
sail.route_id
having
sum( veh.weight_kg ) > 10000

View File

@@ -0,0 +1,15 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Ferry route load'
define view entity {{P}}I_ROUTE_LOAD
as select from {{p}}sail as sail
inner join {{p}}veh as veh on veh.sail_id = sail.sail_id
{
key sail.route_id as route_id,
count( * ) as veh_count,
sum( veh.weight_kg ) as total_weight,
max( veh.fee ) as total_fee
}
group by
sail.route_id
having
sum( veh.weight_kg ) > 10000

View File

@@ -0,0 +1,15 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Ferry route load'
define view entity {{P}}I_ROUTE_LOAD
as select from {{p}}sail as sail
inner join {{p}}veh as veh on veh.sail_id = sail.sail_id
{
key sail.route_id as route_id,
count( * ) as veh_count,
sum( veh.weight_kg ) as total_weight,
sum( veh.fee ) as total_fee
}
group by
sail.route_id
having
max( veh.weight_kg ) > 10000

View File

@@ -0,0 +1,15 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Ferry route load'
define view entity {{P}}I_ROUTE_LOAD
as select from {{p}}sail as sail
inner join {{p}}veh as veh on veh.sail_id = sail.sail_id
{
key sail.route_id as route_id,
count( * ) as veh_count,
sum( veh.weight_kg ) as total_weight,
sum( veh.fee ) as total_fee
}
group by
sail.route_id
having
sum( veh.weight_kg ) <= 10000

View File

@@ -0,0 +1,15 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Ferry route load'
define view entity {{P}}I_ROUTE_LOAD
as select from {{p}}sail as sail
inner join {{p}}veh as veh on veh.sail_id = sail.sail_id
{
key sail.route_id as route_id,
count( * ) as veh_count,
sum( veh.weight_kg ) as total_weight,
sum( veh.fee ) as total_fee
}
group by
sail.route_id
having
sum( veh.weight_kg ) > 10001

View File

@@ -0,0 +1,38 @@
{
"id": "G1092",
"pool": "train",
"object_type": "DDLS",
"category": "B",
"attempts": [
{
"stage": "validate",
"oracle": 100.0,
"null": 0,
"mutation": {
"valid": 5,
"killed": 2,
"ok": false
}
},
{
"stage": "bundle",
"errors": [
"hidden/t16_hidden.clas.abap: name veh_count_ignores_empty_sailing has 31 characters (ABAP max 30)"
],
"by_check": {
"static": 1
}
},
{
"stage": "validate",
"oracle": 100.0,
"null": 0,
"mutation": {
"valid": 5,
"killed": 5,
"ok": true
}
}
],
"accepted": true
}

View File

@@ -0,0 +1,125 @@
CLASS {{p}}t16_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 route_above_limit FOR TESTING.
METHODS veh_count_skips_empty_sail FOR TESTING.
METHODS total_fee_sum FOR TESTING.
METHODS second_route_shown FOR TESTING.
METHODS total_not_max FOR TESTING.
METHODS fee_of_multi_sailing_route FOR TESTING.
METHODS just_above_limit FOR TESTING.
METHODS route_below_limit FOR TESTING.
METHODS boundary_not_shown FOR TESTING.
METHODS route_without_vehicles FOR TESTING.
METHODS row_count FOR TESTING.
ENDCLASS.
CLASS {{p}}t16_hidden IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_ROUTE_LOAD' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_sail TYPE STANDARD TABLE OF {{p}}sail WITH EMPTY KEY.
DATA lt_veh TYPE STANDARD TABLE OF {{p}}veh WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_sail = VALUE #( ( sail_id = 'S1' route_id = 'R1' )
( sail_id = 'S2' route_id = 'R1' )
( sail_id = 'S7' route_id = 'R1' )
( sail_id = 'S3' route_id = 'R2' )
( sail_id = 'S4' route_id = 'R3' )
( sail_id = 'S5' route_id = 'R4' )
( sail_id = 'S6' route_id = 'R5' )
( sail_id = 'S8' route_id = 'R6' )
( sail_id = 'S9' route_id = 'R6' )
( sail_id = 'S10' route_id = 'R7' ) ).
lt_veh = VALUE #( ( sail_id = 'S1' veh_no = 1 veh_type = 'CAR' weight_kg = 1500 fee = '50.00' )
( sail_id = 'S1' veh_no = 2 veh_type = 'TRUCK' weight_kg = 12000 fee = '200.00' )
( sail_id = 'S2' veh_no = 1 veh_type = 'CAR' weight_kg = 1800 fee = '60.00' )
( sail_id = 'S3' veh_no = 1 veh_type = 'CAR' weight_kg = 2000 fee = '55.00' )
( sail_id = 'S4' veh_no = 1 veh_type = 'CAR' weight_kg = 10000 fee = '90.00' )
( sail_id = 'S5' veh_no = 1 veh_type = 'CAR' weight_kg = 11000 fee = '100.00' )
( sail_id = 'S8' veh_no = 1 veh_type = 'CAR' weight_kg = 6000 fee = '40.00' )
( sail_id = 'S9' veh_no = 1 veh_type = 'CAR' weight_kg = 6000 fee = '60.00' )
( sail_id = 'S10' veh_no = 1 veh_type = 'CAR' weight_kg = 10001 fee = '80.00' ) ).
go_env->insert_test_data( lt_sail ).
go_env->insert_test_data( lt_veh ).
ENDMETHOD.
METHOD route_above_limit.
SELECT SINGLE total_weight FROM {{p}}i_route_load WHERE route_id = 'R1'
INTO @DATA(lv_weight).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 15300 )
act = CONV decfloat34( lv_weight ) ).
ENDMETHOD.
METHOD veh_count_skips_empty_sail.
SELECT SINGLE veh_count FROM {{p}}i_route_load WHERE route_id = 'R1'
INTO @DATA(lv_count).
cl_abap_unit_assert=>assert_equals( exp = 3 act = lv_count ).
ENDMETHOD.
METHOD total_fee_sum.
SELECT SINGLE total_fee FROM {{p}}i_route_load WHERE route_id = 'R1'
INTO @DATA(lv_fee).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '310.00' )
act = CONV decfloat34( lv_fee ) ).
ENDMETHOD.
METHOD second_route_shown.
SELECT SINGLE total_weight FROM {{p}}i_route_load WHERE route_id = 'R4'
INTO @DATA(lv_weight).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 11000 )
act = CONV decfloat34( lv_weight ) ).
ENDMETHOD.
METHOD total_not_max.
SELECT SINGLE total_weight FROM {{p}}i_route_load WHERE route_id = 'R6'
INTO @DATA(lv_weight).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 12000 )
act = CONV decfloat34( lv_weight ) ).
ENDMETHOD.
METHOD fee_of_multi_sailing_route.
SELECT SINGLE total_fee FROM {{p}}i_route_load WHERE route_id = 'R6'
INTO @DATA(lv_fee).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '100.00' )
act = CONV decfloat34( lv_fee ) ).
ENDMETHOD.
METHOD just_above_limit.
SELECT SINGLE total_weight FROM {{p}}i_route_load WHERE route_id = 'R7'
INTO @DATA(lv_weight).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 10001 )
act = CONV decfloat34( lv_weight ) ).
ENDMETHOD.
METHOD route_below_limit.
SELECT COUNT(*) FROM {{p}}i_route_load WHERE route_id = 'R2' INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rows ).
ENDMETHOD.
METHOD boundary_not_shown.
SELECT COUNT(*) FROM {{p}}i_route_load WHERE route_id = 'R3' INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rows ).
ENDMETHOD.
METHOD route_without_vehicles.
SELECT COUNT(*) FROM {{p}}i_route_load WHERE route_id = 'R5' INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rows ).
ENDMETHOD.
METHOD row_count.
SELECT COUNT(*) FROM {{p}}i_route_load INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 4 act = lv_rows ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,67 @@
{
"task": "G1092",
"mutants": [
{
"object": "{{P}}I_ROUTE_LOAD",
"mutant": "line 5: inner join -> left outer join (join)",
"status": "killed",
"hidden": "10/11",
"failed_tests": [
"VEH_COUNT_SKIPS_EMPTY_SAIL"
]
},
{
"object": "{{P}}I_ROUTE_LOAD",
"mutant": "line 10: sum( -> max( (agg)",
"status": "killed",
"hidden": "9/11",
"failed_tests": [
"FEE_OF_MULTI_SAILING_ROUTE",
"TOTAL_FEE_SUM"
]
},
{
"object": "{{P}}I_ROUTE_LOAD",
"mutant": "line 15: sum( -> max( (agg)",
"status": "killed",
"hidden": "8/11",
"failed_tests": [
"FEE_OF_MULTI_SAILING_ROUTE",
"ROW_COUNT",
"TOTAL_NOT_MAX"
]
},
{
"object": "{{P}}I_ROUTE_LOAD",
"mutant": "line 15: > -> <= (rel)",
"status": "killed",
"hidden": "1/11",
"failed_tests": [
"BOUNDARY_NOT_SHOWN",
"FEE_OF_MULTI_SAILING_ROUTE",
"JUST_ABOVE_LIMIT",
"ROUTE_ABOVE_LIMIT",
"ROUTE_BELOW_LIMIT",
"ROW_COUNT",
"SECOND_ROUTE_SHOWN",
"TOTAL_FEE_SUM",
"TOTAL_NOT_MAX",
"VEH_COUNT_SKIPS_EMPTY_SAIL"
]
},
{
"object": "{{P}}I_ROUTE_LOAD",
"mutant": "line 15: 10000 -> 10001 (const)",
"status": "killed",
"hidden": "9/11",
"failed_tests": [
"JUST_ABOVE_LIMIT",
"ROW_COUNT"
]
}
],
"valid": 5,
"killed": 5,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,15 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Ferry route load'
define view entity {{P}}I_ROUTE_LOAD
as select from {{p}}sail as sail
inner join {{p}}veh as veh on veh.sail_id = sail.sail_id
{
key sail.route_id as route_id,
count( * ) as veh_count,
sum( veh.weight_kg ) as total_weight,
sum( veh.fee ) as total_fee
}
group by
sail.route_id
having
sum( veh.weight_kg ) > 10000

View File

@@ -0,0 +1,59 @@
CLASS {{p}}t16_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 load_of_one_route FOR TESTING.
METHODS light_route_hidden FOR TESTING.
METHODS just_above_limit_shown FOR TESTING.
ENDCLASS.
CLASS {{p}}t16_test IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_ROUTE_LOAD' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_sail TYPE STANDARD TABLE OF {{p}}sail WITH EMPTY KEY.
DATA lt_veh TYPE STANDARD TABLE OF {{p}}veh WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_sail = VALUE #( ( sail_id = 'A1' route_id = 'NORTH' )
( sail_id = 'A2' route_id = 'SOUTH' )
( sail_id = 'A3' route_id = 'EDGE' ) ).
lt_veh = VALUE #( ( sail_id = 'A1' veh_no = 1 veh_type = 'CAR' weight_kg = 8000 fee = '40.00' )
( sail_id = 'A1' veh_no = 2 veh_type = 'TRUCK' weight_kg = 5000 fee = '75.00' )
( sail_id = 'A2' veh_no = 1 veh_type = 'CAR' weight_kg = 1200 fee = '20.00' )
( sail_id = 'A3' veh_no = 1 veh_type = 'CAR' weight_kg = 10001 fee = '80.00' ) ).
go_env->insert_test_data( lt_sail ).
go_env->insert_test_data( lt_veh ).
ENDMETHOD.
METHOD load_of_one_route.
SELECT SINGLE veh_count, total_weight, total_fee FROM {{p}}i_route_load
WHERE route_id = 'NORTH' INTO @DATA(ls_load).
cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_load-veh_count ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 13000 )
act = CONV decfloat34( ls_load-total_weight ) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '115.00' )
act = CONV decfloat34( ls_load-total_fee ) ).
ENDMETHOD.
METHOD light_route_hidden.
SELECT COUNT(*) FROM {{p}}i_route_load WHERE route_id = 'SOUTH' INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rows ).
ENDMETHOD.
METHOD just_above_limit_shown.
SELECT SINGLE total_weight FROM {{p}}i_route_load WHERE route_id = 'EDGE'
INTO @DATA(lv_weight).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 10001 )
act = CONV decfloat34( lv_weight ) ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,11 @@
@EndUserText.label : 'Ferry sailing'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}sail {
key client : abap.clnt not null;
key sail_id : abap.char(10) not null;
route_id : abap.char(10);
sail_date : abap.dats;
}

View File

@@ -0,0 +1,13 @@
@EndUserText.label : 'Vehicle on board'
@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 sail_id : abap.char(10) not null;
key veh_no : abap.int4 not null;
veh_type : abap.char(4);
weight_kg : abap.int4;
fee : abap.dec(15,2);
}

View File

@@ -0,0 +1,41 @@
# 1. Goal
A ferry operator wants to know the load of each of its routes. A report and an
OData service will read the load. The calculation must run in the database, in a
CDS view.
# 2. Open questions
None.
# 3. Context
- Table {{P}}SAIL (ferry sailing), package $TMP. Key: SAIL_ID (CHAR 10).
Fields: ROUTE_ID (CHAR 10), SAIL_DATE (DATS).
- Table {{P}}VEH (vehicle on board), package $TMP. Key: SAIL_ID (CHAR 10) and
VEH_NO (INT4). Fields: VEH_TYPE (CHAR 4), WEIGHT_KG (INT4),
FEE (DEC 15,2, the fee that the vehicle pays for the crossing).
- A route has one or more sailings. A sailing has zero or more vehicles.
# 4. Contract
- Create the CDS view entity {{P}}I_ROUTE_LOAD in package $TMP.
- Elements, with these names: ROUTE_ID (key), VEH_COUNT, TOTAL_WEIGHT, TOTAL_FEE.
- No authorization check (#NOT_REQUIRED).
# 5. Business rules
1. Show one row for each route that has at least one vehicle on one of its
sailings. Do not show a route without vehicles.
2. VEH_COUNT is the number of vehicles on all sailings of the route. A sailing
without vehicles does not add to VEH_COUNT.
3. TOTAL_WEIGHT is the sum of WEIGHT_KG of these vehicles, in kilograms.
4. TOTAL_FEE is the sum of FEE of these vehicles, with 2 decimals.
5. Show only the routes whose total weight is more than 10,000 kg. A route whose
total weight is 10,000 kg or less must not appear. A route whose total weight
is 10,001 kg must appear.
# 6. Constraints
- Release target: 8.16 (ABAP Platform 2025).
- Coding standards: Clean ABAP. Keep methods below 40 statements.
- Out of scope: do not change {{P}}SAIL and {{P}}VEH.
# 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,65 @@
{
"id": "G1092",
"category": "B",
"object_type": "DDLS",
"difficulty": 2,
"release_target": "v816",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 60,
"max_activations": 15
},
"seed": [
{
"type": "TABL",
"name": "{{P}}SAIL",
"file": "seed/sail.tabl.asabap",
"description": "Ferry sailing"
},
{
"type": "TABL",
"name": "{{P}}VEH",
"file": "seed/veh.tabl.asabap",
"description": "Vehicle on board"
}
],
"contract": [
{
"type": "DDLS",
"name": "{{P}}I_ROUTE_LOAD",
"fields": [
"ROUTE_ID",
"VEH_COUNT",
"TOTAL_WEIGHT",
"TOTAL_FEE"
]
}
],
"out_of_scope": [
"{{P}}SAIL",
"{{P}}VEH"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}T16_HIDDEN",
"file": "hidden/t16_hidden.clas.abap",
"description": "T16 hidden tests"
}
],
"reference": [
{
"type": "DDLS",
"name": "{{P}}I_ROUTE_LOAD",
"file": "reference/i_route_load.ddls.asddls",
"description": "Ferry route load"
},
{
"type": "CLAS",
"name": "{{P}}T16_TEST",
"file": "reference/t16_test.clas.abap",
"description": "T16 own tests"
}
],
"craft_checks": []
}