[22] | 1 | /**
|
---|
| 2 | * @author ETSI
|
---|
| 3 | * @version $URL: svn+ssh://vcs.etsi.org/TTCN3/LIB/Ttcn3LibCommon/trunk/ttcn/LibCommon_VerdictControl.ttcn $
|
---|
| 4 | * $Id: LibCommon_VerdictControl.ttcn 29 2008-11-24 10:08:08Z mullers $
|
---|
| 5 | * @desc Contains generic functions which set test component verdicts
|
---|
| 6 | * based on generic function return codes according to established
|
---|
| 7 | * test implementation practice. These functions should only be called
|
---|
| 8 | * from test case functions (see reusable t3 code methodology) only.
|
---|
| 9 | * @remark End users should be aware that any changes made to the in
|
---|
| 10 | * definitions this module may be overwritten in future releases.
|
---|
| 11 | * End users are encouraged to contact the distributers of this
|
---|
| 12 | * module regarding their modifications or additions so that future
|
---|
| 13 | * updates will include your changes.
|
---|
| 14 | */
|
---|
| 15 | module LibCommon_VerdictControl {
|
---|
| 16 |
|
---|
| 17 | /**
|
---|
| 18 | * @desc Collection of all possible function return codes.
|
---|
| 19 | * This type should be used as a return parameter type
|
---|
| 20 | * in all TTCN-3 function definitions (except for
|
---|
| 21 | * functions invoked from in TTCN-3 start statements).
|
---|
| 22 | * This return value should be used to communicate a
|
---|
| 23 | * verdict to the caller _instead of_ literally setting
|
---|
| 24 | * a verdict in the function! This warrants a higher
|
---|
| 25 | * degree of reuse for the function.
|
---|
| 26 | */
|
---|
| 27 | type enumerated FncRetCode {
|
---|
| 28 | e_success(0),
|
---|
| 29 | // error codes
|
---|
| 30 | e_error(1),
|
---|
| 31 | e_timeout(2)
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | /**
|
---|
| 35 | * @desc This function should be used for verdict
|
---|
| 36 | * setting after completion of, e.g., the test body
|
---|
| 37 | * execution.
|
---|
| 38 | * Sets verdicts are INCONC in case of a timeout, FAIL
|
---|
| 39 | * in case of an error, and PASS otherwise.
|
---|
| 40 | * @param p_ret Current execution status
|
---|
| 41 | */
|
---|
| 42 | function f_setVerdict ( FncRetCode p_ret ) {
|
---|
| 43 | if ( p_ret == e_success ) {
|
---|
| 44 | setverdict(pass);
|
---|
| 45 | } else if ( p_ret == e_timeout ) {
|
---|
| 46 | setverdict(inconc);
|
---|
| 47 | } else {
|
---|
| 48 | setverdict(fail);
|
---|
| 49 | }
|
---|
| 50 | } // end function f_setVerdict
|
---|
| 51 |
|
---|
| 52 |
|
---|
| 53 | /**
|
---|
| 54 | * @desc This function should be used for verdict
|
---|
| 55 | * setting after completion of a preamble
|
---|
| 56 | * execution.
|
---|
| 57 | * Sets verdicts are INCONC in case of a timeout or
|
---|
| 58 | * an error, and PASS otherwise.
|
---|
| 59 | * @param p_ret Preamble execution status
|
---|
| 60 | */
|
---|
| 61 | function f_setVerdictPreamble ( FncRetCode p_ret ) {
|
---|
| 62 | log("f_setVerdictPreamble: This function is deprecated. Use f_setVerdictPreOrPostamble instead. ");
|
---|
| 63 | f_setVerdictPreOrPostamble(p_ret);
|
---|
| 64 | } // end function f_setVerdictPreamble
|
---|
| 65 |
|
---|
| 66 |
|
---|
| 67 | /**
|
---|
| 68 | * @desc This function should be used for verdict
|
---|
| 69 | * setting after completion of a postamble
|
---|
| 70 | * execution.
|
---|
| 71 | * Sets verdicts are INCONC in case of a timeout or
|
---|
| 72 | * an error, and PASS otherwise.
|
---|
| 73 | * @param p_ret Postamble execution status
|
---|
| 74 | */
|
---|
| 75 | function f_setVerdictPostamble ( FncRetCode p_ret ) {
|
---|
| 76 | log("f_setVerdictPostamble: This function is deprecated. Use f_setVerdictPreOrPostamble instead. ");
|
---|
| 77 | f_setVerdictPreOrPostamble(p_ret);
|
---|
| 78 | } // end function f_setVerdictPostamble
|
---|
| 79 |
|
---|
| 80 | /**
|
---|
| 81 | * @desc This function should be used for verdict
|
---|
| 82 | * setting outside the test body.
|
---|
| 83 | * Sets verdicts are INCONC in case of a timeout or
|
---|
| 84 | * an error, and PASS otherwise.
|
---|
| 85 | * @param p_ret Postamble execution status
|
---|
| 86 | */
|
---|
| 87 | function f_setVerdictPreOrPostamble ( FncRetCode p_ret ) {
|
---|
| 88 | if ( p_ret != e_success ) {
|
---|
| 89 | setverdict(inconc);
|
---|
| 90 | } else {
|
---|
| 91 | setverdict(pass);
|
---|
| 92 | }
|
---|
| 93 | } // end function f_setVerdictPreOrPostamble
|
---|
| 94 |
|
---|
| 95 | } // end module LibCommon_VerdictControl
|
---|