diff options
author | Abseil Team <absl-team@google.com> | 2021-04-02 16:14:21 (GMT) |
---|---|---|
committer | Dino Radaković <dinor@google.com> | 2021-04-05 23:13:34 (GMT) |
commit | 4048829db1b29977f96f05c183a52869e6bdecbe (patch) | |
tree | 9f3d1434edfc32556d0d91860252d498662e449b | |
parent | 6c5c4554ac218a8e19168edc121b1ad232015185 (diff) | |
download | googletest-4048829db1b29977f96f05c183a52869e6bdecbe.zip googletest-4048829db1b29977f96f05c183a52869e6bdecbe.tar.gz googletest-4048829db1b29977f96f05c183a52869e6bdecbe.tar.bz2 |
Googletest export
Add macros to omit {EXPECT,ASSERT}_{TRUE,FALSE}
PiperOrigin-RevId: 366455905
-rw-r--r-- | googletest/include/gtest/gtest.h | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h index 1088e11..681e9b7 100644 --- a/googletest/include/gtest/gtest.h +++ b/googletest/include/gtest/gtest.h @@ -1962,19 +1962,38 @@ class TestWithParam : public Test, public WithParamInterface<T> { // Boolean assertions. Condition can be either a Boolean expression or an // AssertionResult. For more information on how to use AssertionResult with // these macros see comments on that class. -#define EXPECT_TRUE(condition) \ +#define GTEST_EXPECT_TRUE(condition) \ GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \ GTEST_NONFATAL_FAILURE_) -#define EXPECT_FALSE(condition) \ +#define GTEST_EXPECT_FALSE(condition) \ GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \ GTEST_NONFATAL_FAILURE_) -#define ASSERT_TRUE(condition) \ +#define GTEST_ASSERT_TRUE(condition) \ GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \ GTEST_FATAL_FAILURE_) -#define ASSERT_FALSE(condition) \ +#define GTEST_ASSERT_FALSE(condition) \ GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \ GTEST_FATAL_FAILURE_) +// Define these macros to 1 to omit the definition of the corresponding +// EXPECT or ASSERT, which clashes with some users' own code. + +#if !GTEST_DONT_DEFINE_EXPECT_TRUE +#define EXPECT_TRUE(condition) GTEST_EXPECT_TRUE(condition) +#endif + +#if !GTEST_DONT_DEFINE_EXPECT_FALSE +#define EXPECT_FALSE(condition) GTEST_EXPECT_FALSE(condition) +#endif + +#if !GTEST_DONT_DEFINE_ASSERT_TRUE +#define ASSERT_TRUE(condition) GTEST_ASSERT_TRUE(condition) +#endif + +#if !GTEST_DONT_DEFINE_ASSERT_FALSE +#define ASSERT_FALSE(condition) GTEST_ASSERT_FALSE(condition) +#endif + // Macros for testing equalities and inequalities. // // * {ASSERT|EXPECT}_EQ(v1, v2): Tests that v1 == v2 |