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,22 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Berth fee'
define view entity {{P}}I_BERTH_FEE
as select from {{p}}berth as berth
inner join {{p}}pier as pier on pier.pier_code = berth.pier_code
{
key berth.berth_id as berth_id,
berth.boat_name as boat_name,
case
when berth.length_m < 8 then 'SMALL'
when berth.length_m <= 15 then 'MEDIUM'
else 'LARGE'
end as size_class,
cast( berth.length_m * 100 as abap.int4 ) as length_cm,
cast( round( ( pier.base_fee + berth.length_m * pier.rate_per_m
+ case when berth.shore_power = 'Y'
then pier.power_fee
else cast( 0 as abap.dec( 10, 2 ) )
end )
* berth.stay_days, 2 )
as abap.dec( 15, 2 ) ) as total_fee
}

View File

@@ -0,0 +1,45 @@
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 fee_of_one_berth FOR TESTING.
ENDCLASS.
CLASS {{p}}t42_test IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_BERTH_FEE' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_pier TYPE STANDARD TABLE OF {{p}}pier WITH EMPTY KEY.
DATA lt_berth TYPE STANDARD TABLE OF {{p}}berth WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_pier = VALUE #( ( pier_code = 'A' base_fee = '20.00' rate_per_m = '3.00' power_fee = '5.00' ) ).
lt_berth = VALUE #( ( berth_id = 'A' boat_name = 'TEST BOAT' length_m = '8.00'
pier_code = 'A' shore_power = 'N' stay_days = 2 ) ).
go_env->insert_test_data( lt_pier ).
go_env->insert_test_data( lt_berth ).
ENDMETHOD.
METHOD fee_of_one_berth.
SELECT SINGLE size_class, length_cm, total_fee FROM {{p}}i_berth_fee
WHERE berth_id = 'A' INTO @DATA(ls_result).
cl_abap_unit_assert=>assert_equals( exp = 'MEDIUM'
act = condense( val = ls_result-size_class ) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 800 )
act = CONV decfloat34( ls_result-length_cm ) ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '88.00' )
act = CONV decfloat34( ls_result-total_fee ) ).
ENDMETHOD.
ENDCLASS.