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,14 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Blood donation totals'
define view entity {{P}}I_BLOOD_STOCK
as select from {{p}}donat as donation
inner join {{p}}camp as site on site.camp_id <> donation.camp_id
{
key site.camp_id as camp_id,
site.city as city,
count( * ) as dona_count,
sum( cast( donation.vol_ml as abap.dec( 15, 0 ) ) ) as total_volume
}
where donation.vol_ml > 0
group by site.camp_id, site.city
having count( * ) >= 3

View File

@@ -0,0 +1,14 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Blood donation totals'
define view entity {{P}}I_BLOOD_STOCK
as select from {{p}}donat as donation
inner join {{p}}camp as site on site.camp_id = donation.camp_id
{
key site.camp_id as camp_id,
site.city as city,
count( * ) as dona_count,
max( cast( donation.vol_ml as abap.dec( 15, 0 ) ) ) as total_volume
}
where donation.vol_ml > 0
group by site.camp_id, site.city
having count( * ) >= 3

View File

@@ -0,0 +1,14 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Blood donation totals'
define view entity {{P}}I_BLOOD_STOCK
as select from {{p}}donat as donation
inner join {{p}}camp as site on site.camp_id = donation.camp_id
{
key site.camp_id as camp_id,
site.city as city,
count( * ) as dona_count,
sum( cast( donation.vol_ml as abap.dec( 15, 0 ) ) ) as total_volume
}
where donation.vol_ml <= 0
group by site.camp_id, site.city
having count( * ) >= 3

View File

@@ -0,0 +1,14 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Blood donation totals'
define view entity {{P}}I_BLOOD_STOCK
as select from {{p}}donat as donation
inner join {{p}}camp as site on site.camp_id = donation.camp_id
{
key site.camp_id as camp_id,
site.city as city,
count( * ) as dona_count,
sum( cast( donation.vol_ml as abap.dec( 15, 0 ) ) ) as total_volume
}
where donation.vol_ml > 0
group by site.camp_id, site.city
having count( * ) < 3

View File

@@ -0,0 +1,14 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Blood donation totals'
define view entity {{P}}I_BLOOD_STOCK
as select from {{p}}donat as donation
inner join {{p}}camp as site on site.camp_id = donation.camp_id
{
key site.camp_id as camp_id,
site.city as city,
count( * ) as dona_count,
sum( cast( donation.vol_ml as abap.dec( 15, 0 ) ) ) as total_volume
}
where donation.vol_ml > 0
group by site.camp_id, site.city
having count( * ) >= 4

View File

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

View File

