|
#define | ASSERT_EQ(expected, actual) NLIB_TESTING_ASSERT_HELPER_(::nlib_ns::testing::CompEQ, expected, actual) |
| Evaluates whether expected == actual. If the test fails, control leaves the currently running function. More...
|
|
#define | ASSERT_NE(expected, actual) NLIB_TESTING_ASSERT_HELPER_(::nlib_ns::testing::CompNE, expected, actual) |
| Evaluates whether val1 != val2. If the test fails, control leaves the currently running function.
|
|
#define | ASSERT_LT(val1, val2) NLIB_TESTING_ASSERT_HELPER_(::nlib_ns::testing::CompLT, val1, val2) |
| Evaluates whether val1 < val2. If the test fails, control leaves the currently running function.
|
|
#define | ASSERT_LE(val1, val2) NLIB_TESTING_ASSERT_HELPER_(::nlib_ns::testing::CompLE, val1, val2) |
| Evaluates whether val1 <= val2. If the test fails, control leaves the currently running function.
|
|
#define | ASSERT_GT(val1, val2) NLIB_TESTING_ASSERT_HELPER_(::nlib_ns::testing::CompGT, val1, val2) |
| Evaluates whether val1 > val2. If the test fails, control leaves the currently running function.
|
|
#define | ASSERT_GE(val1, val2) NLIB_TESTING_ASSERT_HELPER_(::nlib_ns::testing::CompGE, val1, val2) |
| Evaluates whether val1 >= val2. If the test fails, control leaves the currently running function.
|
|
#define | ASSERT_STREQ(expected, actual) NLIB_TESTING_ASSERT_HELPER_(::nlib_ns::testing::CompStrEq, expected, actual) |
| Evaluates whether the two C strings are identical. If the test fails, control leaves the currently running function.
|
|
#define | ASSERT_STRNE(expected, actual) NLIB_TESTING_ASSERT_HELPER_(::nlib_ns::testing::CompStrNe, expected, actual) |
| Evaluates whether the two C strings are not identical. If the test fails, control leaves the currently running function.
|
|
#define | ASSERT_STRCASEEQ(expected, actual) NLIB_TESTING_ASSERT_HELPER_(::nlib_ns::testing::CompStrCaseEq, expected, actual) |
| Tests whether two C strings are the same, ignoring case. If the test fails, control leaves the currently running function.
|
|
#define | ASSERT_STRCASENE(expected, actual) NLIB_TESTING_ASSERT_HELPER_(::nlib_ns::testing::CompStrCaseNe, expected, actual) |
| Tests whether two C strings are not the same, ignoring case. If the test fails, control leaves the currently running function.
|
|
#define | ASSERT_FLOAT_EQ(expected, actual) NLIB_TESTING_ASSERT_HELPER_(::nlib_ns::testing::CompFloatEq, expected, actual) |
| Evaluates whether the two float values are similar. If the test fails, control leaves the currently running function. More...
|
|
#define | ASSERT_DOUBLE_EQ(expected, actual) NLIB_TESTING_ASSERT_HELPER_(::nlib_ns::testing::CompDoubleEq, expected, actual) |
| Evaluates whether the two double values are similar. If the test fails, control leaves the currently running function. More...
|
|
#define | ASSERT_NEAR(val1, val2, abs_error) |
| Evaluates whether the difference between val1 and val2 is within abs_error. If the test fails, control leaves the currently running function.
|
|
|
#define | EXPECT_EQ(expected, actual) NLIB_TESTING_EXPECT_HELPER_(::nlib_ns::testing::CompEQ, expected, actual) |
| If the test failed, control leaves the currently running function, just like ASSERT_EQ .
|
|
#define | EXPECT_NE(expected, actual) NLIB_TESTING_EXPECT_HELPER_(::nlib_ns::testing::CompNE, expected, actual) |
| If the test failed, control leaves the currently running function, just like ASSERT_NE .
|
|
#define | EXPECT_LT(val1, val2) NLIB_TESTING_EXPECT_HELPER_(::nlib_ns::testing::CompLT, val1, val2) |
| If the test failed, control leaves the currently running function, just like ASSERT_LT .
|
|
#define | EXPECT_LE(val1, val2) NLIB_TESTING_EXPECT_HELPER_(::nlib_ns::testing::CompLE, val1, val2) |
| If the test failed, control leaves the currently running function, just like ASSERT_LT .
|
|
#define | EXPECT_GT(val1, val2) NLIB_TESTING_EXPECT_HELPER_(::nlib_ns::testing::CompGT, val1, val2) |
| If the test failed, control leaves the currently running function, just like ASSERT_GT .
|
|
#define | EXPECT_GE(val1, val2) NLIB_TESTING_EXPECT_HELPER_(::nlib_ns::testing::CompGE, val1, val2) |
| If the test failed, control leaves the currently running function, just like ASSERT_GE .
|
|
#define | EXPECT_STREQ(expected, actual) NLIB_TESTING_EXPECT_HELPER_(::nlib_ns::testing::CompStrEq, expected, actual) |
| If the test failed, control leaves the currently running function, just like ASSERT_STREQ .
|
|
#define | EXPECT_STRNE(expected, actual) NLIB_TESTING_EXPECT_HELPER_(::nlib_ns::testing::CompStrNe, expected, actual) |
| If the test failed, control leaves the currently running function, just like ASSERT_STRNE .
|
|
#define | EXPECT_STRCASEEQ(expected, actual) NLIB_TESTING_EXPECT_HELPER_(::nlib_ns::testing::CompStrCaseEq, expected, actual) |
| If the test fails, control leaves the currently running function, as in ASSERT_STRCASEEQ .
|
|
#define | EXPECT_STRCASENE(expected, actual) NLIB_TESTING_EXPECT_HELPER_(::nlib_ns::testing::CompStrCaseNe, expected, actual) |
| If the test fails, control leaves the currently running function, as in ASSERT_STRCASENE .
|
|
#define | EXPECT_FLOAT_EQ(expected, actual) NLIB_TESTING_EXPECT_HELPER_(::nlib_ns::testing::CompFloatEq, expected, actual) |
| If the test failed, control leaves the currently running function, just like ASSERT_FLOAT_EQ .
|
|
#define | EXPECT_DOUBLE_EQ(expected, actual) NLIB_TESTING_EXPECT_HELPER_(::nlib_ns::testing::CompDoubleEq, expected, actual) |
| If the test failed, control leaves the currently running function, just like ASSERT_DOUBLE_EQ .
|
|
#define | EXPECT_NEAR(val1, val2, abs_error) |
| If the test failed, control leaves the currently running function, just like ASSERT_NEAR .
|
|
|
For functions that return a bool type, you can view the function arguments when the function fails by providing the function to the following macros.
- Description
- A simple example is provided below.
bool IsEven(int n) { return n % 2 == 0; } }
|
#define | ASSERT_PRED1(pred, v1) NLIB_TESTING_PRED1_(pred, v1, NLIB_TESTING_FATAL_) |
| Evaluates whether pred(v1) is true . If the test fails, control leaves the currently running function.
|
|
#define | ASSERT_PRED2(pred, v1, v2) NLIB_TESTING_PRED2_(pred, v1, v2, NLIB_TESTING_FATAL_) |
| Evaluates whether pred(v1, v2) is true . If the test fails, control leaves the currently running function.
|
|
#define | ASSERT_PRED3(pred, v1, v2, v3) NLIB_TESTING_PRED3_(pred, v1, v2, v3, NLIB_TESTING_FATAL_) |
| Evaluates whether pred(v1, v2, v3) is true . If the test fails, control leaves the currently running function.
|
|
#define | ASSERT_PRED4(pred, v1, v2, v3, v4) NLIB_TESTING_PRED4_(pred, v1, v2, v3, v4, NLIB_TESTING_FATAL_) |
| Evaluates whether pred(v1, v2, v3, v4) is true . If the test fails, control leaves the currently running function.
|
|
#define | ASSERT_PRED5(pred, v1, v2, v3, v4, v5) NLIB_TESTING_PRED5_(pred, v1, v2, v3, v4, v5, NLIB_TESTING_FATAL_) |
| Evaluates whether pred(v1, v2, v3, v4, v5) is true . If the test fails, control leaves the currently running function.
|
|
|
For functions that return a bool type, you can view the function arguments when the function fails by providing the function to the following macros.
|
#define | EXPECT_PRED1(pred, v1) NLIB_TESTING_PRED1_(pred, v1, NLIB_TESTING_NONFATAL_) |
| Even if the test failed, control does not leave the currently running function, just like ASSERT_PRED1 .
|
|
#define | EXPECT_PRED2(pred, v1, v2) NLIB_TESTING_PRED2_(pred, v1, v2, NLIB_TESTING_NONFATAL_) |
| Even if the test failed, control does not leave the currently running function, just like ASSERT_PRED2 .
|
|
#define | EXPECT_PRED3(pred, v1, v2, v3) NLIB_TESTING_PRED3_(pred, v1, v2, v3, NLIB_TESTING_NONFATAL_) |
| Even if the test failed, control does not leave the currently running function, just like ASSERT_PRED3 .
|
|
#define | EXPECT_PRED4(pred, v1, v2, v3, v4) NLIB_TESTING_PRED4_(pred, v1, v2, v3, v4, NLIB_TESTING_NONFATAL_) |
| Even if the test failed, control does not leave the currently running function, just like ASSERT_PRED4 .
|
|
#define | EXPECT_PRED5(pred, v1, v2, v3, v4, v5) NLIB_TESTING_PRED5_(pred, v1, v2, v3, v4, v5, NLIB_TESTING_NONFATAL_) |
| Even if the test failed, control does not leave the currently running function, just like ASSERT_PRED5 .
|
|
|
Use the following macros to customize the message when ASSERT_PREDn fails.
- Description
- In the following simply written example, a function that returns the
AssertionResult type is defined and tested using ASSERT_TRUE , etc. ::testing::AssertionResult IsEven(int n) { if (n % 2 != 0) return ::testing::AssertionFailure() << n << " is not even"; return ::testing::AssertionSuccess(); } TEST(PredAssertionResult, test) { } If you wish to further customize the code, use ASSERT_PREDn() as follows. ::testing::AssertionResult IsEven(const char* n_expr, int n) { if (n % 2 != 0) return ::testing::AssertionFailure() << n_expr << " is not even"; return ::testing::AssertionSuccess(); } }
|
#define | ASSERT_PRED_FORMAT1(pred_format, v1) NLIB_TESTING_PRED_FORMAT1_(pred_format, v1, NLIB_TESTING_FATAL_) |
| ASSERT_PRED1 may be used by the user to define the display at failure. If the test fails, control leaves the currently running function.
|
|
#define | ASSERT_PRED_FORMAT2(pred_format, v1, v2) NLIB_TESTING_PRED_FORMAT2_(pred_format, v1, v2, NLIB_TESTING_FATAL_) |
| ASSERT_PRED2 may be used by the user to define the display at failure. If the test fails, control leaves the currently running function.
|
|
#define | ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) NLIB_TESTING_PRED_FORMAT3_(pred_format, v1, v2, v3, NLIB_TESTING_FATAL_) |
| ASSERT_PRED3 may be used by the user to define the display at failure. If the test fails, control leaves the currently running function.
|
|
#define | ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) NLIB_TESTING_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, NLIB_TESTING_FATAL_) |
| ASSERT_PRED4 may be used by the user to define the display at failure. If the test fails, control leaves the currently running function.
|
|
#define | ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) NLIB_TESTING_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, NLIB_TESTING_FATAL_) |
| ASSERT_PRED5 may be used by the user to define the display at failure. If the test fails, control leaves the currently running function.
|
|