Files
abap-llm/tasks_gen/eval/G0024/reference/t16_test.clas.abap
Kral 32f03fcad4 Hard batch G0022-G0026: 5/5 accepted; budget floor, CDS checks, mutation check
- generator: budget floor (2x oracle activations, 3x calls), static checks for CDS
  $parameters and UNION annotation
- harness/mutation.py: deterministic mutants of the reference; hidden tests must fail
- G0022 revalidated with harness fixes: oracle 100, null 0
- results in docs/faz1-tasarim.md 11f

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 05:16:30 +02:00

45 lines
1.6 KiB
ABAP

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 period_is_inclusive FOR TESTING.
ENDCLASS.
CLASS {{p}}t16_test IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_SALES_REPORT' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_sales TYPE STANDARD TABLE OF {{p}}sales WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_sales = VALUE #(
( doc_id = 'S1' item_no = 1 product = 'P1' quantity = 2 price = '1.50' sold_on = '20240501' )
( doc_id = 'S1' item_no = 2 product = 'P1' quantity = 1 price = '4.00' sold_on = '20240531' )
( doc_id = 'S2' item_no = 1 product = 'P2' quantity = 9 price = '0.10' sold_on = '20240601' ) ).
go_env->insert_test_data( lt_sales ).
ENDMETHOD.
METHOD period_is_inclusive.
DATA lv_from TYPE d.
DATA lv_to TYPE d.
lv_from = '20240501'.
lv_to = '20240531'.
SELECT SINGLE total_qty, total_amount
FROM {{p}}i_sales_report( p_from = @lv_from, p_to = @lv_to )
WHERE product = 'P1'
INTO @DATA(ls_result).
cl_abap_unit_assert=>assert_equals( exp = 3 act = ls_result-total_qty ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '7.00' )
act = CONV decfloat34( ls_result-total_amount ) ).
ENDMETHOD.
ENDCLASS.