@@ -0,0 +1,95 @@
CLASS {{p}}t_blood_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 counts_donations FOR TESTING.
METHODS sums_volume FOR TESTING.
METHODS camp_below_threshold FOR TESTING.
METHODS camp_without_donations FOR TESTING.
METHODS zero_volume_ignored FOR TESTING.
METHODS city_shown FOR TESTING.
METHODS harbour_count FOR TESTING.
METHODS row_count FOR TESTING.
ENDCLASS.
CLASS {{p}}t_blood_hidden IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_BLOOD_STOCK' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_camp TYPE STANDARD TABLE OF {{p}}camp WITH EMPTY KEY.
DATA lt_donat TYPE STANDARD TABLE OF {{p}}donat WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_camp = VALUE #( ( camp_id = 'C1' city = 'NORTH' )
( camp_id = 'C2' city = 'SOUTH' )
( camp_id = 'C3' city = 'EAST' )
( camp_id = 'C4' city = 'WEST' )
( camp_id = 'C5' city = 'HARBOUR' ) ).
lt_donat = VALUE #( ( camp_id = 'C1' dona_no = 1 blood_group = 'A' vol_ml = 200 )
( camp_id = 'C1' dona_no = 2 blood_group = 'B' vol_ml = 250 )
( camp_id = 'C1' dona_no = 3 blood_group = 'O' vol_ml = 150 )
( camp_id = 'C2' dona_no = 1 blood_group = 'A' vol_ml = 300 )
( camp_id = 'C2' dona_no = 2 blood_group = 'A' vol_ml = 100 )
( camp_id = 'C3' dona_no = 1 blood_group = 'B' vol_ml = 0 )
( camp_id = 'C3' dona_no = 2 blood_group = 'B' vol_ml = 100 )
( camp_id = 'C3' dona_no = 3 blood_group = 'B' vol_ml = 100 )
( camp_id = 'C5' dona_no = 1 blood_group = 'O' vol_ml = 50 )
( camp_id = 'C5' dona_no = 2 blood_group = 'O' vol_ml = 50 )
( camp_id = 'C5' dona_no = 3 blood_group = 'O' vol_ml = 50 )
( camp_id = 'C5' dona_no = 4 blood_group = 'O' vol_ml = 50 )
( camp_id = 'C5' dona_no = 5 blood_group = 'O' vol_ml = 50 ) ).
go_env->insert_test_data( lt_camp ).
go_env->insert_test_data( lt_donat ).
ENDMETHOD.
METHOD counts_donations.
SELECT SINGLE dona_count FROM {{p}}i_blood_stock WHERE camp_id = 'C1' INTO @DATA(lv_count).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 3 ) act = CONV decfloat34( lv_count ) ).
ENDMETHOD.
METHOD sums_volume.
SELECT SINGLE total_volume FROM {{p}}i_blood_stock WHERE camp_id = 'C1' INTO @DATA(lv_vol).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 600 ) act = CONV decfloat34( lv_vol ) ).
ENDMETHOD.
METHOD camp_below_threshold.
SELECT COUNT(*) FROM {{p}}i_blood_stock WHERE camp_id = 'C2' INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rows ).
ENDMETHOD.
METHOD camp_without_donations.
SELECT COUNT(*) FROM {{p}}i_blood_stock WHERE camp_id = 'C4' INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rows ).
ENDMETHOD.
METHOD zero_volume_ignored.
SELECT COUNT(*) FROM {{p}}i_blood_stock WHERE camp_id = 'C3' INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rows ).
ENDMETHOD.
METHOD city_shown.
SELECT SINGLE city FROM {{p}}i_blood_stock WHERE camp_id = 'C5' INTO @DATA(lv_city).
cl_abap_unit_assert=>assert_equals( exp = 'HARBOUR' act = lv_city ).
ENDMETHOD.
METHOD harbour_count.
SELECT SINGLE dona_count, total_volume FROM {{p}}i_blood_stock WHERE camp_id = 'C5'
INTO @DATA(ls_row).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 5 ) act = CONV decfloat34( ls_row-dona_count ) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 250 ) act = CONV decfloat34( ls_row-total_volume ) ).
ENDMETHOD.
METHOD row_count.
SELECT COUNT(*) FROM {{p}}i_blood_stock INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_rows ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,72 @@
{
"task": "G1112",
"mutants": [
{
"object": "{{P}}I_BLOOD_STOCK",
"mutant": "line 5: = -> <> (eq)",
"status": "killed",
"hidden": "1/8",
"failed_tests": [
"CAMP_BELOW_THRESHOLD",
"CAMP_WITHOUT_DONATIONS",
"COUNTS_DONATIONS",
"HARBOUR_COUNT",
"ROW_COUNT",
"SUMS_VOLUME",
"ZERO_VOLUME_IGNORED"
]
},
{
"object": "{{P}}I_BLOOD_STOCK",
"mutant": "line 10: sum( -> max( (agg)",
"status": "killed",
"hidden": "6/8",
"failed_tests": [
"HARBOUR_COUNT",
"SUMS_VOLUME"
]
},
{
"object": "{{P}}I_BLOOD_STOCK",
"mutant": "line 12: > -> <= (rel)",
"status": "killed",
"hidden": "3/8",
"failed_tests": [
"CITY_SHOWN",
"COUNTS_DONATIONS",
"HARBOUR_COUNT",
"ROW_COUNT",
"SUMS_VOLUME"
]
},
{
"object": "{{P}}I_BLOOD_STOCK",
"mutant": "line 14: >= -> < (rel)",
"status": "killed",
"hidden": "2/8",
"failed_tests": [
"CAMP_BELOW_THRESHOLD",
"CITY_SHOWN",
"COUNTS_DONATIONS",
"HARBOUR_COUNT",
"SUMS_VOLUME",
"ZERO_VOLUME_IGNORED"
]
},
{
"object": "{{P}}I_BLOOD_STOCK",
"mutant": "line 14: 3 -> 4 (const)",
"status": "killed",
"hidden": "5/8",
"failed_tests": [
"COUNTS_DONATIONS",
"ROW_COUNT",
"SUMS_VOLUME"
]
}
],
"valid": 5,
"killed": 5,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,40 @@
CLASS {{p}}t_blood_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_camp_total FOR TESTING.
ENDCLASS.
CLASS {{p}}t_blood_test IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_BLOOD_STOCK' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
go_env->clear_doubles( ).
ENDMETHOD.
METHOD one_camp_total.
DATA lt_camp TYPE STANDARD TABLE OF {{p}}camp WITH EMPTY KEY.
DATA lt_donat TYPE STANDARD TABLE OF {{p}}donat WITH EMPTY KEY.
lt_camp = VALUE #( ( camp_id = 'A' city = 'RIVER' ) ).
lt_donat = VALUE #( ( camp_id = 'A' dona_no = 1 blood_group = 'A' vol_ml = 100 )
( camp_id = 'A' dona_no = 2 blood_group = 'A' vol_ml = 0 )
( camp_id = 'A' dona_no = 3 blood_group = 'A' vol_ml = 200 )
( camp_id = 'A' dona_no = 4 blood_group = 'A' vol_ml = 300 ) ).
go_env->insert_test_data( lt_camp ).
go_env->insert_test_data( lt_donat ).
SELECT SINGLE dona_count, total_volume FROM {{p}}i_blood_stock WHERE camp_id = 'A'
INTO @DATA(ls_row).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 3 ) act = CONV decfloat34( ls_row-dona_count ) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 600 ) act = CONV decfloat34( ls_row-total_volume ) ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,14 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Blood donation totals'
define view entity {{P}}I_BLOOD_STOCK
as select from {{p}}donat as donation
inner join {{p}}camp as site on site.camp_id = donation.camp_id
{
key site.camp_id as camp_id,
site.city as city,
count( * ) as dona_count,
sum( cast( donation.vol_ml as abap.dec( 15, 0 ) ) ) as total_volume
}
where donation.vol_ml > 0
group by site.camp_id, site.city
having count( * ) >= 3

