Files
abap-llm/tasks_gen/eval/G0137/reference/dive_check.testclasses.abap

76 lines
2.8 KiB
ABAP

CLASS ltc_dive_check DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
CONSTANTS:
c_dive_date TYPE d VALUE '20250401',
c_recent TYPE d VALUE '20250201'.
DATA mo_cut TYPE REF TO {{p}}dive_check.
METHODS setup.
METHODS valid_dive_is_ok FOR TESTING.
METHODS too_young FOR TESTING.
METHODS unknown_cert FOR TESTING.
METHODS too_few_dives FOR TESTING.
METHODS stale_last_dive FOR TESTING.
ENDCLASS.
CLASS ltc_dive_check IMPLEMENTATION.
METHOD setup.
mo_cut = NEW {{p}}dive_check( ).
ENDMETHOD.
METHOD valid_dive_is_ok.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}dive_check=>c_reason-ok
act = mo_cut->check_diver( iv_cert_level = 'A'
iv_depth = 25
iv_dives = 60
iv_last_dive = c_recent
iv_dive_date = c_dive_date
iv_age = 30 ) ).
ENDMETHOD.
METHOD too_young.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}dive_check=>c_reason-age
act = mo_cut->check_diver( iv_cert_level = 'A'
iv_depth = 25
iv_dives = 60
iv_last_dive = c_recent
iv_dive_date = c_dive_date
iv_age = 11 ) ).
ENDMETHOD.
METHOD unknown_cert.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}dive_check=>c_reason-cert
act = mo_cut->check_diver( iv_cert_level = 'X'
iv_depth = 10
iv_dives = 100
iv_last_dive = c_recent
iv_dive_date = c_dive_date
iv_age = 30 ) ).
ENDMETHOD.
METHOD too_few_dives.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}dive_check=>c_reason-dives
act = mo_cut->check_diver( iv_cert_level = 'A'
iv_depth = 25
iv_dives = 49
iv_last_dive = c_recent
iv_dive_date = c_dive_date
iv_age = 30 ) ).
ENDMETHOD.
METHOD stale_last_dive.
cl_abap_unit_assert=>assert_equals(
exp = {{p}}dive_check=>c_reason-recent
act = mo_cut->check_diver( iv_cert_level = 'A'
iv_depth = 25
iv_dives = 60
iv_last_dive = '20240101'
iv_dive_date = c_dive_date
iv_age = 30 ) ).
ENDMETHOD.
ENDCLASS.