Implements GTEST_ASSERT_XY as alias of ASSERT_XY.
This commit is contained in:
parent
dac3e879c5
commit
345d9ebf30
@ -1799,21 +1799,48 @@ const T* TestWithParam<T>::parameter_ = NULL;
|
||||
#define EXPECT_GT(val1, val2) \
|
||||
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
|
||||
|
||||
#define ASSERT_EQ(expected, actual) \
|
||||
#define GTEST_ASSERT_EQ(expected, actual) \
|
||||
ASSERT_PRED_FORMAT2(::testing::internal:: \
|
||||
EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \
|
||||
expected, actual)
|
||||
#define ASSERT_NE(val1, val2) \
|
||||
#define GTEST_ASSERT_NE(val1, val2) \
|
||||
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
|
||||
#define ASSERT_LE(val1, val2) \
|
||||
#define GTEST_ASSERT_LE(val1, val2) \
|
||||
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
|
||||
#define ASSERT_LT(val1, val2) \
|
||||
#define GTEST_ASSERT_LT(val1, val2) \
|
||||
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
|
||||
#define ASSERT_GE(val1, val2) \
|
||||
#define GTEST_ASSERT_GE(val1, val2) \
|
||||
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
|
||||
#define ASSERT_GT(val1, val2) \
|
||||
#define GTEST_ASSERT_GT(val1, val2) \
|
||||
ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
|
||||
|
||||
// Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of
|
||||
// ASSERT_XY(), which clashes with some users' own code.
|
||||
|
||||
#if !GTEST_DONT_DEFINE_ASSERT_EQ
|
||||
#define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
|
||||
#endif
|
||||
|
||||
#if !GTEST_DONT_DEFINE_ASSERT_NE
|
||||
#define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
|
||||
#endif
|
||||
|
||||
#if !GTEST_DONT_DEFINE_ASSERT_LE
|
||||
#define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
|
||||
#endif
|
||||
|
||||
#if !GTEST_DONT_DEFINE_ASSERT_LT
|
||||
#define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
|
||||
#endif
|
||||
|
||||
#if !GTEST_DONT_DEFINE_ASSERT_GE
|
||||
#define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
|
||||
#endif
|
||||
|
||||
#if !GTEST_DONT_DEFINE_ASSERT_GT
|
||||
#define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
|
||||
#endif
|
||||
|
||||
// C String Comparisons. All tests treat NULL and any non-NULL string
|
||||
// as different. Two NULLs are equal.
|
||||
//
|
||||
|
@ -6866,6 +6866,41 @@ GTEST_TEST(AlternativeNameTest, Works) { // GTEST_TEST is the same as TEST.
|
||||
// GTEST_FAIL is the same as FAIL.
|
||||
EXPECT_FATAL_FAILURE(GTEST_FAIL() << "An expected failure",
|
||||
"An expected failure");
|
||||
|
||||
// GTEST_ASSERT_XY is the same as ASSERT_XY.
|
||||
|
||||
GTEST_ASSERT_EQ(0, 0);
|
||||
EXPECT_FATAL_FAILURE(GTEST_ASSERT_EQ(0, 1) << "An expected failure",
|
||||
"An expected failure");
|
||||
EXPECT_FATAL_FAILURE(GTEST_ASSERT_EQ(1, 0) << "An expected failure",
|
||||
"An expected failure");
|
||||
|
||||
GTEST_ASSERT_NE(0, 1);
|
||||
GTEST_ASSERT_NE(1, 0);
|
||||
EXPECT_FATAL_FAILURE(GTEST_ASSERT_NE(0, 0) << "An expected failure",
|
||||
"An expected failure");
|
||||
|
||||
GTEST_ASSERT_LE(0, 0);
|
||||
GTEST_ASSERT_LE(0, 1);
|
||||
EXPECT_FATAL_FAILURE(GTEST_ASSERT_LE(1, 0) << "An expected failure",
|
||||
"An expected failure");
|
||||
|
||||
GTEST_ASSERT_LT(0, 1);
|
||||
EXPECT_FATAL_FAILURE(GTEST_ASSERT_LT(0, 0) << "An expected failure",
|
||||
"An expected failure");
|
||||
EXPECT_FATAL_FAILURE(GTEST_ASSERT_LT(1, 0) << "An expected failure",
|
||||
"An expected failure");
|
||||
|
||||
GTEST_ASSERT_GE(0, 0);
|
||||
GTEST_ASSERT_GE(1, 0);
|
||||
EXPECT_FATAL_FAILURE(GTEST_ASSERT_GE(0, 1) << "An expected failure",
|
||||
"An expected failure");
|
||||
|
||||
GTEST_ASSERT_GT(1, 0);
|
||||
EXPECT_FATAL_FAILURE(GTEST_ASSERT_GT(0, 1) << "An expected failure",
|
||||
"An expected failure");
|
||||
EXPECT_FATAL_FAILURE(GTEST_ASSERT_GT(1, 1) << "An expected failure",
|
||||
"An expected failure");
|
||||
}
|
||||
|
||||
// Tests for internal utilities necessary for implementation of the universal
|
||||
|
Loading…
Reference in New Issue
Block a user