Difference between revisions of "Scl test flist"

From STRIDE Wiki
Jump to: navigation, search
(The scl_test_flist pragma)
(See Also)
Line 57: Line 57:
  
 
== See Also ==
 
== See Also ==
* Refer to the [[Test FList Sample]] page for more information on capturing and qualifying test units.
+
* Refer to the [[Test Function List Sample]] page for more information on capturing and qualifying test units.
  
 
[[Category: Test Units]]
 
[[Category: Test Units]]
 
[[Category: SCL]]
 
[[Category: SCL]]

Revision as of 12:14, 7 October 2008

The scl_test_flist pragma

The scl_test_flist pragma is one of the Test Unit pragmas. It captures a list of external functions as a Test Unit. Once captured, each external function becomes a test method. STRIDE will generate appropriate code for execution of the test methods.

Syntax

#pragma scl_test_flist(test-unit-name, function-1, function-2..n)
Parameters Type Description
test-unit-name String Name of test unit into which a list of external functions will be assembled.
function-1 String Name of the first external function to be captured.
function-2..n [Optional] String Optional names of second and subsequent external functions to be captured.

Notes

  • The external functions must meet the following conditions:
    • Their parameter lists must be empty (void).
    • They cannot be overloaded.
    • They cannot be overloaded operators.
    • They may not be template functions.
    • They may throw exceptions when compiled in CPP mode.
    • They cannot have been previously captured with scl_function, or another scl_test_flist pragma.
    • They cannot be public static class methods.
    • They must return a pass/fail result. The return type may be declared void or an integer type (bool is acceptable in C++ mode). If void is the return type, any calls to the test function default to successful.
  • Once an external function has been captured with scl_test_flist, that function may not then be captured again with an scl_function pragma, or another scl_test_flist pragma, or used with any other qualification pragmas.
  • Use of this pragma requires an include of srtest.h.
  • The test-unit-name may not have been specified with a prior scl_test_flist pragma.
  • The test-unit-name may not be the name of an existing routine.
  • In CPP-compile mode, the external function(s) must have been declared using 'extern "C"'.
  • There is no way to associate a SMID value with an external function, as with scl_func.

Examples

#include <srtest.h>

int test1();
int test2();
 
#ifdef _SCL
#pragma scl_test_flist("Foo", test1, test2)
#endif

See Also