Group Test System Macros
Macros for the test system.
Grouped Macros Overview
Expand to a test suite beginning. |
Expand to calling a test. |
Expand to test definition. |
Indicates whether debugging is enabled. |
Indicates whether testing is enabled. |
Expand to test suite ending. |
Force the test to return without failing and mark it as skipped. |
When using typedefs that are only used in debug mode then they have to be marked with macro. |
Grouped Macros Detail
TestSystemMacros#SEQAN_BEGIN_TESTSUITE
- Defined in
- <seqan/basic.h>
SEQAN_BEGIN_TESTSUITE(name)
- Parameters
-
name
(in) - The name of the test suite. - Data Races
- Thread safety unknown!
This macro expands to a main() function and some initialization code that sets up the test system.
Examples
#include <seqan/basic.h>
SEQAN_BEGIN_TESTSUITE(test_foo)
{
SEQAN_CALL_TEST(test_foo_my_test);
}
SEQAN_END_TESTSUITE
TestSystemMacros#SEQAN_CALL_TEST
- Defined in
- <seqan/basic.h>
SEQAN_CALL_TEST(test_name);
- Data Races
- Thread safety unknown!
This expects the test to be defined with SEQAN_DEFINE_TEST. This macro will expand to code that calls the code inside a try/catch block. Use this macro within a test suite, only.
Examples
// Within a test suite.
SEQAN_CALL_TEST(test_name);
TestSystemMacros#SEQAN_DEFINE_TEST
- Defined in
- <seqan/basic.h>
SEQAN_DEFINE_TEST(test_name)
- Data Races
- Thread safety unknown!
This macro expands to the definition of a $void$ function with SEQAN_TEST_ + test_name as its name.
Example
SEQAN_DEFINE_TEST(test_name)
{
SEQAN_ASSERT_LT(0, 3);
}
TestSystemMacros#SEQAN_ENABLE_DEBUG
- Defined in
- <seqan/basic.h>
SEQAN_ENABLE_DEBUG
- Data Races
- Thread safety unknown!
- See Also
-
- SEQAN_ENABLE_TESTING
When enabled (set to 1) then debugging is enabled. This means the assertion macros are expanded to actual test code. If debugging (and testing) is disabled then the SeqAn assertion macros expand to no instructions.
By default, thi sis set to 0 if NDEBUG is defined and set to 1 if NDEBUG is not defined.
If you want to change this value then you have to define this value before including any SeqAn header.
Force-enabled if SEQAN_ENABLE_TESTING is set to 1.
TestSystemMacros#SEQAN_ENABLE_TESTING
- Defined in
- <seqan/basic.h>
SEQAN_ENABLE_TESTING
- Data Races
- Thread safety unknown!
- See Also
-
- SEQAN_ENABLE_DEBUG
When set to 1, testing is enabled. If it is undefined or set to 0, testing is disabled. This means the macros for the tests (SEQAN_BEGIN_TESTSUITE, SEQAN_DEFINE_TEST, SEQAN_CALL_TEST, and SEQAN_END_TESTSUITE) will be enabled. This makes failing assertions raise exceptions instead of calling abort() (which terminates the program).
By default, this is set to 0.
If you want to change this value in your C++ program code you have to define this value before including any SeqAn header!
If set to 1 then SEQAN_ENABLE_DEBUG is forced to 1 as well.
TestSystemMacros#SEQAN_END_TESTSUITE
- Defined in
- <seqan/basic.h>
SEQAN_END_TESTSUITE
- Data Races
- Thread safety unknown!
This macro expands to finalization code for a test suite.
Examples
#include <seqan/basic.h>
SEQAN_BEGIN_TESTSUITE(test_foo)
{
SEQAN_CALL_TEST(test_foo_my_test);
}
SEQAN_END_TESTSUITE
TestSystemMacros#SEQAN_SKIP_TEST
- Defined in
- <seqan/basic.h>
SEQAN_SKIP_TEST;
- Data Races
- Thread safety unknown!
Examples
SEQAN_DEFINE_TEST(test_skipped)
{
SEQAN_SKIP_TEST;
}
TestSystemMacros#SEQAN_TYPEDEF_FOR_DEBUG
- Defined in
- <seqan/basic.h>
SEQAN_TYPEDE_FOR_DEBUG
- Data Races
- Thread safety unknown!
Examples
typedef int TInt SEQAN_TYPEDEF_FOR_DEBUG;