Pipeline controller: plan 2 (hard +, error +50 %), backlog throttle, 2 trajectory workers, stop rules, summaries every 50; budget reserve

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-05 13:35:54 +02:00
parent 1c4667a0fc
commit 13360292dd
781 changed files with 50211 additions and 22 deletions

View File

@@ -0,0 +1,41 @@
FUNCTION {{p}}auc_premium
IMPORTING
iv_lot_type TYPE string
iv_hammer TYPE decfloat34
iv_channel TYPE string
EXPORTING
ev_skip TYPE abap_bool
CHANGING
cv_fee TYPE decfloat34
EXCEPTIONS
invalid_hammer.
DATA lv_premium TYPE decfloat34.
ev_skip = abap_false.
IF iv_hammer < 0.
RAISE invalid_hammer.
ENDIF.
IF iv_lot_type = 'C'.
ev_skip = abap_true.
RETURN.
ENDIF.
IF iv_hammer <= 1000.
lv_premium = iv_hammer * 20 / 100.
ELSEIF iv_hammer <= 10000.
lv_premium = 1000 * 20 / 100 + ( iv_hammer - 1000 ) * 12 / 100.
ELSE.
lv_premium = 1000 * 20 / 100 + 9000 * 12 / 100 + ( iv_hammer - 10000 ) * 6 / 100.
ENDIF.
IF iv_channel = 'O'.
lv_premium = lv_premium * 90 / 100.
ENDIF.
lv_premium = round( val = lv_premium dec = 2 mode = cl_abap_math=>round_half_up ).
IF lv_premium < 5.
lv_premium = 5.
ELSEIF lv_premium > 5000.
lv_premium = 5000.
ENDIF.
cv_fee = lv_premium.
ENDFUNCTION.

View File

@@ -0,0 +1,99 @@
CLASS {{p}}t14_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS premium_for
IMPORTING iv_lot_type TYPE string
iv_hammer TYPE decfloat34
iv_channel TYPE string
RETURNING VALUE(rv_fee) TYPE decfloat34.
METHODS band_premium FOR TESTING.
METHODS online_reduction FOR TESTING.
METHODS premium_limits FOR TESTING.
METHODS charity_lot FOR TESTING.
METHODS negative_hammer FOR TESTING.
ENDCLASS.
CLASS {{p}}t14_test IMPLEMENTATION.
METHOD premium_for.
DATA lv_skip TYPE abap_bool.
CALL FUNCTION '{{P}}AUC_PREMIUM'
EXPORTING
iv_lot_type = iv_lot_type
iv_hammer = iv_hammer
iv_channel = iv_channel
IMPORTING
ev_skip = lv_skip
CHANGING
cv_fee = rv_fee
EXCEPTIONS
invalid_hammer = 1
OTHERS = 2.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
ENDMETHOD.
METHOD band_premium.
DATA lv_exp TYPE decfloat34.
DATA lv_act TYPE decfloat34.
lv_exp = 320.
lv_act = premium_for( iv_lot_type = `S` iv_hammer = 2000 iv_channel = `B` ).
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_act ).
ENDMETHOD.
METHOD online_reduction.
DATA lv_exp TYPE decfloat34.
DATA lv_act TYPE decfloat34.
lv_exp = 90.
lv_act = premium_for( iv_lot_type = `S` iv_hammer = 500 iv_channel = `O` ).
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_act ).
ENDMETHOD.
METHOD premium_limits.
DATA lv_exp TYPE decfloat34.
DATA lv_act TYPE decfloat34.
lv_exp = 5.
lv_act = premium_for( iv_lot_type = `S` iv_hammer = 10 iv_channel = `B` ).
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_act ).
lv_exp = 5000.
lv_act = premium_for( iv_lot_type = `S` iv_hammer = 100000 iv_channel = `B` ).
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_act ).
ENDMETHOD.
METHOD charity_lot.
DATA lv_skip TYPE abap_bool.
DATA lv_fee TYPE decfloat34.
DATA lv_exp TYPE decfloat34.
lv_fee = 7.
lv_exp = 7.
CALL FUNCTION '{{P}}AUC_PREMIUM'
EXPORTING
iv_lot_type = `C`
iv_hammer = 5000
iv_channel = `B`
IMPORTING
ev_skip = lv_skip
CHANGING
cv_fee = lv_fee
EXCEPTIONS
invalid_hammer = 1
OTHERS = 2.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
cl_abap_unit_assert=>assert_true( lv_skip ).
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_fee ).
ENDMETHOD.
METHOD negative_hammer.
DATA lv_fee TYPE decfloat34.
CALL FUNCTION '{{P}}AUC_PREMIUM'
EXPORTING
iv_lot_type = `S`
iv_hammer = -5
iv_channel = `B`
CHANGING
cv_fee = lv_fee
EXCEPTIONS
invalid_hammer = 1
OTHERS = 2.
cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ).
ENDMETHOD.
ENDCLASS.