Scl test class: Difference between revisions
Jump to navigation
Jump to search
(→Notes) |
(→Notes) |
||
Line 19: | Line 19: | ||
== Notes == | == Notes == | ||
* This pragma requires the compilation language to be C++. If the compilation language is not C++ and this pragma is encountered, then an error is issued and this pragma is ignored. | * This pragma requires the compilation language to be C++. If the compilation language is not C++ and this pragma is encountered, then an error is issued and this pragma is ignored. | ||
* The test class identified | * The test class identified: | ||
** | ** Must have a public constructor. (The constructor may have parameters, but they must all be [http://en.wikipedia.org/wiki/Plain_Old_Data_Structures POD] type) | ||
** Must not be a templated class | |||
** | ** Must not be a nested class | ||
*** be declared within the test class (method | ** Must not be a pure virtual class | ||
*** 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). | ** Must have one or more member functions that is suitable as a test method. For a member function to be a test method it: | ||
*** not be a templatized function | *** Must be declared within the test class (a method that is inherited from a base class cannot be a test method) | ||
*** not be an overloaded operator | *** Must have a return type of bool, an integral type (signed or unsigned long, int, short, char) or void. | ||
*** | *** Must have an empty parameter list. That is, declared as f() or f(void). | ||
*** Must not be a templatized function | |||
*** Must not be an overloaded operator | |||
*** Must not be a static member. | |||
* Optionally if desired a set of [[scl_test_setup|setup]]/[[scl_test_teardown|teardown]] fixtures could be applied. | * Optionally if desired a set of [[scl_test_setup|setup]]/[[scl_test_teardown|teardown]] fixtures could be applied. | ||
* This pragma | * This pragma is available in STRIDE version 2.1 and later. | ||
== Examples == | == Examples == |
Revision as of 23:38, 25 March 2009
The scl_test_class pragma
The scl_test_class pragma is one of the Test Unit pragmas. It declares a test class as captured. Once captured, STRIDE will generate the appropriate code for executing the test methods in the class.
Syntax
#pragma scl_test_class(class-name)
Parameters | Type | Description |
class-name | String | The name of the test class to be captured. Once captured, STRIDE will generate the appropriate code for executing the test methods in the class. |
Notes
- This pragma requires the compilation language to be C++. If the compilation language is not C++ and this pragma is encountered, then an error is issued and this pragma is ignored.
- The test class identified:
- Must have a public constructor. (The constructor may have parameters, but they must all be POD type)
- Must not be a templated class
- Must not be a nested class
- Must not be a pure virtual class
- Must have one or more member functions that is suitable as a test method. For a member function to be a test method it:
- Must be declared within the test class (a method that is inherited from a base class cannot be a test method)
- Must have a return type of bool, an integral type (signed or unsigned long, int, short, char) or void.
- Must have an empty parameter list. That is, declared as f() or f(void).
- Must not be a templatized function
- Must not be an overloaded operator
- Must not be a static member.
- Must have one or more member functions that is suitable as a test method. For a member function to be a test method it:
- Optionally if desired a set of setup/teardown fixtures could be applied.
- This pragma is available in STRIDE version 2.1 and later.
Examples
#include <srtest.h>
class RuntimeServices_dynamic {
public:
void dynamic(void);
// Declaring a constructor for an scl_test_class is optional, but
// if a constructor is declared all parameters must be of plain old data (POD) type.
// An scl_test_class-specified class may only have one explicit public constructor.
// Declaration of this constructor results in IM synthesization of a function
// that initializes the test unit. The constructor parameters become parameters of
// the synthesized test unit.
RuntimeServices_dynamic(int i, int j, int k);
};
#ifdef _SCL
#pragma scl_test_class(RuntimeServices_dynamic)
#endif
See Also
- Refer to the Test Class Samples page for more information on capturing and qualifying test classes.