Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
4898cdac
Commit
4898cdac
authored
Jan 26, 2021
by
CJ Johnson
Browse files
Merge pull request #3204 from kuzkry:CmpHelperXX-overloads-removal
PiperOrigin-RevId: 352626267
parents
2c06d021
100ffc33
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
67 deletions
+1
-67
googletest/include/gtest/gtest.h
googletest/include/gtest/gtest.h
+1
-16
googletest/src/gtest.cc
googletest/src/gtest.cc
+0
-51
No files found.
googletest/include/gtest/gtest.h
View file @
4898cdac
...
@@ -1549,14 +1549,6 @@ AssertionResult CmpHelperEQ(const char* lhs_expression,
...
@@ -1549,14 +1549,6 @@ AssertionResult CmpHelperEQ(const char* lhs_expression,
return
CmpHelperEQFailure
(
lhs_expression
,
rhs_expression
,
lhs
,
rhs
);
return
CmpHelperEQFailure
(
lhs_expression
,
rhs_expression
,
lhs
,
rhs
);
}
}
// With this overloaded version, we allow anonymous enums to be used
// in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums
// can be implicitly cast to BiggestInt.
GTEST_API_
AssertionResult
CmpHelperEQ
(
const
char
*
lhs_expression
,
const
char
*
rhs_expression
,
BiggestInt
lhs
,
BiggestInt
rhs
);
class
EqHelper
{
class
EqHelper
{
public:
public:
// This templatized version is for the general case.
// This templatized version is for the general case.
...
@@ -1613,11 +1605,6 @@ AssertionResult CmpHelperOpFailure(const char* expr1, const char* expr2,
...
@@ -1613,11 +1605,6 @@ AssertionResult CmpHelperOpFailure(const char* expr1, const char* expr2,
// ASSERT_?? and EXPECT_??. It is here just to avoid copy-and-paste
// ASSERT_?? and EXPECT_??. It is here just to avoid copy-and-paste
// of similar code.
// of similar code.
//
//
// For each templatized helper function, we also define an overloaded
// version for BiggestInt in order to reduce code bloat and allow
// anonymous enums to be used with {ASSERT|EXPECT}_?? when compiled
// with gcc 4.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
...
@@ -1629,9 +1616,7 @@ AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
...
@@ -1629,9 +1616,7 @@ AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
} else {\
} else {\
return CmpHelperOpFailure(expr1, expr2, val1, val2, #op);\
return CmpHelperOpFailure(expr1, expr2, val1, val2, #op);\
}\
}\
}\
}
GTEST_API_ AssertionResult CmpHelper##op_name(\
const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2)
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
...
...
googletest/src/gtest.cc
View file @
4898cdac
...
@@ -1603,57 +1603,6 @@ AssertionResult DoubleLE(const char* expr1, const char* expr2,
...
@@ -1603,57 +1603,6 @@ AssertionResult DoubleLE(const char* expr1, const char* expr2,
namespace
internal
{
namespace
internal
{
// The helper function for {ASSERT|EXPECT}_EQ with int or enum
// arguments.
AssertionResult CmpHelperEQ(const char* lhs_expression,
const char* rhs_expression,
BiggestInt lhs,
BiggestInt rhs) {
if (lhs == rhs) {
return AssertionSuccess();
}
return EqFailure(lhs_expression,
rhs_expression,
FormatForComparisonFailureMessage(lhs, rhs),
FormatForComparisonFailureMessage(rhs, lhs),
false);
}
// A macro for implementing the helper functions needed to implement
// ASSERT_?? and EXPECT_?? with integer or enum arguments. It is here
// just to avoid copy-and-paste of similar code.
#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
BiggestInt val1, BiggestInt val2) {\
if (val1 op val2) {\
return AssertionSuccess();\
} else {\
return AssertionFailure() \
<< "Expected: (" << expr1 << ") " #op " (" << expr2\
<< "), actual: " << FormatForComparisonFailureMessage(val1, val2)\
<< " vs " << FormatForComparisonFailureMessage(val2, val1);\
}\
}
// Implements the helper function for {ASSERT|EXPECT}_NE with int or
// enum arguments.
GTEST_IMPL_CMP_HELPER_(NE, !=)
// Implements the helper function for {ASSERT|EXPECT}_LE with int or
// enum arguments.
GTEST_IMPL_CMP_HELPER_(LE, <=)
// Implements the helper function for {ASSERT|EXPECT}_LT with int or
// enum arguments.
GTEST_IMPL_CMP_HELPER_(LT, < )
// Implements the helper function for {ASSERT|EXPECT}_GE with int or
// enum arguments.
GTEST_IMPL_CMP_HELPER_(GE, >=)
// Implements the helper function for {ASSERT|EXPECT}_GT with int or
// enum arguments.
GTEST_IMPL_CMP_HELPER_(GT, > )
#undef GTEST_IMPL_CMP_HELPER_
// The helper function for {ASSERT|EXPECT}_STREQ.
// The helper function for {ASSERT|EXPECT}_STREQ.
AssertionResult
CmpHelperSTREQ
(
const
char
*
lhs_expression
,
AssertionResult
CmpHelperSTREQ
(
const
char
*
lhs_expression
,
const
char
*
rhs_expression
,
const
char
*
rhs_expression
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment