Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
172 lines
7.5 KiB
ABAP
172 lines
7.5 KiB
ABAP
CLASS {{p}}t12_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
|
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 valid_all_certs FOR TESTING.
|
|
METHODS too_young FOR TESTING.
|
|
METHODS age_before_cert FOR TESTING.
|
|
METHODS unknown_cert FOR TESTING.
|
|
METHODS cert_before_depth FOR TESTING.
|
|
METHODS depth_limits FOR TESTING.
|
|
METHODS dive_minimums FOR TESTING.
|
|
METHODS stale_last_dive FOR TESTING.
|
|
METHODS recent_dive_ok FOR TESTING.
|
|
METHODS deep_dive_recent FOR TESTING.
|
|
METHODS last_dive_missing FOR TESTING.
|
|
ENDCLASS.
|
|
|
|
|
|
CLASS {{p}}t12_hidden 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 valid_all_certs.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = {{p}}dive_check=>c_reason-ok
|
|
act = mo_cut->check_diver( iv_cert_level = 'O' iv_depth = 18 iv_dives = 20
|
|
iv_last_dive = c_recent iv_dive_date = c_dive_date iv_age = 30 )
|
|
msg = `O` ).
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = {{p}}dive_check=>c_reason-ok
|
|
act = mo_cut->check_diver( iv_cert_level = 'A' iv_depth = 30 iv_dives = 50
|
|
iv_last_dive = c_recent iv_dive_date = c_dive_date iv_age = 30 )
|
|
msg = `A` ).
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = {{p}}dive_check=>c_reason-ok
|
|
act = mo_cut->check_diver( iv_cert_level = 'R' iv_depth = 40 iv_dives = 80
|
|
iv_last_dive = c_recent iv_dive_date = c_dive_date iv_age = 30 )
|
|
msg = `R` ).
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = {{p}}dive_check=>c_reason-ok
|
|
act = mo_cut->check_diver( iv_cert_level = 'D' iv_depth = 40 iv_dives = 100
|
|
iv_last_dive = c_recent iv_dive_date = c_dive_date iv_age = 30 )
|
|
msg = `D` ).
|
|
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 age_before_cert.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = {{p}}dive_check=>c_reason-age
|
|
act = mo_cut->check_diver( iv_cert_level = 'X' iv_depth = 100 iv_dives = 0
|
|
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 cert_before_depth.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = {{p}}dive_check=>c_reason-cert
|
|
act = mo_cut->check_diver( iv_cert_level = 'X' iv_depth = 100 iv_dives = 0
|
|
iv_last_dive = c_recent iv_dive_date = c_dive_date iv_age = 30 ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD depth_limits.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = {{p}}dive_check=>c_reason-ok
|
|
act = mo_cut->check_diver( iv_cert_level = 'O' iv_depth = 18 iv_dives = 20
|
|
iv_last_dive = c_recent iv_dive_date = c_dive_date iv_age = 30 )
|
|
msg = `O at limit` ).
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = {{p}}dive_check=>c_reason-depth
|
|
act = mo_cut->check_diver( iv_cert_level = 'O' iv_depth = 19 iv_dives = 20
|
|
iv_last_dive = c_recent iv_dive_date = c_dive_date iv_age = 30 )
|
|
msg = `O over limit` ).
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = {{p}}dive_check=>c_reason-ok
|
|
act = mo_cut->check_diver( iv_cert_level = 'A' iv_depth = 30 iv_dives = 50
|
|
iv_last_dive = c_recent iv_dive_date = c_dive_date iv_age = 30 )
|
|
msg = `A at limit` ).
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = {{p}}dive_check=>c_reason-depth
|
|
act = mo_cut->check_diver( iv_cert_level = 'A' iv_depth = 31 iv_dives = 50
|
|
iv_last_dive = c_recent iv_dive_date = c_dive_date iv_age = 30 )
|
|
msg = `A over limit` ).
|
|
ENDMETHOD.
|
|
|
|
METHOD dive_minimums.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = {{p}}dive_check=>c_reason-ok
|
|
act = mo_cut->check_diver( iv_cert_level = 'O' iv_depth = 10 iv_dives = 20
|
|
iv_last_dive = c_recent iv_dive_date = c_dive_date iv_age = 30 )
|
|
msg = `O at minimum` ).
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = {{p}}dive_check=>c_reason-dives
|
|
act = mo_cut->check_diver( iv_cert_level = 'O' iv_depth = 10 iv_dives = 19
|
|
iv_last_dive = c_recent iv_dive_date = c_dive_date iv_age = 30 )
|
|
msg = `O below minimum` ).
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = {{p}}dive_check=>c_reason-ok
|
|
act = mo_cut->check_diver( iv_cert_level = 'D' iv_depth = 10 iv_dives = 100
|
|
iv_last_dive = c_recent iv_dive_date = c_dive_date iv_age = 30 )
|
|
msg = `D at minimum` ).
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = {{p}}dive_check=>c_reason-dives
|
|
act = mo_cut->check_diver( iv_cert_level = 'D' iv_depth = 10 iv_dives = 99
|
|
iv_last_dive = c_recent iv_dive_date = c_dive_date iv_age = 30 )
|
|
msg = `D below minimum` ).
|
|
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.
|
|
|
|
METHOD recent_dive_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 = '20240601' iv_dive_date = c_dive_date iv_age = 30 ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD deep_dive_recent.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = {{p}}dive_check=>c_reason-recent
|
|
act = mo_cut->check_diver( iv_cert_level = 'R' iv_depth = 35 iv_dives = 80
|
|
iv_last_dive = '20240913' iv_dive_date = c_dive_date iv_age = 30 )
|
|
msg = `200 days` ).
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = {{p}}dive_check=>c_reason-ok
|
|
act = mo_cut->check_diver( iv_cert_level = 'R' iv_depth = 35 iv_dives = 80
|
|
iv_last_dive = '20241003' iv_dive_date = c_dive_date iv_age = 30 )
|
|
msg = `180 days` ).
|
|
ENDMETHOD.
|
|
|
|
METHOD last_dive_missing.
|
|
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 = '00000000' iv_dive_date = c_dive_date iv_age = 30 ) ).
|
|
ENDMETHOD.
|
|
ENDCLASS.
|