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,23 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Air quality per station'
define view entity {{P}}I_AIR_QUALITY
as select from {{p}}station as sta
left outer join {{p}}reading as rea on rea.station_id = sta.station_id
{
key sta.station_id as station_id,
sta.station_name as station_name,
count( * ) as reading_count,
avg( rea.pm_value as abap.dec( 5, 1 ) ) as avg_pm,
max( rea.pm_value ) as max_pm,
case when max( rea.pm_value ) > sta.limit_pm
then 'HIGH'
when max( rea.pm_value ) > sta.limit_pm * 80 / 100
then 'MEDIUM'
else 'LOW'
end as rating,
abs( max( rea.pm_value ) - sta.limit_pm ) as deviation
}
group by
sta.station_id,
sta.station_name,
sta.limit_pm

View File

@@ -0,0 +1,23 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Air quality per station'
define view entity {{P}}I_AIR_QUALITY
as select from {{p}}station as sta
inner join {{p}}reading as rea on rea.station_id = sta.station_id
{
key sta.station_id as station_id,
sta.station_name as station_name,
count( * ) as reading_count,
avg( rea.pm_value as abap.dec( 5, 1 ) ) as avg_pm,
max( rea.pm_value ) as max_pm,
case when max( rea.pm_value ) > sta.limit_pm
then 'HIGH'
when max( rea.pm_value ) > sta.limit_pm * 80 / 100
then 'ZEDIUM'
else 'LOW'
end as rating,
abs( max( rea.pm_value ) - sta.limit_pm ) as deviation
}
group by
sta.station_id,
sta.station_name,
sta.limit_pm

View File

@@ -0,0 +1,23 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Air quality per station'
define view entity {{P}}I_AIR_QUALITY
as select from {{p}}station as sta
inner join {{p}}reading as rea on rea.station_id = sta.station_id
{
key sta.station_id as station_id,
sta.station_name as station_name,
count( * ) as reading_count,
avg( rea.pm_value as abap.dec( 5, 1 ) ) as avg_pm,
max( rea.pm_value ) as max_pm,
case when max( rea.pm_value ) > sta.limit_pm
then 'HIGH'
when max( rea.pm_value ) > sta.limit_pm * 80 / 100
then 'MEDIUM'
else 'LOW'
end as rating,
abs( max( rea.pm_value ) + sta.limit_pm ) as deviation
}
group by
sta.station_id,
sta.station_name,
sta.limit_pm

View File

@@ -0,0 +1,38 @@
{
"id": "G1060",
"pool": "train",
"object_type": "DDLS",
"category": "B",
"attempts": [
{
"stage": "bundle",
"errors": [
"reference/t41_test.clas.abap line 32: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"go_env\""
],
"by_check": {
"abaplint": 1
}
},
{
"stage": "validate",
"oracle": 0,
"null": 0
},
{
"stage": "validate",
"oracle": 0,
"null": 0
},
{
"stage": "validate",
"oracle": 100.0,
"null": 0,
"mutation": {
"valid": 4,
"killed": 3,
"ok": true
}
}
],
"accepted": true
}

View File

