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,58 @@
FUNCTION {{p}}tree_fee
IMPORTING
iv_species TYPE string
iv_height_cm TYPE i
iv_near_house TYPE abap_bool
EXPORTING
ev_fee TYPE decfloat34
ev_warning TYPE abap_bool
EXCEPTIONS
invalid_height.
DATA lv_base_fee TYPE decfloat34.
DATA lv_fee TYPE decfloat34.
DATA lv_metres TYPE i.
DATA lv_extra_metres TYPE i.
ev_fee = 0.
ev_warning = abap_false.
IF iv_height_cm <= 0.
RAISE invalid_height.
ENDIF.
CASE iv_species.
WHEN 'OAK'.
lv_base_fee = 200.
WHEN 'PINE'.
lv_base_fee = 150.
WHEN 'BIRCH'.
lv_base_fee = 120.
WHEN OTHERS.
lv_base_fee = 100.
ENDCASE.
lv_metres = iv_height_cm DIV 100.
IF iv_height_cm MOD 100 <> 0.
lv_metres = lv_metres + 1.
ENDIF.
lv_extra_metres = lv_metres - 5.
IF lv_extra_metres < 0.
lv_extra_metres = 0.
ENDIF.
lv_fee = lv_base_fee + lv_extra_metres * 25.
IF iv_near_house = abap_true.
lv_fee = lv_fee * 1125 / 1000.
ENDIF.
IF iv_height_cm > 2000.
ev_warning = abap_true.
lv_fee = lv_fee + 500.
ENDIF.
ev_fee = round( val = lv_fee dec = 2 ).
ENDFUNCTION.

View File

@@ -0,0 +1,103 @@
CLASS {{p}}tree_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS fee_for
IMPORTING
iv_species TYPE string
iv_height_cm TYPE i
iv_near_house TYPE abap_bool
RETURNING
VALUE(rv_fee) TYPE decfloat34.
METHODS species_fees FOR TESTING.
METHODS height_fee FOR TESTING.
METHODS house_fee FOR TESTING.
METHODS tall_tree FOR TESTING.
METHODS invalid_height FOR TESTING.
ENDCLASS.
CLASS {{p}}tree_test IMPLEMENTATION.
METHOD fee_for.
DATA lv_fee TYPE decfloat34.
DATA lv_warning TYPE abap_bool.
CALL FUNCTION '{{P}}TREE_FEE'
EXPORTING
iv_species = iv_species
iv_height_cm = iv_height_cm
iv_near_house = iv_near_house
IMPORTING
ev_fee = lv_fee
ev_warning = lv_warning
EXCEPTIONS
invalid_height = 1
OTHERS = 2.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
rv_fee = lv_fee.
ENDMETHOD.
METHOD species_fees.
DATA lv_exp TYPE decfloat34.
lv_exp = 200.
cl_abap_unit_assert=>assert_equals(
exp = lv_exp
act = fee_for( iv_species = 'OAK' iv_height_cm = 300 iv_near_house = abap_false ) ).
lv_exp = 120.
cl_abap_unit_assert=>assert_equals(
exp = lv_exp
act = fee_for( iv_species = 'BIRCH' iv_height_cm = 300 iv_near_house = abap_false ) ).
lv_exp = 100.
cl_abap_unit_assert=>assert_equals(
exp = lv_exp
act = fee_for( iv_species = 'ELM' iv_height_cm = 300 iv_near_house = abap_false ) ).
ENDMETHOD.
METHOD height_fee.
DATA lv_exp TYPE decfloat34.
lv_exp = 250.
cl_abap_unit_assert=>assert_equals(
exp = lv_exp
act = fee_for( iv_species = 'OAK' iv_height_cm = 620 iv_near_house = abap_false ) ).
ENDMETHOD.
METHOD house_fee.
DATA lv_exp TYPE decfloat34.
lv_exp = '140.63'.
cl_abap_unit_assert=>assert_equals(
exp = lv_exp
act = fee_for( iv_species = 'ELM' iv_height_cm = 550 iv_near_house = abap_true ) ).
ENDMETHOD.
METHOD tall_tree.
DATA lv_fee TYPE decfloat34.
DATA lv_warning TYPE abap_bool.
DATA lv_exp TYPE decfloat34.
CALL FUNCTION '{{P}}TREE_FEE'
EXPORTING
iv_species = 'OAK'
iv_height_cm = 2500
iv_near_house = abap_false
IMPORTING
ev_fee = lv_fee
ev_warning = lv_warning.
lv_exp = 1200.
cl_abap_unit_assert=>assert_equals( exp = lv_exp act = lv_fee ).
cl_abap_unit_assert=>assert_equals( exp = abap_true act = lv_warning ).
ENDMETHOD.
METHOD invalid_height.
DATA lv_fee TYPE decfloat34.
DATA lv_subrc TYPE sysubrc.
CALL FUNCTION '{{P}}TREE_FEE'
EXPORTING
iv_species = 'OAK'
iv_height_cm = 0
iv_near_house = abap_false
IMPORTING
ev_fee = lv_fee
EXCEPTIONS
invalid_height = 1
OTHERS = 2.
lv_subrc = sy-subrc.
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_subrc ).
ENDMETHOD.
ENDCLASS.