- Static bundle checks (name length, seed type, reserved words, contract test classes, testclasses_file), local abaplint parser check before SAP, max_tokens, robust JSON parse - Runner: G2 for CDS views with parameters, contract_check detail in report - G0020 and G0013 fixed by review and revalidated (oracle 100, null 0) - Pilot results in docs/faz1-tasarim.md 11e; handover notes merged into CLAUDE.md and docs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
101 lines
3.3 KiB
ABAP
101 lines
3.3 KiB
ABAP
CLASS {{p}}t14_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
|
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
|
PRIVATE SECTION.
|
|
METHODS qty_for
|
|
IMPORTING
|
|
iv_stock TYPE decfloat34
|
|
iv_reorder_point TYPE decfloat34
|
|
iv_target_stock TYPE decfloat34
|
|
iv_pack_size TYPE decfloat34
|
|
iv_min_qty TYPE decfloat34 DEFAULT 0
|
|
RETURNING
|
|
VALUE(rv_qty) TYPE decfloat34.
|
|
METHODS replenish_to_target FOR TESTING.
|
|
METHODS no_replenishment FOR TESTING.
|
|
METHODS minimum_quantity FOR TESTING.
|
|
METHODS pack_rounding FOR TESTING.
|
|
METHODS invalid_pack_size FOR TESTING.
|
|
METHODS class_direct_call FOR TESTING.
|
|
METHODS class_no_replenishment FOR TESTING.
|
|
ENDCLASS.
|
|
|
|
|
|
CLASS {{p}}t14_test IMPLEMENTATION.
|
|
METHOD qty_for.
|
|
CALL FUNCTION '{{P}}REPL_CALC'
|
|
EXPORTING
|
|
iv_stock = iv_stock
|
|
iv_reorder_point = iv_reorder_point
|
|
iv_target_stock = iv_target_stock
|
|
iv_pack_size = iv_pack_size
|
|
iv_min_qty = iv_min_qty
|
|
IMPORTING
|
|
ev_qty = rv_qty
|
|
EXCEPTIONS
|
|
invalid_pack_size = 1
|
|
OTHERS = 2.
|
|
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
|
ENDMETHOD.
|
|
|
|
METHOD replenish_to_target.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = CONV decfloat34( 48 )
|
|
act = qty_for( iv_stock = 10 iv_reorder_point = 20 iv_target_stock = 50 iv_pack_size = 12 ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD no_replenishment.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = CONV decfloat34( 0 )
|
|
act = qty_for( iv_stock = 30 iv_reorder_point = 20 iv_target_stock = 50 iv_pack_size = 12 ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD minimum_quantity.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = CONV decfloat34( 10 )
|
|
act = qty_for( iv_stock = 10 iv_reorder_point = 20 iv_target_stock = 12 iv_pack_size = 5 iv_min_qty = 7 ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD pack_rounding.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = CONV decfloat34( 30 )
|
|
act = qty_for( iv_stock = 0 iv_reorder_point = 10 iv_target_stock = 25 iv_pack_size = 6 ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD invalid_pack_size.
|
|
DATA lv_qty TYPE decfloat34.
|
|
CALL FUNCTION '{{P}}REPL_CALC'
|
|
EXPORTING
|
|
iv_stock = 0
|
|
iv_reorder_point = 10
|
|
iv_target_stock = 20
|
|
iv_pack_size = 0
|
|
iv_min_qty = 0
|
|
IMPORTING
|
|
ev_qty = lv_qty
|
|
EXCEPTIONS
|
|
invalid_pack_size = 1
|
|
OTHERS = 2.
|
|
cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ).
|
|
ENDMETHOD.
|
|
|
|
METHOD class_direct_call.
|
|
DATA(lv_qty) = NEW {{p}}cl_repl( )->calculate(
|
|
iv_stock = 0
|
|
iv_reorder_point = 10
|
|
iv_target_stock = 24
|
|
iv_pack_size = 12
|
|
iv_min_qty = 0 ).
|
|
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 24 ) act = lv_qty ).
|
|
ENDMETHOD.
|
|
|
|
METHOD class_no_replenishment.
|
|
DATA(lv_qty) = NEW {{p}}cl_repl( )->calculate(
|
|
iv_stock = 40
|
|
iv_reorder_point = 20
|
|
iv_target_stock = 100
|
|
iv_pack_size = 10
|
|
iv_min_qty = 0 ).
|
|
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_qty ).
|
|
ENDMETHOD.
|
|
ENDCLASS.
|