@@ -0,0 +1,112 @@
CLASS {{p}}t41_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 row_count FOR TESTING.
METHODS reading_counts FOR TESTING.
METHODS avg_pm_value FOR TESTING.
METHODS max_pm_value FOR TESTING.
METHODS rating_low FOR TESTING.
METHODS rating_medium FOR TESTING.
METHODS rating_high FOR TESTING.
METHODS deviation_above FOR TESTING.
METHODS deviation_below FOR TESTING.
METHODS station_name FOR TESTING.
ENDCLASS.
CLASS {{p}}t41_hidden IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_AIR_QUALITY' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_sta TYPE STANDARD TABLE OF {{p}}station WITH EMPTY KEY.
DATA lt_rea TYPE STANDARD TABLE OF {{p}}reading WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_sta = VALUE #( ( station_id = 'S1' station_name = 'NORTH' limit_pm = '40.0' )
( station_id = 'S2' station_name = 'SOUTH' limit_pm = '25.0' )
( station_id = 'S3' station_name = 'EAST' limit_pm = '30.0' )
( station_id = 'S4' station_name = 'WEST' limit_pm = '20.0' ) ).
lt_rea = VALUE #( ( station_id = 'S1' reading_no = 1 pm_value = '12.0' )
( station_id = 'S1' reading_no = 2 pm_value = '13.0' )
( station_id = 'S1' reading_no = 3 pm_value = '15.0' )
( station_id = 'S2' reading_no = 1 pm_value = '20.0' )
( station_id = 'S2' reading_no = 2 pm_value = '30.0' )
( station_id = 'S3' reading_no = 1 pm_value = '26.0' )
( station_id = 'S3' reading_no = 2 pm_value = '24.0' )
( station_id = 'S3' reading_no = 3 pm_value = '26.0' ) ).
go_env->insert_test_data( lt_sta ).
go_env->insert_test_data( lt_rea ).
ENDMETHOD.
METHOD row_count.
SELECT COUNT(*) FROM {{p}}i_air_quality INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 3 act = lv_rows ).
ENDMETHOD.
METHOD reading_counts.
SELECT SINGLE reading_count FROM {{p}}i_air_quality
WHERE station_id = 'S1' INTO @DATA(lv_count).
cl_abap_unit_assert=>assert_equals( exp = 3 act = lv_count ).
ENDMETHOD.
METHOD avg_pm_value.
SELECT SINGLE avg_pm FROM {{p}}i_air_quality
WHERE station_id = 'S1' INTO @DATA(lv_avg).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '13.3' )
act = CONV decfloat34( lv_avg ) ).
ENDMETHOD.
METHOD max_pm_value.
SELECT SINGLE max_pm FROM {{p}}i_air_quality
WHERE station_id = 'S3' INTO @DATA(lv_max).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '26.0' )
act = CONV decfloat34( lv_max ) ).
ENDMETHOD.
METHOD rating_low.
SELECT SINGLE rating FROM {{p}}i_air_quality
WHERE station_id = 'S1' INTO @DATA(lv_rating).
cl_abap_unit_assert=>assert_equals( exp = 'LOW' act = lv_rating ).
ENDMETHOD.
METHOD rating_medium.
SELECT SINGLE rating FROM {{p}}i_air_quality
WHERE station_id = 'S3' INTO @DATA(lv_rating).
cl_abap_unit_assert=>assert_equals( exp = 'MEDIUM' act = lv_rating ).
ENDMETHOD.
METHOD rating_high.
SELECT SINGLE rating FROM {{p}}i_air_quality
WHERE station_id = 'S2' INTO @DATA(lv_rating).
cl_abap_unit_assert=>assert_equals( exp = 'HIGH' act = lv_rating ).
ENDMETHOD.
METHOD deviation_above.
SELECT SINGLE deviation FROM {{p}}i_air_quality
WHERE station_id = 'S2' INTO @DATA(lv_dev).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '5.0' )
act = CONV decfloat34( lv_dev ) ).
ENDMETHOD.
METHOD deviation_below.
SELECT SINGLE deviation FROM {{p}}i_air_quality
WHERE station_id = 'S1' INTO @DATA(lv_dev).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '25.0' )
act = CONV decfloat34( lv_dev ) ).
ENDMETHOD.
METHOD station_name.
SELECT SINGLE station_name FROM {{p}}i_air_quality
WHERE station_id = 'S3' INTO @DATA(lv_name).
cl_abap_unit_assert=>assert_equals( exp = 'EAST' act = lv_name ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,51 @@
{
"task": "G1060",
"mutants": [
{
"object": "{{P}}I_AIR_QUALITY",
"mutant": "line 5: inner join -> left outer join (join)",
"status": "killed",
"hidden": "9/10",
"failed_tests": [
"ROW_COUNT"
]
},
{
"object": "{{P}}I_AIR_QUALITY",
"mutant": "line 10: avg( -> max( (agg)",
"status": "invalid",
"hidden": "0/0",
"failed_tests": []
},
{
"object": "{{P}}I_AIR_QUALITY",
"mutant": "line 14: 80 -> 81 (const)",
"status": "survived",
"hidden": "10/10",
"failed_tests": []
},
{
"object": "{{P}}I_AIR_QUALITY",
"mutant": "line 15: 'MEDIUM' -> 'ZEDIUM' (lit)",
"status": "killed",
"hidden": "9/10",
"failed_tests": [
"RATING_MEDIUM"
]
},
{
"object": "{{P}}I_AIR_QUALITY",
"mutant": "line 18: - -> + (arith)",
"status": "killed",
"hidden": "8/10",
"failed_tests": [
"DEVIATION_ABOVE",
"DEVIATION_BELOW"
]
}
],
"valid": 4,
"killed": 3,
"kill_rate": 0.75,
"ok": true
}

View File

@@ -0,0 +1,23 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Air quality per station'
define view entity {{P}}I_AIR_QUALITY
as select from {{p}}station as sta
inner join {{p}}reading as rea on rea.station_id = sta.station_id
{
key sta.station_id as station_id,
sta.station_name as station_name,
count( * ) as reading_count,
avg( rea.pm_value as abap.dec( 5, 1 ) ) as avg_pm,
max( rea.pm_value ) as max_pm,
case when max( rea.pm_value ) > sta.limit_pm
then 'HIGH'
when max( rea.pm_value ) > sta.limit_pm * 80 / 100
then 'MEDIUM'
else 'LOW'
end as rating,
abs( max( rea.pm_value ) - sta.limit_pm ) as deviation
}
group by
sta.station_id,
sta.station_name,
sta.limit_pm

View File

@@ -0,0 +1,41 @@
CLASS {{p}}t41_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 rating_and_average FOR TESTING.
ENDCLASS.
CLASS {{p}}t41_test IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_AIR_QUALITY' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
go_env->clear_doubles( ).
ENDMETHOD.
METHOD rating_and_average.
DATA lt_sta TYPE STANDARD TABLE OF {{p}}station WITH EMPTY KEY.
DATA lt_rea TYPE STANDARD TABLE OF {{p}}reading WITH EMPTY KEY.
lt_sta = VALUE #( ( station_id = 'A' station_name = 'ALPHA' limit_pm = '50.0' ) ).
lt_rea = VALUE #( ( station_id = 'A' reading_no = 1 pm_value = '10.0' )
( station_id = 'A' reading_no = 2 pm_value = '20.0' ) ).
go_env->insert_test_data( lt_sta ).
go_env->insert_test_data( lt_rea ).
SELECT SINGLE rating, avg_pm, deviation FROM {{p}}i_air_quality
WHERE station_id = 'A' INTO @DATA(ls_row).
cl_abap_unit_assert=>assert_equals( exp = 'LOW' act = ls_row-rating ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '15.0' )
act = CONV decfloat34( ls_row-avg_pm ) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '30.0' )
act = CONV decfloat34( ls_row-deviation ) ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,11 @@
@EndUserText.label : 'Fine dust reading'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}reading {
key client : abap.clnt not null;
key station_id : abap.char(10) not null;
key reading_no : abap.int4 not null;
pm_value : abap.dec(5,1);
}

