Unit test framework much like Google Test but with task support. More...
Macros | |
#define | UNIT(...) |
Define a unit test function. | |
#define | UNIT_ASSERT(ASSERTION, ...) |
Run an assertion and include captured output in any error message. | |
#define | UNIT_CAPTURE() |
A stream that collects output for comparison. | |
#define | UNIT_DUMP() |
Return captured output. | |
#define | UNIT_EQUAL_BLESSED(f) |
Compare captured output to a blessed file. | |
#define | UNIT_WRITE(f) |
Write captured output to file. | |
Typedefs | |
template<target_type Target> | |
using | driver = action< Target, test_control_points::driver > |
A test registration. | |
template<target_type Target> | |
using | finalization = action< Target, test_control_points::finalization > |
A test finalization registration. | |
template<target_type Target> | |
using | initialization = action< Target, test_control_points::initialization > |
A test initialization registration. | |
Assertion macros | |
Values to includes in a failure message may be streamed into an assertion: EXPECT_GE(foo, 0) << foo << " should be non-negative";
Macros that begin with | |
#define | ASSERT_TRUE(c) |
Comparison. | |
#define | EXPECT_TRUE(c) |
Comparison. | |
#define | ASSERT_FALSE(c) |
Comparison. | |
#define | EXPECT_FALSE(c) |
Comparison. | |
#define | ASSERT_EQ(x, y) |
Comparison. | |
#define | EXPECT_EQ(x, y) |
Comparison. | |
#define | ASSERT_NE(x, y) |
Comparison. | |
#define | EXPECT_NE(x, y) |
Comparison. | |
#define | ASSERT_LT(x, y) |
Comparison. | |
#define | EXPECT_LT(x, y) |
Comparison. | |
#define | ASSERT_LE(x, y) |
Comparison. | |
#define | EXPECT_LE(x, y) |
Comparison. | |
#define | ASSERT_GT(x, y) |
Comparison. | |
#define | EXPECT_GT(x, y) |
Comparison. | |
#define | ASSERT_GE(x, y) |
Comparison. | |
#define | EXPECT_GE(x, y) |
Comparison. | |
#define | ASSERT_STREQ(x, y) |
Compare null-terminated strings, abandoning test on inequality. | |
#define | EXPECT_STREQ(x, y) |
Check equality of null-terminated strings. | |
#define | ASSERT_STRNE(x, y) |
Compare null-terminated strings, abandoning test on equality. | |
#define | EXPECT_STRNE(x, y) |
Check inequality of null-terminated strings. | |
#define | ASSERT_STRCASEEQ(x, y) |
Compare null-terminated strings, ignoring case and abandoning test on inequality. | |
#define | EXPECT_STRCASEEQ(x, y) |
Check equality of null-terminated strings, ignoring case. | |
#define | ASSERT_STRCASENE(x, y) |
Compare null-terminated strings, ignoring case and abandoning test on equality. | |
#define | EXPECT_STRCASENE(x, y) |
Check inequality of null-terminated strings, ignoring case. | |
Unit test framework much like Google Test but with task support.
Each Target is a function with signature int()
; if any returns a non-zero value, so does the process built with flecsi_add_test
. Output is via Logging.
#define UNIT | ( | ... | ) |
Define a unit test function.
Should be followed by a compound statement, which can use the other unit-testing macros, and a semicolon, and should generally appear alone in a function that returns int
. Optionally, provide an expression convertible to std::string
to label the test results (along with __func__
); the default is "TEST".
ASSERT
/EXPECT
macros can be used in a lambda defined inside the compound statement with [&]
. #define ASSERT_TRUE | ( | c | ) |
Comparison.
#define EXPECT_TRUE | ( | c | ) |
Comparison.
#define ASSERT_FALSE | ( | c | ) |
Comparison.
#define EXPECT_FALSE | ( | c | ) |
Comparison.
#define ASSERT_EQ | ( | x, | |
y | |||
) |
Comparison.
#define EXPECT_EQ | ( | x, | |
y | |||
) |
Comparison.
#define ASSERT_NE | ( | x, | |
y | |||
) |
Comparison.
#define EXPECT_NE | ( | x, | |
y | |||
) |
Comparison.
#define ASSERT_LT | ( | x, | |
y | |||
) |
Comparison.
#define EXPECT_LT | ( | x, | |
y | |||
) |
Comparison.
#define ASSERT_LE | ( | x, | |
y | |||
) |
Comparison.
#define EXPECT_LE | ( | x, | |
y | |||
) |
Comparison.
#define ASSERT_GT | ( | x, | |
y | |||
) |
Comparison.
#define EXPECT_GT | ( | x, | |
y | |||
) |
Comparison.
#define ASSERT_GE | ( | x, | |
y | |||
) |
Comparison.
#define EXPECT_GE | ( | x, | |
y | |||
) |
Comparison.
#define ASSERT_STREQ | ( | x, | |
y | |||
) |
Compare null-terminated strings, abandoning test on inequality.
#define EXPECT_STREQ | ( | x, | |
y | |||
) |
Check equality of null-terminated strings.
#define ASSERT_STRNE | ( | x, | |
y | |||
) |
Compare null-terminated strings, abandoning test on equality.
#define EXPECT_STRNE | ( | x, | |
y | |||
) |
Check inequality of null-terminated strings.
#define ASSERT_STRCASEEQ | ( | x, | |
y | |||
) |
Compare null-terminated strings, ignoring case and abandoning test on inequality.
#define EXPECT_STRCASEEQ | ( | x, | |
y | |||
) |
Check equality of null-terminated strings, ignoring case.
#define ASSERT_STRCASENE | ( | x, | |
y | |||
) |
Compare null-terminated strings, ignoring case and abandoning test on equality.
#define EXPECT_STRCASENE | ( | x, | |
y | |||
) |
Check inequality of null-terminated strings, ignoring case.
#define UNIT_CAPTURE | ( | ) |
A stream that collects output for comparison.
#define UNIT_DUMP | ( | ) |
Return captured output.
std::string
#define UNIT_EQUAL_BLESSED | ( | f | ) |
Compare captured output to a blessed file.
bool
#define UNIT_WRITE | ( | f | ) |
Write captured output to file.
#define UNIT_ASSERT | ( | ASSERTION, | |
... | |||
) |
Run an assertion and include captured output in any error message.
ASSERTION | macro name (TRUE , EQ , etc.) |
using initialization = action<Target, test_control_points::initialization> |
A test initialization registration.
Declare a non-local variable of this type for each function.
Target | the function to call |
using driver = action<Target, test_control_points::driver> |
A test registration.
Declare a non-local variable of this type for each function.
Target | the test function to call |
using finalization = action<Target, test_control_points::finalization> |
A test finalization registration.
Declare a non-local variable of this type for each function.
Target | the function to call |