Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
157 lines
5.6 KiB
ABAP
157 lines
5.6 KiB
ABAP
CLASS {{p}}marina_fee_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
|
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
|
PRIVATE SECTION.
|
|
DATA mo_cut TYPE REF TO {{p}}marina_fee.
|
|
METHODS setup.
|
|
METHODS zero_length_returns_zero FOR TESTING.
|
|
METHODS zero_nights_returns_zero FOR TESTING.
|
|
METHODS minimum_fee_applies FOR TESTING.
|
|
METHODS sail_in_low_season FOR TESTING.
|
|
METHODS motor_in_high_season FOR TESTING.
|
|
METHODS catamaran_with_power FOR TESTING.
|
|
METHODS week_discount FOR TESTING.
|
|
METHODS discount_rounds_up FOR TESTING.
|
|
METHODS unknown_type_like_sail FOR TESTING.
|
|
METHODS large_boat_high_power FOR TESTING.
|
|
METHODS length_boundary_8m FOR TESTING.
|
|
ENDCLASS.
|
|
|
|
|
|
CLASS {{p}}marina_fee_hidden IMPLEMENTATION.
|
|
METHOD setup.
|
|
mo_cut = NEW {{p}}marina_fee( ).
|
|
ENDMETHOD.
|
|
|
|
METHOD zero_length_returns_zero.
|
|
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
|
lv_exp = '0.00'.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = lv_exp
|
|
act = mo_cut->calculate_fee( iv_length_m = 0
|
|
iv_nights = 3
|
|
iv_boat_type = 'S'
|
|
iv_season = 'L'
|
|
iv_power = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD zero_nights_returns_zero.
|
|
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
|
lv_exp = '0.00'.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = lv_exp
|
|
act = mo_cut->calculate_fee( iv_length_m = 10
|
|
iv_nights = 0
|
|
iv_boat_type = 'S'
|
|
iv_season = 'L'
|
|
iv_power = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD minimum_fee_applies.
|
|
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
|
lv_exp = '30.00'.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = lv_exp
|
|
act = mo_cut->calculate_fee( iv_length_m = 6
|
|
iv_nights = 1
|
|
iv_boat_type = 'S'
|
|
iv_season = 'L'
|
|
iv_power = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD sail_in_low_season.
|
|
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
|
lv_exp = '96.00'.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = lv_exp
|
|
act = mo_cut->calculate_fee( iv_length_m = 10
|
|
iv_nights = 3
|
|
iv_boat_type = 'S'
|
|
iv_season = 'L'
|
|
iv_power = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD motor_in_high_season.
|
|
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
|
lv_exp = '107.52'.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = lv_exp
|
|
act = mo_cut->calculate_fee( iv_length_m = 10
|
|
iv_nights = 2
|
|
iv_boat_type = 'M'
|
|
iv_season = 'H'
|
|
iv_power = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD catamaran_with_power.
|
|
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
|
lv_exp = '308.00'.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = lv_exp
|
|
act = mo_cut->calculate_fee( iv_length_m = 14
|
|
iv_nights = 4
|
|
iv_boat_type = 'C'
|
|
iv_season = 'L'
|
|
iv_power = abap_true ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD week_discount.
|
|
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
|
lv_exp = '201.60'.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = lv_exp
|
|
act = mo_cut->calculate_fee( iv_length_m = 12
|
|
iv_nights = 7
|
|
iv_boat_type = 'S'
|
|
iv_season = 'L'
|
|
iv_power = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD discount_rounds_up.
|
|
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
|
lv_exp = '370.19'.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = lv_exp
|
|
act = mo_cut->calculate_fee( iv_length_m = 10
|
|
iv_nights = 7
|
|
iv_boat_type = 'M'
|
|
iv_season = 'H'
|
|
iv_power = abap_true ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD unknown_type_like_sail.
|
|
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
|
lv_exp = '96.00'.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = lv_exp
|
|
act = mo_cut->calculate_fee( iv_length_m = 10
|
|
iv_nights = 3
|
|
iv_boat_type = 'X'
|
|
iv_season = 'L'
|
|
iv_power = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD large_boat_high_power.
|
|
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
|
lv_exp = '262.00'.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = lv_exp
|
|
act = mo_cut->calculate_fee( iv_length_m = 25
|
|
iv_nights = 2
|
|
iv_boat_type = 'M'
|
|
iv_season = 'H'
|
|
iv_power = abap_true ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD length_boundary_8m.
|
|
DATA lv_exp TYPE p LENGTH 8 DECIMALS 2.
|
|
lv_exp = '40.00'.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = lv_exp
|
|
act = mo_cut->calculate_fee( iv_length_m = 8
|
|
iv_nights = 2
|
|
iv_boat_type = 'S'
|
|
iv_season = 'L'
|
|
iv_power = abap_false ) ).
|
|
ENDMETHOD.
|
|
ENDCLASS.
|