Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
62 lines
1.6 KiB
ABAP
62 lines
1.6 KiB
ABAP
CLASS {{p}}t41_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
|
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
|
PRIVATE SECTION.
|
|
METHODS score_of
|
|
IMPORTING iv_years TYPE i iv_degree TYPE string iv_match TYPE i
|
|
RETURNING VALUE(rv_score) TYPE i.
|
|
METHODS invite_for_expert FOR TESTING.
|
|
METHODS review_for_graduate FOR TESTING.
|
|
METHODS reject_for_junior FOR TESTING.
|
|
METHODS invalid_input FOR TESTING.
|
|
ENDCLASS.
|
|
|
|
|
|
CLASS {{p}}t41_test IMPLEMENTATION.
|
|
|
|
METHOD score_of.
|
|
CALL FUNCTION '{{P}}APPL_SCORE'
|
|
EXPORTING
|
|
iv_years = iv_years
|
|
iv_degree = iv_degree
|
|
iv_match = iv_match
|
|
IMPORTING
|
|
ev_score = rv_score
|
|
EXCEPTIONS
|
|
invalid_years = 1
|
|
invalid_match = 2
|
|
invalid_degree = 3
|
|
OTHERS = 4.
|
|
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
|
|
ENDMETHOD.
|
|
|
|
METHOD invite_for_expert.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = 100
|
|
act = score_of( iv_years = 5 iv_degree = 'PHD' iv_match = 100 ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD review_for_graduate.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = 50
|
|
act = score_of( iv_years = 5 iv_degree = 'VOC' iv_match = 0 ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD reject_for_junior.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = 18
|
|
act = score_of( iv_years = 1 iv_degree = 'VOC' iv_match = 0 ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD invalid_input.
|
|
CALL FUNCTION '{{P}}APPL_SCORE'
|
|
EXPORTING
|
|
iv_years = -1
|
|
iv_degree = 'PHD'
|
|
iv_match = 50
|
|
EXCEPTIONS
|
|
invalid_years = 1
|
|
OTHERS = 2.
|
|
cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ).
|
|
ENDMETHOD.
|
|
ENDCLASS.
|