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.
This commit is contained in:
@@ -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_ \
|
||||
|
||||
@@ -183,7 +183,7 @@ class GTEST_1_TUPLE_(T) {
|
||||
public:
|
||||
template <int k> friend class gtest_internal::Get;
|
||||
|
||||
tuple() {}
|
||||
tuple() : f0_() {}
|
||||
|
||||
explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {}
|
||||
|
||||
@@ -215,7 +215,7 @@ class GTEST_2_TUPLE_(T) {
|
||||
public:
|
||||
template <int k> friend class gtest_internal::Get;
|
||||
|
||||
tuple() {}
|
||||
tuple() : f0_(), f1_() {}
|
||||
|
||||
explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0),
|
||||
f1_(f1) {}
|
||||
@@ -258,7 +258,7 @@ class GTEST_3_TUPLE_(T) {
|
||||
public:
|
||||
template <int k> friend class gtest_internal::Get;
|
||||
|
||||
tuple() {}
|
||||
tuple() : f0_(), f1_(), f2_() {}
|
||||
|
||||
explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
|
||||
GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {}
|
||||
@@ -295,7 +295,7 @@ class GTEST_4_TUPLE_(T) {
|
||||
public:
|
||||
template <int k> friend class gtest_internal::Get;
|
||||
|
||||
tuple() {}
|
||||
tuple() : f0_(), f1_(), f2_(), f3_() {}
|
||||
|
||||
explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
|
||||
GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2),
|
||||
@@ -336,7 +336,7 @@ class GTEST_5_TUPLE_(T) {
|
||||
public:
|
||||
template <int k> friend class gtest_internal::Get;
|
||||
|
||||
tuple() {}
|
||||
tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {}
|
||||
|
||||
explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
|
||||
GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3,
|
||||
@@ -380,7 +380,7 @@ class GTEST_6_TUPLE_(T) {
|
||||
public:
|
||||
template <int k> friend class gtest_internal::Get;
|
||||
|
||||
tuple() {}
|
||||
tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {}
|
||||
|
||||
explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
|
||||
GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
|
||||
@@ -427,7 +427,7 @@ class GTEST_7_TUPLE_(T) {
|
||||
public:
|
||||
template <int k> friend class gtest_internal::Get;
|
||||
|
||||
tuple() {}
|
||||
tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {}
|
||||
|
||||
explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
|
||||
GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
|
||||
@@ -476,7 +476,7 @@ class GTEST_8_TUPLE_(T) {
|
||||
public:
|
||||
template <int k> friend class gtest_internal::Get;
|
||||
|
||||
tuple() {}
|
||||
tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {}
|
||||
|
||||
explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
|
||||
GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
|
||||
@@ -528,7 +528,7 @@ class GTEST_9_TUPLE_(T) {
|
||||
public:
|
||||
template <int k> friend class gtest_internal::Get;
|
||||
|
||||
tuple() {}
|
||||
tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {}
|
||||
|
||||
explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
|
||||
GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
|
||||
@@ -582,7 +582,8 @@ class tuple {
|
||||
public:
|
||||
template <int k> friend class gtest_internal::Get;
|
||||
|
||||
tuple() {}
|
||||
tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(),
|
||||
f9_() {}
|
||||
|
||||
explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1,
|
||||
GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4,
|
||||
|
||||
@@ -39,11 +39,11 @@ $$ This meta comment fixes auto-indentation in Emacs. }}
|
||||
|
||||
#include <utility> // For ::std::pair.
|
||||
|
||||
// The compiler used in Symbian 5th Edition (__S60_50__) has a bug
|
||||
// that prevents us from declaring the tuple template as a friend (it
|
||||
// complains that tuple is redefined). This hack bypasses the bug by
|
||||
// declaring the members that should otherwise be private as public.
|
||||
#if defined(__SYMBIAN32__) && __S60_50__
|
||||
// The compiler used in Symbian has a bug that prevents us from declaring the
|
||||
// tuple template as a friend (it complains that tuple is redefined). This
|
||||
// hack bypasses the bug by declaring the members that should otherwise be
|
||||
// private as public.
|
||||
#if defined(__SYMBIAN32__)
|
||||
#define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
|
||||
#else
|
||||
#define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
|
||||
@@ -140,7 +140,7 @@ class $if k < n [[GTEST_$(k)_TUPLE_(T)]] $else [[tuple]] {
|
||||
public:
|
||||
template <int k> friend class gtest_internal::Get;
|
||||
|
||||
tuple() {}
|
||||
tuple() : $for m, [[f$(m)_()]] {}
|
||||
|
||||
explicit tuple($for m, [[GTEST_BY_REF_(T$m) f$m]]) : [[]]
|
||||
$for m, [[f$(m)_(f$m)]] {}
|
||||
|
||||
Reference in New Issue
Block a user