View File

@@ -0,0 +1,10 @@
@EndUserText.label : 'Blood donation camp'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}camp {
key client : abap.clnt not null;
key camp_id : abap.char(10) not null;
city : abap.char(20);
}

View File

@@ -0,0 +1,12 @@
@EndUserText.label : 'Blood donation'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}donat {
key client : abap.clnt not null;
key camp_id : abap.char(10) not null;
key dona_no : abap.int4 not null;
blood_group : abap.char(3);
vol_ml : abap.int4;
}

View File

@@ -0,0 +1,40 @@
# 1. Goal
Show the blood that each donation camp collected. A report and an OData
service will read the totals, so the calculation must be in the database, in a
CDS view.
# 2. Open questions
None.
# 3. Context
- Table {{P}}CAMP (donation camp), package $TMP. Key: CAMP_ID (CHAR 10).
Fields: CITY (CHAR 20).
- Table {{P}}DONAT (blood donation), package $TMP. Key: CAMP_ID (CHAR 10),
DONA_NO (INT4). Fields: BLOOD_GROUP (CHAR 3), VOL_ML (INT4, volume in
millilitres).
# 4. Contract
- Create the CDS view entity {{P}}I_BLOOD_STOCK in package $TMP.
- Elements, with these names: CAMP_ID (key), CITY, DONA_COUNT, TOTAL_VOLUME.
- No authorization check (#NOT_REQUIRED).
# 5. Business rules
1. A donation is counted when its volume is greater than zero. A donation with
volume zero is not counted.
2. Show one row for each camp that has at least three counted donations. Do not
show a camp with fewer than three counted donations.
3. Do not show a camp that has no donation at all.
4. DONA_COUNT is the number of counted donations of the camp.
5. TOTAL_VOLUME is the sum of the volumes of the counted donations of the camp,
in millilitres.
6. CITY is the city of the camp.
# 6. Constraints
- Release target: 8.16.
- Coding standards: Clean ABAP.
- Out of scope: do not change {{P}}CAMP and {{P}}DONAT.
# 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": "G1112",
"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}}CAMP",
"file": "seed/camp.tabl.asabap",
"description": "Blood donation camp"
},
{
"type": "TABL",
"name": "{{P}}DONAT",
"file": "seed/donat.tabl.asabap",
"description": "Blood donation"
}
],
"contract": [
{
"type": "DDLS",
"name": "{{P}}I_BLOOD_STOCK",
"fields": [
"CAMP_ID",
"CITY",
"DONA_COUNT",
"TOTAL_VOLUME"
]
}
],
"out_of_scope": [
"{{P}}CAMP",
"{{P}}DONAT"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}T_BLOOD_HIDDEN",
"file": "hidden/blood_hidden.clas.abap",
"description": "Hidden tests for the blood donation totals"
}
],
"reference": [
{
"type": "DDLS",
"name": "{{P}}I_BLOOD_STOCK",
"file": "reference/i_blood_stock.ddls.asddls",
"description": "Blood donation totals"
},
{
"type": "CLAS",
"name": "{{P}}T_BLOOD_TEST",
"file": "reference/blood_test.clas.abap",
"description": "Own tests for the view"
}
],
"craft_checks": []
}