Snapshot: new training tasks (balanced generation), docs

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-05 22:08:59 +02:00
parent eb13453097
commit 6984fc7917
572 changed files with 30024 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Falconry deployments per site'
define view entity {{P}}I_HAWK_SITE
as select from {{p}}falcon
{
key site as site,
count( * ) as deployments,
max( flight_min ) as total_minutes,
sum( birds ) as total_birds,
sum( cast( flight_min as abap.dec( 10, 0 ) ) * fee_per_min ) as total_fee
}
where flight_min > 0
group by site

View File

@@ -0,0 +1,13 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Falconry deployments per site'
define view entity {{P}}I_HAWK_SITE
as select from {{p}}falcon
{
key site as site,
count( * ) as deployments,
sum( flight_min ) as total_minutes,
max( birds ) as total_birds,
sum( cast( flight_min as abap.dec( 10, 0 ) ) * fee_per_min ) as total_fee
}
where flight_min > 0
group by site

View File

@@ -0,0 +1,13 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Falconry deployments per site'
define view entity {{P}}I_HAWK_SITE
as select from {{p}}falcon
{
key site as site,
count( * ) as deployments,
sum( flight_min ) as total_minutes,
sum( birds ) as total_birds,
max( cast( flight_min as abap.dec( 10, 0 ) ) * fee_per_min ) as total_fee
}
where flight_min > 0
group by site

View File

@@ -0,0 +1,13 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Falconry deployments per site'
define view entity {{P}}I_HAWK_SITE
as select from {{p}}falcon
{
key site as site,
count( * ) as deployments,
sum( flight_min ) as total_minutes,
sum( birds ) as total_birds,
sum( cast( flight_min as abap.dec( 10, 0 ) ) * fee_per_min ) as total_fee
}
where flight_min <= 0
group by site

View File

@@ -0,0 +1,28 @@
{
"id": "G1949",
"pool": "train",
"object_type": "DDLS",
"category": "F",
"attempts": [
{
"stage": "bundle",
"errors": [
"seed/falcon.tabl.asabap: field name minutes is a reserved word; choose another name"
],
"by_check": {
"static": 1
}
},
{
"stage": "validate",
"oracle": 100.0,
"null": 0,
"mutation": {
"valid": 4,
"killed": 4,
"ok": true
}
}
],
"accepted": true
}

View File

