mirror of
https://github.com/google/googletest.git
synced 2025-04-05 13:35:03 +00:00
other macros
This commit is contained in:
parent
f670886941
commit
df805151fa
1 changed files with 74 additions and 12 deletions
|
@ -1865,18 +1865,80 @@ class TestWithParam : public Test, public WithParamInterface<T> {};
|
|||
// ASSERT_LT(i, array_size);
|
||||
// ASSERT_GT(records.size(), 0) << "There is no record left.";
|
||||
|
||||
#define EXPECT_EQ(val1, val2) \
|
||||
EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
|
||||
#define EXPECT_NE(val1, val2) \
|
||||
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
|
||||
#define EXPECT_LE(val1, val2) \
|
||||
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
|
||||
#define EXPECT_LT(val1, val2) \
|
||||
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
|
||||
#define EXPECT_GE(val1, val2) \
|
||||
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
|
||||
#define EXPECT_GT(val1, val2) \
|
||||
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
|
||||
#define EXPECT_EQ(val1, val2) \
|
||||
do { \
|
||||
const auto& gtest_retval = ::testing::internal::EqHelper::Compare( \
|
||||
#val1, #val2, static_cast<decltype(val1)>(val1), \
|
||||
static_cast<decltype(val2)>(val2)); \
|
||||
if (gtest_retval == ::testing::AssertionSuccess()) { \
|
||||
std::cout << "Success: Test Name: " << ::testing::UnitTest::GetInstance()->current_test_info()->name() << ", " \
|
||||
<< #val1 << ": " << val1 << ", " << #val2 << ": " << val2 << std::endl; \
|
||||
} else { \
|
||||
EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define EXPECT_NE(val1, val2) \
|
||||
do { \
|
||||
const auto& gtest_retval = ::testing::internal::CmpHelperNE( \
|
||||
#val1, #val2, static_cast<decltype(val1)>(val1), \
|
||||
static_cast<decltype(val2)>(val2)); \
|
||||
if (gtest_retval == ::testing::AssertionSuccess()) { \
|
||||
std::cout << "Success: Test Name: " << ::testing::UnitTest::GetInstance()->current_test_info()->name() << ", " \
|
||||
<< #val1 << ": " << val1 << ", " << #val2 << ": " << val2 << std::endl; \
|
||||
} else { \
|
||||
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define EXPECT_LE(val1, val2) \
|
||||
do { \
|
||||
const auto& gtest_retval = ::testing::internal::CmpHelperLE( \
|
||||
#val1, #val2, static_cast<decltype(val1)>(val1), \
|
||||
static_cast<decltype(val2)>(val2)); \
|
||||
if (gtest_retval == ::testing::AssertionSuccess()) { \
|
||||
std::cout << "Success: Test Name: " << ::testing::UnitTest::GetInstance()->current_test_info()->name() << ", " \
|
||||
<< #val1 << ": " << val1 << ", " << #val2 << ": " << val2 << std::endl; \
|
||||
} else { \
|
||||
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define EXPECT_LT(val1, val2) \
|
||||
do { \
|
||||
const auto& gtest_retval = ::testing::internal::CmpHelperLT( \
|
||||
#val1, #val2, static_cast<decltype(val1)>(val1), \
|
||||
static_cast<decltype(val2)>(val2)); \
|
||||
if (gtest_retval == ::testing::AssertionSuccess()) { \
|
||||
std::cout << "Success: Test Name: " << ::testing::UnitTest::GetInstance()->current_test_info()->name() << ", " \
|
||||
<< #val1 << ": " << val1 << ", " << #val2 << ": " << val2 << std::endl; \
|
||||
} else { \
|
||||
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define EXPECT_GE(val1, val2) \
|
||||
do { \
|
||||
const auto& gtest_retval = ::testing::internal::CmpHelperGE( \
|
||||
#val1, #val2, static_cast<decltype(val1)>(val1), \
|
||||
static_cast<decltype(val2)>(val2)); \
|
||||
if (gtest_retval == ::testing::AssertionSuccess()) { \
|
||||
std::cout << "Success: Test Name: " << ::testing::UnitTest::GetInstance()->current_test_info()->name() << ", " \
|
||||
<< #val1 << ": " << val1 << ", " << #val2 << ": " << val2 << std::endl; \
|
||||
} else { \
|
||||
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define EXPECT_GT(val1, val2) \
|
||||
do { \
|
||||
const auto& gtest_retval = ::testing::internal::CmpHelperGT( \
|
||||
#val1, #val2, static_cast<decltype(val1)>(val1), \
|
||||
static_cast<decltype(val2)>(val2)); \
|
||||
if (gtest_retval == ::testing::AssertionSuccess()) { \
|
||||
std::cout << "Success: Test Name: " << ::testing::UnitTest::GetInstance()->current_test_info()->name() << ", " \
|
||||
<< #val1 << ": " << val1 << ", "
|
||||
|
||||
|
||||
#define GTEST_ASSERT_EQ(val1, val2) \
|
||||
ASSERT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
|
||||
|
|
Loading…
Add table
Reference in a new issue