ADT fallback: Accept headers for FUNC; G0189 accepted; regen2 results
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
134
tasks_gen/eval/G0121/reference/t41_test.clas.abap
Normal file
134
tasks_gen/eval/G0121/reference/t41_test.clas.abap
Normal file
@@ -0,0 +1,134 @@
|
||||
CLASS {{p}}t41_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS setup.
|
||||
METHODS call
|
||||
IMPORTING
|
||||
iv_max_priority TYPE i
|
||||
EXPORTING
|
||||
ev_count TYPE i
|
||||
ev_duplicates TYPE i
|
||||
ev_first_call_id TYPE string
|
||||
ev_last_call_id TYPE string
|
||||
ev_subrc TYPE sysubrc.
|
||||
METHODS add_a
|
||||
IMPORTING
|
||||
iv_id TYPE {{P}}ALERT_A-CALL_ID
|
||||
iv_prio TYPE {{P}}ALERT_A-PRIORITY
|
||||
iv_date TYPE {{P}}ALERT_A-CALL_DATE
|
||||
iv_time TYPE {{P}}ALERT_A-CALL_TIME
|
||||
iv_district TYPE {{P}}ALERT_A-DISTRICT.
|
||||
METHODS add_b
|
||||
IMPORTING
|
||||
iv_id TYPE {{P}}ALERT_B-CALL_ID
|
||||
iv_prio TYPE {{P}}ALERT_B-PRIORITY
|
||||
iv_date TYPE {{P}}ALERT_B-CALL_DATE
|
||||
iv_time TYPE {{P}}ALERT_B-CALL_TIME
|
||||
iv_district TYPE {{P}}ALERT_B-DISTRICT.
|
||||
METHODS merges_and_sorts FOR TESTING.
|
||||
METHODS keeps_earliest FOR TESTING.
|
||||
METHODS counts_duplicates FOR TESTING.
|
||||
METHODS filters_by_priority FOR TESTING.
|
||||
METHODS empty_tables FOR TESTING.
|
||||
METHODS rejects_bad_priority FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t41_test IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
DELETE FROM {{P}}ALERT_A.
|
||||
DELETE FROM {{P}}ALERT_B.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD call.
|
||||
CALL FUNCTION '{{P}}ALERT_MERGE'
|
||||
EXPORTING
|
||||
iv_max_priority = iv_max_priority
|
||||
IMPORTING
|
||||
ev_count = ev_count
|
||||
ev_duplicates = ev_duplicates
|
||||
ev_first_call_id = ev_first_call_id
|
||||
ev_last_call_id = ev_last_call_id
|
||||
EXCEPTIONS
|
||||
invalid_priority = 1
|
||||
OTHERS = 2.
|
||||
ev_subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD add_a.
|
||||
DATA ls_call TYPE {{P}}ALERT_A.
|
||||
ls_call-call_id = iv_id.
|
||||
ls_call-priority = iv_prio.
|
||||
ls_call-call_date = iv_date.
|
||||
ls_call-call_time = iv_time.
|
||||
ls_call-district = iv_district.
|
||||
MODIFY {{P}}ALERT_A FROM @ls_call.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD add_b.
|
||||
DATA ls_call TYPE {{P}}ALERT_B.
|
||||
ls_call-call_id = iv_id.
|
||||
ls_call-priority = iv_prio.
|
||||
ls_call-call_date = iv_date.
|
||||
ls_call-call_time = iv_time.
|
||||
ls_call-district = iv_district.
|
||||
MODIFY {{P}}ALERT_B FROM @ls_call.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD merges_and_sorts.
|
||||
add_a( iv_id = 'C1' iv_prio = 3 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ).
|
||||
add_b( iv_id = 'C2' iv_prio = 1 iv_date = '20240102' iv_time = '080000' iv_district = 'SUED' ).
|
||||
call( EXPORTING iv_max_priority = 5
|
||||
IMPORTING ev_count = DATA(lv_count)
|
||||
ev_first_call_id = DATA(lv_first) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'C2' act = lv_first ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD keeps_earliest.
|
||||
add_a( iv_id = 'C1' iv_prio = 1 iv_date = '20240101' iv_time = '100000' iv_district = 'NORD' ).
|
||||
add_b( iv_id = 'C1' iv_prio = 1 iv_date = '20240101' iv_time = '090000' iv_district = 'SUED' ).
|
||||
call( EXPORTING iv_max_priority = 5
|
||||
IMPORTING ev_count = DATA(lv_count)
|
||||
ev_first_call_id = DATA(lv_first) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'C1' act = lv_first ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD counts_duplicates.
|
||||
add_a( iv_id = 'C1' iv_prio = 1 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ).
|
||||
add_b( iv_id = 'C1' iv_prio = 1 iv_date = '20240101' iv_time = '080000' iv_district = 'SUED' ).
|
||||
add_b( iv_id = 'C2' iv_prio = 2 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ).
|
||||
call( EXPORTING iv_max_priority = 5
|
||||
IMPORTING ev_count = DATA(lv_count)
|
||||
ev_duplicates = DATA(lv_dup) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_dup ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD filters_by_priority.
|
||||
add_a( iv_id = 'C1' iv_prio = 1 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ).
|
||||
add_a( iv_id = 'C2' iv_prio = 4 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ).
|
||||
call( EXPORTING iv_max_priority = 2
|
||||
IMPORTING ev_count = DATA(lv_count)
|
||||
ev_last_call_id = DATA(lv_last) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'C1' act = lv_last ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD empty_tables.
|
||||
call( EXPORTING iv_max_priority = 5
|
||||
IMPORTING ev_count = DATA(lv_count)
|
||||
ev_duplicates = DATA(lv_dup)
|
||||
ev_first_call_id = DATA(lv_first) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_count ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_dup ).
|
||||
cl_abap_unit_assert=>assert_initial( act = lv_first ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_bad_priority.
|
||||
add_a( iv_id = 'C1' iv_prio = 7 iv_date = '20240101' iv_time = '080000' iv_district = 'NORD' ).
|
||||
call( EXPORTING iv_max_priority = 5 IMPORTING ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user