@@ -0,0 +1,86 @@
CLASS {{p}}t42_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 north_deployments FOR TESTING.
METHODS north_minutes FOR TESTING.
METHODS north_birds FOR TESTING.
METHODS north_fee FOR TESTING.
METHODS south_totals FOR TESTING.
METHODS east_not_shown FOR TESTING.
ENDCLASS.
CLASS {{p}}t42_hidden IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_HAWK_SITE' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_falcon TYPE STANDARD TABLE OF {{p}}falcon WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_falcon = VALUE #(
( deploy_id = 1 site = 'NORTH' deploy_date = '20240101' flight_min = 30 birds = 2 fee_per_min = '4.00' )
( deploy_id = 2 site = 'NORTH' deploy_date = '20240102' flight_min = 20 birds = 1 fee_per_min = '5.00' )
( deploy_id = 3 site = 'SOUTH' deploy_date = '20240103' flight_min = 10 birds = 3 fee_per_min = '6.00' )
( deploy_id = 4 site = 'SOUTH' deploy_date = '20240104' flight_min = 0 birds = 1 fee_per_min = '9.00' )
( deploy_id = 5 site = 'EAST' deploy_date = '20240105' flight_min = 0 birds = 2 fee_per_min = '9.00' ) ).
go_env->insert_test_data( lt_falcon ).
ENDMETHOD.
METHOD row_count.
SELECT COUNT(*) FROM {{p}}i_hawk_site INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_rows ).
ENDMETHOD.
METHOD north_deployments.
SELECT SINGLE deployments FROM {{p}}i_hawk_site
WHERE site = 'NORTH' INTO @DATA(lv_deployments).
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_deployments ).
ENDMETHOD.
METHOD north_minutes.
SELECT SINGLE total_minutes FROM {{p}}i_hawk_site
WHERE site = 'NORTH' INTO @DATA(lv_minutes).
cl_abap_unit_assert=>assert_equals( exp = 50 act = lv_minutes ).
ENDMETHOD.
METHOD north_birds.
SELECT SINGLE total_birds FROM {{p}}i_hawk_site
WHERE site = 'NORTH' INTO @DATA(lv_birds).
cl_abap_unit_assert=>assert_equals( exp = 3 act = lv_birds ).
ENDMETHOD.
METHOD north_fee.
SELECT SINGLE total_fee FROM {{p}}i_hawk_site
WHERE site = 'NORTH' INTO @DATA(lv_fee).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '220.00' )
act = CONV decfloat34( lv_fee ) ).
ENDMETHOD.
METHOD south_totals.
SELECT SINGLE deployments, total_minutes, total_birds, total_fee
FROM {{p}}i_hawk_site
WHERE site = 'SOUTH'
INTO @DATA(ls_row).
cl_abap_unit_assert=>assert_equals( exp = 1 act = ls_row-deployments ).
cl_abap_unit_assert=>assert_equals( exp = 10 act = ls_row-total_minutes ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = ls_row-total_birds ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '60.00' )
act = CONV decfloat34( ls_row-total_fee ) ).
ENDMETHOD.
METHOD east_not_shown.
SELECT COUNT(*) FROM {{p}}i_hawk_site
WHERE site = 'EAST' INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rows ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,50 @@
{
"task": "G1949",
"mutants": [
{
"object": "{{P}}I_HAWK_SITE",
"mutant": "line 8: sum( -> max( (agg)",
"status": "killed",
"hidden": "6/7",
"failed_tests": [
"NORTH_MINUTES"
]
},
{
"object": "{{P}}I_HAWK_SITE",
"mutant": "line 9: sum( -> max( (agg)",
"status": "killed",
"hidden": "6/7",
"failed_tests": [
"NORTH_BIRDS"
]
},
{
"object": "{{P}}I_HAWK_SITE",
"mutant": "line 10: sum( -> max( (agg)",
"status": "killed",
"hidden": "6/7",
"failed_tests": [
"NORTH_FEE"
]
},
{
"object": "{{P}}I_HAWK_SITE",
"mutant": "line 12: > -> <= (rel)",
"status": "killed",
"hidden": "1/7",
"failed_tests": [
"EAST_NOT_SHOWN",
"NORTH_BIRDS",
"NORTH_DEPLOYMENTS",
"NORTH_FEE",
"NORTH_MINUTES",
"SOUTH_TOTALS"
]
}
],
"valid": 4,
"killed": 4,
"kill_rate": 1.0,
"ok": true
}

View File

@@ -0,0 +1,13 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Falconry deployments per site'
define view entity {{P}}I_HAWK_SITE
as select from {{p}}falcon
{
key site as site,
count( * ) as deployments,
sum( flight_min ) as total_minutes,
sum( birds ) as total_birds,
sum( cast( flight_min as abap.dec( 10, 0 ) ) * fee_per_min ) as total_fee
}
where flight_min > 0
group by site

View File

@@ -0,0 +1,48 @@
CLASS {{p}}t42_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 totals_of_one_site FOR TESTING.
METHODS cancelled_not_counted FOR TESTING.
ENDCLASS.
CLASS {{p}}t42_test IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_HAWK_SITE' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_falcon TYPE STANDARD TABLE OF {{p}}falcon WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_falcon = VALUE #(
( deploy_id = 1 site = 'A' deploy_date = '20240101' flight_min = 5 birds = 1 fee_per_min = '2.00' )
( deploy_id = 2 site = 'A' deploy_date = '20240102' flight_min = 15 birds = 2 fee_per_min = '1.00' )
( deploy_id = 3 site = 'A' deploy_date = '20240103' flight_min = 0 birds = 4 fee_per_min = '9.00' ) ).
go_env->insert_test_data( lt_falcon ).
ENDMETHOD.
METHOD totals_of_one_site.
SELECT SINGLE deployments, total_minutes, total_birds, total_fee
FROM {{p}}i_hawk_site
WHERE site = 'A'
INTO @DATA(ls_row).
cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_row-deployments ).
cl_abap_unit_assert=>assert_equals( exp = 20 act = ls_row-total_minutes ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = ls_row-total_birds ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '25.00' )
act = CONV decfloat34( ls_row-total_fee ) ).
ENDMETHOD.
METHOD cancelled_not_counted.
SELECT COUNT(*) FROM {{p}}i_hawk_site INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rows ).
ENDMETHOD.
ENDCLASS.

