Fix coverage with several contract classes; table annotation and file path checks; clean task dir on write

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
Kral
2026-10-03 08:44:35 +02:00
parent fb576b0954
commit 03ab36149e
388 changed files with 28620 additions and 339 deletions

View File

@@ -0,0 +1,52 @@
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 assert_amount
IMPORTING iv_exp TYPE decfloat34
iv_act TYPE decfloat34.
METHODS charge_of_national_call FOR TESTING.
METHODS charge_of_long_call FOR TESTING.
ENDCLASS.
CLASS {{p}}t16_test IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_CALL_CHARGE' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_calls TYPE STANDARD TABLE OF {{p}}calls WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_calls = VALUE #(
( call_id = 'A' customer = 'C1' call_date = '20240110' start_time = '100000' duration_sec = 60 dest_type = 'N' )
( call_id = 'B' customer = 'C2' call_date = '20240110' start_time = '100000' duration_sec = 3600 dest_type = 'I' )
).
go_env->insert_test_data( lt_calls ).
ENDMETHOD.
METHOD assert_amount.
DATA lv_diff TYPE decfloat34.
lv_diff = abs( iv_exp - iv_act ).
cl_abap_unit_assert=>assert_equals(
exp = abap_true
act = xsdbool( lv_diff < CONV decfloat34( '0.005' ) ) ).
ENDMETHOD.
METHOD charge_of_national_call.
SELECT SINGLE charge FROM {{p}}i_call_charge WHERE call_id = 'A' INTO @DATA(lv_charge).
assert_amount( iv_exp = CONV decfloat34( '0.09' ) iv_act = CONV decfloat34( lv_charge ) ).
ENDMETHOD.
METHOD charge_of_long_call.
SELECT SINGLE charge FROM {{p}}i_call_charge WHERE call_id = 'B' INTO @DATA(lv_charge).
assert_amount( iv_exp = CONV decfloat34( '13.50' ) iv_act = CONV decfloat34( lv_charge ) ).
ENDMETHOD.
ENDCLASS.