Scl test flist
Jump to navigation
Jump to search
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.
Note: this string may not contain a space. |
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.
- Optionally if desired a set of setup/teardown fixtures could be applied.
- This pragma can only work in STRIDE version 2.1 or later.
Examples
#include <srtest.h>
int test1();
int test2();
#ifdef _SCL
#pragma scl_test_flist("Foo", test1, test2)
#endif
See Also
- Refer to the Test Function List Samples page for more information on capturing and qualifying test units.