View File

@@ -0,0 +1,14 @@
@EndUserText.label : 'Falconry deployment log'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table {{p}}falcon {
key client : abap.clnt not null;
key deploy_id : abap.int4 not null;
site : abap.char(10);
deploy_date : abap.dats;
flight_min : abap.int4;
birds : abap.int4;
fee_per_min : abap.dec(15,2);
}

View File

@@ -0,0 +1,54 @@
# 1. Goal
A falconry company sends birds of prey to airfields. The birds scare other
birds away from the runways. The company needs one row for each site with the
work that the birds did there. A dashboard and an OData service read this data.
The calculation must be in the database, in a CDS view.
# 2. Open questions
None.
# 3. Context
- Table {{P}}FALCON (deployment log), package $TMP. The table is active. This
specification does not list the columns of the table. Read the table
definition to find the column names.
- One row of {{P}}FALCON is one deployment of a bird of prey at a site. The
table stores these values for a deployment:
- the site,
- the date of the deployment,
- the number of flight minutes,
- the number of birds that flew,
- the fee for one flight minute.
# 4. Contract
- Create the CDS view entity {{P}}I_HAWK_SITE in package $TMP.
- Elements, with these names:
- SITE (key)
- DEPLOYMENTS
- TOTAL_MINUTES
- TOTAL_BIRDS
- TOTAL_FEE
- No authorization check (#NOT_REQUIRED).
# 5. Business rules
1. Show one row for each site that has at least one valid deployment.
2. A deployment with zero flight minutes is cancelled. A cancelled deployment
must not appear in the view and must not count in any element.
3. DEPLOYMENTS is the number of valid deployments of the site.
4. TOTAL_MINUTES is the sum of the flight minutes of the valid deployments of
the site.
5. TOTAL_BIRDS is the sum of the birds that flew in the valid deployments of
the site.
6. TOTAL_FEE is the sum of the fees of the valid deployments of the site. The
fee of one deployment is the number of flight minutes multiplied by the fee
for one flight minute. The result has 2 decimals.
# 6. Constraints
- Release target: SAP_BASIS 8.16 (ABAP Platform 2025).
- Use "define view entity".
- Out of scope: do not change {{P}}FALCON.
- Do not use SAP application module data.
# 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,59 @@
{
"id": "G1949",
"category": "F",
"object_type": "DDLS",
"difficulty": 3,
"release_target": "v816",
"expected_outcome": "implement",
"budget": {
"max_tool_calls": 70,
"max_activations": 18
},
"seed": [
{
"type": "TABL",
"name": "{{P}}FALCON",
"file": "seed/falcon.tabl.asabap",
"description": "Falconry deployment log"
}
],
"contract": [
{
"type": "DDLS",
"name": "{{P}}I_HAWK_SITE",
"fields": [
"SITE",
"DEPLOYMENTS",
"TOTAL_MINUTES",
"TOTAL_BIRDS",
"TOTAL_FEE"
]
}
],
"out_of_scope": [
"{{P}}FALCON"
],
"hidden_tests": [
{
"type": "CLAS",
"name": "{{P}}T42_HIDDEN",
"file": "hidden/t42_hidden.clas.abap",
"description": "T42 hidden tests"
}
],
"reference": [
{
"type": "DDLS",
"name": "{{P}}I_HAWK_SITE",
"file": "reference/i_hawk_site.ddls.asddls",
"description": "Deployments per site"
},
{
"type": "CLAS",
"name": "{{P}}T42_TEST",
"file": "reference/t42_test.clas.abap",
"description": "T42 own tests"
}
],
"craft_checks": []
}