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:
Kral
2026-10-03 16:31:03 +02:00
parent 428b3565b2
commit 7510131a7d
335 changed files with 12047 additions and 5545 deletions

View File

@@ -0,0 +1,149 @@
CLASS {{p}}cold_chain_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
DATA mo_cut TYPE REF TO {{p}}cold_chain_check.
METHODS setup.
METHODS build
IMPORTING iv_offsets TYPE string
iv_temps TYPE string
RETURNING VALUE(rt_readings) TYPE {{p}}cold_chain_check=>tt_readings.
METHODS mean_of
IMPORTING it_readings TYPE {{p}}cold_chain_check=>tt_readings
RETURNING VALUE(rv_mean) TYPE i.
METHODS rule_of
IMPORTING it_readings TYPE {{p}}cold_chain_check=>tt_readings
RETURNING VALUE(rv_rule) TYPE string.
METHODS valid_log_returns_mean FOR TESTING.
METHODS too_few_readings FOR TESTING.
METHODS no_start_at_zero FOR TESTING.
METHODS offsets_not_increasing FOR TESTING.
METHODS duration_too_short FOR TESTING.
METHODS gap_too_large FOR TESTING.
METHODS temperature_too_high FOR TESTING.
METHODS temperature_too_low FOR TESTING.
METHODS structural_error_first FOR TESTING.
METHODS negative_mean_truncated FOR TESTING.
METHODS exception_text FOR TESTING.
ENDCLASS.
CLASS {{p}}cold_chain_hidden IMPLEMENTATION.
METHOD setup.
mo_cut = NEW {{p}}cold_chain_check(
is_config = VALUE #( min_tenths = 20
max_tenths = 80
min_duration = 120
max_gap = 60 ) ).
ENDMETHOD.
METHOD build.
DATA lt_offsets TYPE STANDARD TABLE OF string WITH EMPTY KEY.
DATA lt_temps TYPE STANDARD TABLE OF string WITH EMPTY KEY.
SPLIT iv_offsets AT `,` INTO TABLE lt_offsets.
SPLIT iv_temps AT `,` INTO TABLE lt_temps.
DATA(lv_count) = lines( lt_offsets ).
DO lv_count TIMES.
APPEND VALUE #( offset_min = CONV i( lt_offsets[ sy-index ] )
temp_tenths = CONV i( lt_temps[ sy-index ] ) ) TO rt_readings.
ENDDO.
ENDMETHOD.
METHOD mean_of.
TRY.
rv_mean = mo_cut->check( it_readings ).
CATCH {{p}}cx_cold_chain INTO DATA(lx_error).
cl_abap_unit_assert=>fail( |Unexpected exception: { lx_error->mv_rule }| ).
ENDTRY.
ENDMETHOD.
METHOD rule_of.
TRY.
mo_cut->check( it_readings ).
cl_abap_unit_assert=>fail( `Exception expected` ).
CATCH {{p}}cx_cold_chain INTO DATA(lx_error).
rv_rule = lx_error->mv_rule.
ENDTRY.
ENDMETHOD.
METHOD valid_log_returns_mean.
cl_abap_unit_assert=>assert_equals(
exp = 47
act = mean_of( build( iv_offsets = `0,30,60,120` iv_temps = `40,45,50,55` ) ) ).
ENDMETHOD.
METHOD too_few_readings.
cl_abap_unit_assert=>assert_equals(
exp = 'TOO_FEW'
act = rule_of( build( iv_offsets = `0` iv_temps = `40` ) ) ).
ENDMETHOD.
METHOD no_start_at_zero.
cl_abap_unit_assert=>assert_equals(
exp = 'NO_START'
act = rule_of( build( iv_offsets = `10,30,60,120` iv_temps = `40,45,50,55` ) ) ).
ENDMETHOD.
METHOD offsets_not_increasing.
cl_abap_unit_assert=>assert_equals(
exp = 'TIME_ORDER'
act = rule_of( build( iv_offsets = `0,30,30,120` iv_temps = `40,45,50,55` ) ) ).
ENDMETHOD.
METHOD duration_too_short.
cl_abap_unit_assert=>assert_equals(
exp = 'TOO_SHORT'
act = rule_of( build( iv_offsets = `0,30,60,90` iv_temps = `40,45,50,55` ) ) ).
ENDMETHOD.
METHOD gap_too_large.
cl_abap_unit_assert=>assert_equals(
exp = 'GAP'
act = rule_of( build( iv_offsets = `0,90,120` iv_temps = `40,45,50` ) ) ).
ENDMETHOD.
METHOD temperature_too_high.
cl_abap_unit_assert=>assert_equals(
exp = 'TOO_HIGH'
act = rule_of( build( iv_offsets = `0,30,60,120` iv_temps = `40,45,85,55` ) ) ).
ENDMETHOD.
METHOD temperature_too_low.
cl_abap_unit_assert=>assert_equals(
exp = 'TOO_LOW'
act = rule_of( build( iv_offsets = `0,30,60,120` iv_temps = `40,45,15,55` ) ) ).
ENDMETHOD.
METHOD structural_error_first.
cl_abap_unit_assert=>assert_equals(
exp = 'NO_START'
act = rule_of( build( iv_offsets = `10,30,60,90` iv_temps = `40,45,85,55` ) ) ).
ENDMETHOD.
METHOD negative_mean_truncated.
DATA(lo_cut) = NEW {{p}}cold_chain_check(
is_config = VALUE #( min_tenths = -250
max_tenths = -150
min_duration = 60
max_gap = 60 ) ).
DATA lv_mean TYPE i.
TRY.
lv_mean = lo_cut->check( build( iv_offsets = `0,60` iv_temps = `-200,-211` ) ).
CATCH {{p}}cx_cold_chain INTO DATA(lx_error).
cl_abap_unit_assert=>fail( |Unexpected exception: { lx_error->mv_rule }| ).
ENDTRY.
cl_abap_unit_assert=>assert_equals( exp = -205 act = lv_mean ).
ENDMETHOD.
METHOD exception_text.
TRY.
mo_cut->check( build( iv_offsets = `` iv_temps = `` ) ).
cl_abap_unit_assert=>fail( `Exception expected` ).
CATCH {{p}}cx_cold_chain INTO DATA(lx_error).
cl_abap_unit_assert=>assert_equals(
exp = `Cold chain check failed: TOO_FEW`
act = lx_error->get_text( ) ).
ENDTRY.
ENDMETHOD.
ENDCLASS.