View File

@@ -0,0 +1,11 @@
@EndUserText.label : 'Measuring station'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}station {
key client : abap.clnt not null;
key station_id : abap.char(10) not null;
station_name : abap.char(20);
limit_pm : abap.dec(5,1);
}

View File

@@ -0,0 +1,44 @@
# 1. Goal
Show the air quality of each measuring station. A dashboard and an OData service
will read the values, so the calculation must be in the database, in a CDS view.
# 2. Open questions
None.
# 3. Context
- Table {{P}}STATION (measuring station), package $TMP. Key: STATION_ID (CHAR 10).
Fields: STATION_NAME (CHAR 20), LIMIT_PM (DEC 5,1, the permitted fine dust
value of the station).
- Table {{P}}READING (single fine dust reading), package $TMP. Key: STATION_ID
(CHAR 10), READING_NO (INT4). Fields: PM_VALUE (DEC 5,1, the measured fine
dust value).
# 4. Contract
- Create the CDS view entity {{P}}I_AIR_QUALITY in package $TMP.
- Elements, with these names: STATION_ID (key), STATION_NAME, READING_COUNT,
AVG_PM, MAX_PM, RATING, DEVIATION.
- No authorization check (#NOT_REQUIRED).
# 5. Business rules
1. Show one row for each station that has at least one reading. Do not show a
station without readings.
2. STATION_NAME is the name of the station.
3. READING_COUNT is the number of readings of the station.
4. AVG_PM is the average PM_VALUE of the readings of the station, with 1 decimal
place.
5. MAX_PM is the highest PM_VALUE of the station.
6. RATING is the class of the station:
- 'HIGH' if MAX_PM is greater than LIMIT_PM,
- 'MEDIUM' if MAX_PM is greater than 80 percent of LIMIT_PM,
- 'LOW' in all other cases.
7. DEVIATION is the distance between MAX_PM and LIMIT_PM, as a positive number.
# 6. Constraints
- Release target: 8.16.
- Coding standards: Clean ABAP. No ATC priority 1 or priority 2 findings.
- Out of scope: do not change {{P}}STATION and {{P}}READING.
# 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,68 @@
{
"id": "G1060",
"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}}STATION",
"file": "seed/station.tabl.asabap",
"description": "Measuring station with its fine dust limit"
},
{
"type": "TABL",
"name": "{{P}}READING",
"file": "seed/reading.tabl.asabap",
"description": "Single fine dust reading of a station"
}
],
"contract": [
{
"type": "DDLS",
"name": "{{P}}I_AIR_QUALITY",
"fields": [
"STATION_ID",
"STATION_NAME",
"READING_COUNT",
"AVG_PM",
"MAX_PM",
"RATING",
"DEVIATION"
]
}
],
"out_of_scope": [
"{{P}}STATION",
"{{P}}READING"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}T41_HIDDEN",
"file": "hidden/t41_hidden.clas.abap",
"description": "T41 hidden tests"
}
],
"reference": [
{
"type": "DDLS",
"name": "{{P}}I_AIR_QUALITY",
"file": "reference/i_air_quality.ddls.asddls",
"description": "Air quality per measuring station"
},
{
"type": "CLAS",
"name": "{{P}}T41_TEST",
"file": "reference/t41_test.clas.abap",
"description": "T41 own tests"
}
],
"craft_checks": []
}