Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
73
tasks_gen/train/G1109/reference/tel_test.clas.abap
Normal file
73
tasks_gen/train/G1109/reference/tel_test.clas.abap
Normal file
@@ -0,0 +1,73 @@
|
||||
CLASS {{p}}tel_test DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS rate
|
||||
IMPORTING iv_ctype TYPE string
|
||||
iv_zone TYPE string
|
||||
iv_secs TYPE i
|
||||
EXPORTING ev_minutes TYPE i
|
||||
ev_charge TYPE decfloat34
|
||||
ev_subrc TYPE sysubrc.
|
||||
|
||||
METHODS zero_duration FOR TESTING.
|
||||
METHODS national_call FOR TESTING.
|
||||
METHODS rounds_up FOR TESTING.
|
||||
METHODS unknown_type FOR TESTING.
|
||||
METHODS negative_secs FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}tel_test IMPLEMENTATION.
|
||||
METHOD rate.
|
||||
CALL FUNCTION '{{P}}TEL_RATE'
|
||||
EXPORTING
|
||||
iv_ctype = iv_ctype
|
||||
iv_zone = iv_zone
|
||||
iv_secs = iv_secs
|
||||
IMPORTING
|
||||
ev_minutes = ev_minutes
|
||||
ev_charge = ev_charge
|
||||
EXCEPTIONS
|
||||
invalid_duration = 1
|
||||
OTHERS = 2.
|
||||
ev_subrc = sy-subrc.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD zero_duration.
|
||||
rate( EXPORTING iv_ctype = 'NT' iv_zone = 'A' iv_secs = 0
|
||||
IMPORTING ev_minutes = DATA(lv_min) ev_charge = DATA(lv_charge) ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_min ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_charge ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD national_call.
|
||||
rate( EXPORTING iv_ctype = 'NT' iv_zone = 'A' iv_secs = 30
|
||||
IMPORTING ev_minutes = DATA(lv_min) ev_charge = DATA(lv_charge) ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_min ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '0.12' ) act = lv_charge ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rounds_up.
|
||||
rate( EXPORTING iv_ctype = 'IT' iv_zone = 'B' iv_secs = 61
|
||||
IMPORTING ev_minutes = DATA(lv_min) ev_charge = DATA(lv_charge) ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lv_min ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '0.81' ) act = lv_charge ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_type.
|
||||
rate( EXPORTING iv_ctype = 'XX' iv_zone = 'A' iv_secs = 60
|
||||
IMPORTING ev_minutes = DATA(lv_min) ev_charge = DATA(lv_charge) ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_rc ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_min ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( 0 ) act = lv_charge ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD negative_secs.
|
||||
rate( EXPORTING iv_ctype = 'NT' iv_zone = 'A' iv_secs = -1
|
||||
IMPORTING ev_minutes = DATA(lv_min) ev_charge = DATA(lv_charge) ev_subrc = DATA(lv_rc) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rc ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user