Files
abap-llm/tasks_gen/eval/G0143/reference/t14_test.clas.abap

75 lines
2.0 KiB
ABAP

CLASS {{p}}t14_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS weekday_fee FOR TESTING.
METHODS weekend_fee FOR TESTING.
METHODS group_fee FOR TESTING.
METHODS invalid_input FOR TESTING.
ENDCLASS.
CLASS {{p}}t14_test IMPLEMENTATION.
METHOD weekday_fee.
DATA lv_fee TYPE decfloat34.
CALL FUNCTION '{{P}}BOWL_FEE_OLD'
EXPORTING
iv_players = 1
iv_games = 1
iv_day = 1
IMPORTING
ev_fee = lv_fee
EXCEPTIONS
invalid_input = 1
OTHERS = 2.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '3.50' ) act = lv_fee ).
ENDMETHOD.
METHOD weekend_fee.
DATA lv_fee TYPE decfloat34.
CALL FUNCTION '{{P}}BOWL_FEE_OLD'
EXPORTING
iv_players = 6
iv_games = 2
iv_day = 6
IMPORTING
ev_fee = lv_fee
EXCEPTIONS
invalid_input = 1
OTHERS = 2.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '10.00' ) act = lv_fee ).
ENDMETHOD.
METHOD group_fee.
DATA lv_fee TYPE decfloat34.
CALL FUNCTION '{{P}}BOWL_FEE_OLD'
EXPORTING
iv_players = 12
iv_games = 1
iv_day = 1
iv_shoes = abap_true
IMPORTING
ev_fee = lv_fee
EXCEPTIONS
invalid_input = 1
OTHERS = 2.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '21.00' ) act = lv_fee ).
ENDMETHOD.
METHOD invalid_input.
DATA lv_fee TYPE decfloat34.
CALL FUNCTION '{{P}}BOWL_FEE_OLD'
EXPORTING
iv_players = 0
iv_games = 1
iv_day = 1
IMPORTING
ev_fee = lv_fee
EXCEPTIONS
invalid_input = 1
OTHERS = 2.
cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ).
ENDMETHOD.
ENDCLASS.