Scl test cclass
Jump to navigation
Jump to search
The scl_test_cclass pragma
The scl_test_cclass pragma declares a "C" language struct (class) to be captured as a test unit. Once captured, STRIDE will generate the appropriate code for executing test methods defined for this "C" Class.
Syntax
#pragma scl_test_cclass(cclass-name, init-function-name)
Parameters | Type | Description |
cclass-name | Object | The name of the test struct (can be a class in C++) to be captured. |
init-function-name | Object | The initialization function name. |
Notes
- The test C class identified must:
- Have a public constructor.
- The constructor may have parameters, but they must all be POD type.
- Have one or more member functions that suitable as a test method. For a member function to be a test method it must:
- be declared within the test class (method not declared, but inherited from a base class cannot be test methods)
- have a return type of bool, an integral type (signed or unsigned long, int, short, char) or void.
- have an empty parameter list. That is, declared as f() or f(void).
- not be a templatized function
- not be an overloaded operator
- The class cannot be a pure virtual class
- not be a static member.
- Cannot be a templated class.
- Cannot be a nested class.
- This pragma can only work in STRIDE version 2.1 or later.
- The host PC must also have a recent distribution of ActiveState Perl installed.
Examples
#include <srtest.h> typedef struct CClass_Basic_Simple { int (*pf_TestMethod)(struct CClass_Basic_Simple* pcc); } CClass_Basic_Simple; #ifdef __cplusplus extern "C" { #endif void CClass_Basic_Simple_init(struct CClass_Basic_Simple* pcc); #ifdef __cplusplus } #endif #ifdef _SCL #pragma scl_test_cclass(CClass_Basic_Simple, CClass_Basic_Simple_init) #endif
See Also
- Refer to the Test "C" Class Samples page for more information on capturing and qualifying test "C" classes.