View File

@@ -1,267 +0,0 @@
CLASS {{p}}t_print_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS a4_mono_price FOR TESTING.
METHODS a4_color_price FOR TESTING.
METHODS a3_a5_price FOR TESTING.
METHODS volume_discount_5 FOR TESTING.
METHODS volume_discount_10 FOR TESTING.
METHODS minimum_charge FOR TESTING.
METHODS copies_multiply FOR TESTING.
METHODS rejects_zero_pages FOR TESTING.
METHODS rejects_zero_copies FOR TESTING.
METHODS rejects_unknown_values FOR TESTING.
METHODS rejects_over_limit FOR TESTING.
METHODS first_error_wins FOR TESTING.
ENDCLASS.
CLASS {{p}}t_print_hidden IMPLEMENTATION.
METHOD a4_mono_price.
DATA lv_cents TYPE i.
DATA(lo_cut) = NEW {{p}}print_job_pricer( ).
TRY.
DATA(lv_price) = lo_cut->calculate_price( iv_pages = 100
iv_copies = 1
iv_paper = 'A4'
iv_color = 'M'
iv_dept = 'SALE' ).
lv_cents = lv_price * 100.
cl_abap_unit_assert=>assert_equals( exp = 500 act = lv_cents ).
CATCH cx_root.
cl_abap_unit_assert=>fail( msg = 'unexpected exception' ).
ENDTRY.
ENDMETHOD.
METHOD a4_color_price.
DATA lv_cents TYPE i.
DATA(lo_cut) = NEW {{p}}print_job_pricer( ).
TRY.
DATA(lv_price) = lo_cut->calculate_price( iv_pages = 100
iv_copies = 1
iv_paper = 'A4'
iv_color = 'C'
iv_dept = 'SALE' ).
lv_cents = lv_price * 100.
cl_abap_unit_assert=>assert_equals( exp = 2000 act = lv_cents ).
CATCH cx_root.
cl_abap_unit_assert=>fail( msg = 'unexpected exception' ).
ENDTRY.
ENDMETHOD.
METHOD a3_a5_price.
DATA lv_cents TYPE i.
DATA(lo_cut) = NEW {{p}}print_job_pricer( ).
TRY.
DATA(lv_price) = lo_cut->calculate_price( iv_pages = 100
iv_copies = 1
iv_paper = 'A3'
iv_color = 'M'
iv_dept = 'PROD' ).
lv_cents = lv_price * 100.
cl_abap_unit_assert=>assert_equals( exp = 900 act = lv_cents ).
CATCH cx_root.
cl_abap_unit_assert=>fail( msg = 'unexpected exception' ).
ENDTRY.
TRY.
DATA(lv_a5) = lo_cut->calculate_price( iv_pages = 100
iv_copies = 1
iv_paper = 'A5'
iv_color = 'M'
iv_dept = 'HR' ).
lv_cents = lv_a5 * 100.
cl_abap_unit_assert=>assert_equals( exp = 300 act = lv_cents ).
CATCH cx_root.
cl_abap_unit_assert=>fail( msg = 'unexpected exception' ).
ENDTRY.
ENDMETHOD.
METHOD volume_discount_5.
DATA lv_cents TYPE i.
DATA(lo_cut) = NEW {{p}}print_job_pricer( ).
TRY.
DATA(lv_price) = lo_cut->calculate_price( iv_pages = 600
iv_copies = 1
iv_paper = 'A4'
iv_color = 'M'
iv_dept = 'IT' ).
lv_cents = lv_price * 100.
cl_abap_unit_assert=>assert_equals( exp = 2850 act = lv_cents ).
CATCH cx_root.
cl_abap_unit_assert=>fail( msg = 'unexpected exception' ).
ENDTRY.
TRY.
DATA(lv_500) = lo_cut->calculate_price( iv_pages = 500
iv_copies = 1
iv_paper = 'A4'
iv_color = 'M'
iv_dept = 'IT' ).
lv_cents = lv_500 * 100.
cl_abap_unit_assert=>assert_equals( exp = 2375 act = lv_cents ).
CATCH cx_root.
cl_abap_unit_assert=>fail( msg = 'unexpected exception' ).
ENDTRY.
ENDMETHOD.
METHOD volume_discount_10.
DATA lv_cents TYPE i.
DATA(lo_cut) = NEW {{p}}print_job_pricer( ).
TRY.
DATA(lv_price) = lo_cut->calculate_price( iv_pages = 1000
iv_copies = 1
iv_paper = 'A4'
iv_color = 'M'
iv_dept = 'SALE' ).
lv_cents = lv_price * 100.
cl_abap_unit_assert=>assert_equals( exp = 4500 act = lv_cents ).
CATCH cx_root.
cl_abap_unit_assert=>fail( msg = 'unexpected exception' ).
ENDTRY.
ENDMETHOD.
METHOD minimum_charge.
DATA lv_cents TYPE i.
DATA(lo_cut) = NEW {{p}}print_job_pricer( ).
TRY.
DATA(lv_price) = lo_cut->calculate_price( iv_pages = 10
iv_copies = 1
iv_paper = 'A4'
iv_color = 'M'
iv_dept = 'SALE' ).
lv_cents = lv_price * 100.
cl_abap_unit_assert=>assert_equals( exp = 100 act = lv_cents ).
CATCH cx_root.
cl_abap_unit_assert=>fail( msg = 'unexpected exception' ).
ENDTRY.
ENDMETHOD.
METHOD copies_multiply.
DATA lv_cents TYPE i.
DATA(lo_cut) = NEW {{p}}print_job_pricer( ).
TRY.
DATA(lv_price) = lo_cut->calculate_price( iv_pages = 200
iv_copies = 2
iv_paper = 'A3'
iv_color = 'C'
iv_dept = 'PROD' ).
lv_cents = lv_price * 100.
cl_abap_unit_assert=>assert_equals( exp = 14400 act = lv_cents ).
CATCH cx_root.
cl_abap_unit_assert=>fail( msg = 'unexpected exception' ).
ENDTRY.
ENDMETHOD.
METHOD rejects_zero_pages.
DATA(lo_cut) = NEW {{p}}print_job_pricer( ).
TRY.
lo_cut->calculate_price( iv_pages = 0
iv_copies = 1
iv_paper = 'A4'
iv_color = 'M'
iv_dept = 'SALE' ).
cl_abap_unit_assert=>fail( msg = 'exception expected' ).
CATCH {{p}}cx_print_job_error INTO DATA(lo_error).
cl_abap_unit_assert=>assert_equals(
exp = {{p}}cx_print_job_error=>c_reason-pages
act = lo_error->mv_reason ).
ENDTRY.
ENDMETHOD.
METHOD rejects_zero_copies.
DATA(lo_cut) = NEW {{p}}print_job_pricer( ).
TRY.
lo_cut->calculate_price( iv_pages = 100
iv_copies = 0
iv_paper = 'A4'
iv_color = 'M'
iv_dept = 'SALE' ).
cl_abap_unit_assert=>fail( msg = 'exception expected' ).
CATCH {{p}}cx_print_job_error INTO DATA(lo_error).
cl_abap_unit_assert=>assert_equals(
exp = {{p}}cx_print_job_error=>c_reason-copies
act = lo_error->mv_reason ).
ENDTRY.
ENDMETHOD.
METHOD rejects_unknown_values.
DATA(lo_cut) = NEW {{p}}print_job_pricer( ).
TRY.
lo_cut->calculate_price( iv_pages = 100
iv_copies = 1
iv_paper = 'B5'
iv_color = 'M'
iv_dept = 'SALE' ).
cl_abap_unit_assert=>fail( msg = 'exception expected' ).
CATCH {{p}}cx_print_job_error INTO DATA(lo_paper).
cl_abap_unit_assert=>assert_equals(
exp = {{p}}cx_print_job_error=>c_reason-paper
act = lo_paper->mv_reason ).
ENDTRY.
TRY.
lo_cut->calculate_price( iv_pages = 100
iv_copies = 1
iv_paper = 'A4'
iv_color = 'X'
iv_dept = 'SALE' ).
cl_abap_unit_assert=>fail( msg = 'exception expected' ).
CATCH {{p}}cx_print_job_error INTO DATA(lo_color).
cl_abap_unit_assert=>assert_equals(
exp = {{p}}cx_print_job_error=>c_reason-color
act = lo_color->mv_reason ).
ENDTRY.
TRY.
lo_cut->calculate_price( iv_pages = 100
iv_copies = 1
iv_paper = 'A4'
iv_color = 'M'
iv_dept = 'XYZ' ).
cl_abap_unit_assert=>fail( msg = 'exception expected' ).
CATCH {{p}}cx_print_job_error INTO DATA(lo_dept).
cl_abap_unit_assert=>assert_equals(
exp = {{p}}cx_print_job_error=>c_reason-dept
act = lo_dept->mv_reason ).
ENDTRY.
ENDMETHOD.
METHOD rejects_over_limit.
DATA lv_cents TYPE i.
DATA(lo_cut) = NEW {{p}}print_job_pricer( ).
TRY.
lo_cut->calculate_price( iv_pages = 3000
iv_copies = 2
iv_paper = 'A4'
iv_color = 'M'
iv_dept = 'SALE' ).
cl_abap_unit_assert=>fail( msg = 'exception expected' ).
CATCH {{p}}cx_print_limit INTO DATA(lo_error).
cl_abap_unit_assert=>assert_equals( exp = 6000
act = lo_error->mv_pages ).
ENDTRY.
TRY.
DATA(lv_price) = lo_cut->calculate_price( iv_pages = 5000
iv_copies = 1
iv_paper = 'A4'
iv_color = 'M'
iv_dept = 'SALE' ).
lv_cents = lv_price * 100.
cl_abap_unit_assert=>assert_equals( exp = 22500 act = lv_cents ).
CATCH cx_root.
cl_abap_unit_assert=>fail( msg = 'unexpected exception' ).
ENDTRY.
ENDMETHOD.
METHOD first_error_wins.
DATA(lo_cut) = NEW {{p}}print_job_pricer( ).
TRY.
lo_cut->calculate_price( iv_pages = 0
iv_copies = 0
iv_paper = 'B5'
iv_color = 'X'
iv_dept = 'XYZ' ).
cl_abap_unit_assert=>fail( msg = 'exception expected' ).
CATCH {{p}}cx_print_job_error INTO DATA(lo_error).
cl_abap_unit_assert=>assert_equals(
exp = {{p}}cx_print_job_error=>c_reason-pages
act = lo_error->mv_reason ).
ENDTRY.
ENDMETHOD.
ENDCLASS.