aboutsummaryrefslogtreecommitdiffstats
path: root/include/gtest/internal/gtest-internal.h
diff options
context:
space:
mode:
authorvladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925>2009-10-20 21:03:10 +0000
committervladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925>2009-10-20 21:03:10 +0000
commitbad778caa39a88b7c11b159e20730aeec4fd711e (patch)
treeab4f68a695479be0a9eaadcadc364f6c4b06d0c0 /include/gtest/internal/gtest-internal.h
parent060804deb8c05b5ea5735b875eaea2c7493e2262 (diff)
downloadgoogletest-bad778caa39a88b7c11b159e20730aeec4fd711e.tar.gz
googletest-bad778caa39a88b7c11b159e20730aeec4fd711e.tar.bz2
googletest-bad778caa39a88b7c11b159e20730aeec4fd711e.zip
Implements support for AssertionResult in Boolean assertions such as EXPECT_TRUE; Fixes Google Tests's tuple implementation to default-initialize its fields in the default constructor (by Zhanyong Wan); Populates gtest_stress_test.cc with actual tests.
Diffstat (limited to 'include/gtest/internal/gtest-internal.h')
-rw-r--r--include/gtest/internal/gtest-internal.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/include/gtest/internal/gtest-internal.h b/include/gtest/internal/gtest-internal.h
index 7033b0ca..08cf67d6 100644
--- a/include/gtest/internal/gtest-internal.h
+++ b/include/gtest/internal/gtest-internal.h
@@ -299,6 +299,11 @@ AssertionResult EqFailure(const char* expected_expression,
const String& actual_value,
bool ignoring_case);
+// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
+String GetBoolAssertionFailureMessage(const AssertionResult& assertion_result,
+ const char* expression_text,
+ const char* actual_predicate_value,
+ const char* expected_predicate_value);
// This template class represents an IEEE floating-point number
// (either single-precision or double-precision, depending on the
@@ -858,12 +863,17 @@ class Random {
fail(gtest_msg)
-#define GTEST_TEST_BOOLEAN_(boolexpr, booltext, actual, expected, fail) \
+// Implements Boolean test assertions such as EXPECT_TRUE. expression can be
+// either a boolean expression or an AssertionResult. text is a textual
+// represenation of expression as it was passed into the EXPECT_TRUE.
+#define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::IsTrue(boolexpr)) \
+ if (const ::testing::AssertionResult gtest_ar_ = \
+ ::testing::AssertionResult(expression)) \
; \
else \
- fail("Value of: " booltext "\n Actual: " #actual "\nExpected: " #expected)
+ fail(::testing::internal::GetBoolAssertionFailureMessage(\
+ gtest_ar_, text, #actual, #expected).c_str())
#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \