From d18da572425ec2a0c127d981792528ae6f619340 Mon Sep 17 00:00:00 2001 From: eabreu26 <72231587+eabreu26@users.noreply.github.com> Date: Fri, 17 Jun 2022 15:14:29 -0400 Subject: [PATCH] Add MACROs for EXPECT and ASSERT THis is to avoid clashing with user own code for the Expects and ASSERTs of the STRs --- googletest/include/gtest/gtest.h | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h index d19a587a..aeb1aa60 100644 --- a/googletest/include/gtest/gtest.h +++ b/googletest/include/gtest/gtest.h @@ -1912,25 +1912,50 @@ class TestWithParam : public Test, public WithParamInterface {}; // which is undefined. // // These macros evaluate their arguments exactly once. +// +// Define macro GTEST_DONT_DEFINE_{ASSERT|EXPECT}_STR* to 1 to omit the definition of +// {EXPECT|ASSERT}_STR*, which clashes with some users' own code. +#if !GTEST_DONT_DEFINE_EXPECT_STREQ #define EXPECT_STREQ(s1, s2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2) +#endif + +#if !GTEST_DONT_DEFINE_EXPECT_STRNE #define EXPECT_STRNE(s1, s2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2) +#endif + +#if !GTEST_DONT_DEFINE_EXPECT_STRCASEEQ #define EXPECT_STRCASEEQ(s1, s2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2) +#endif + +#if !GTEST_DONT_DEFINE_EXPECT_STRCASENE #define EXPECT_STRCASENE(s1, s2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2) - +#endif + +#if !GTEST_DONT_DEFINE_ASSERT_STREQ #define ASSERT_STREQ(s1, s2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2) +#endif + +#if !GTEST_DONT_DEFINE_ASSERT_STRNE #define ASSERT_STRNE(s1, s2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2) +#endif + +#if !GTEST_DONT_DEFINE_ASSERT_STRCASEEQ #define ASSERT_STRCASEEQ(s1, s2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2) +#endif + +#if !GTEST_DONT_DEFINE_ASSERT_STRCASENE #define ASSERT_STRCASENE(s1, s2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2) - +#endif + // Macros for comparing floating-point numbers. // // * {ASSERT|EXPECT}_FLOAT_EQ(val1, val2):