commit
1d324d8491
|
@ -2421,9 +2421,8 @@ TEST(StringAssertionTest, ASSERT_STREQ) {
|
||||||
const char p2[] = "good";
|
const char p2[] = "good";
|
||||||
ASSERT_STREQ(p1, p2);
|
ASSERT_STREQ(p1, p2);
|
||||||
|
|
||||||
EXPECT_FATAL_FAILURE(
|
EXPECT_FATAL_FAILURE(ASSERT_STREQ("bad", "good"),
|
||||||
ASSERT_STREQ("bad", "good"),
|
" \"bad\"\n \"good\"");
|
||||||
"Expected equality of these values:\n \"bad\"\n \"good\"");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests ASSERT_STREQ with NULL arguments.
|
// Tests ASSERT_STREQ with NULL arguments.
|
||||||
|
@ -3813,7 +3812,7 @@ void TestEq1(int x) {
|
||||||
// Tests calling a test subroutine that's not part of a fixture.
|
// Tests calling a test subroutine that's not part of a fixture.
|
||||||
TEST(AssertionTest, NonFixtureSubroutine) {
|
TEST(AssertionTest, NonFixtureSubroutine) {
|
||||||
EXPECT_FATAL_FAILURE(TestEq1(2),
|
EXPECT_FATAL_FAILURE(TestEq1(2),
|
||||||
"Which is: 2");
|
" x\n Which is: 2");
|
||||||
}
|
}
|
||||||
|
|
||||||
// An uncopyable class.
|
// An uncopyable class.
|
||||||
|
@ -3952,13 +3951,13 @@ TEST(AssertionTest, AnonymousEnum) {
|
||||||
|
|
||||||
// ICE's in C++Builder.
|
// ICE's in C++Builder.
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseB),
|
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseB),
|
||||||
"kCaseB");
|
" kCaseB\n Which is: ");
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC),
|
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC),
|
||||||
"Which is: 42");
|
"\n Which is: 42");
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC),
|
EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC),
|
||||||
"Which is: -1");
|
"\n Which is: -1");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !GTEST_OS_MAC && !defined(__SUNPRO_CC)
|
#endif // !GTEST_OS_MAC && !defined(__SUNPRO_CC)
|
||||||
|
@ -4426,7 +4425,7 @@ TEST(ExpectTest, EXPECT_EQ_NULL) {
|
||||||
// A failure.
|
// A failure.
|
||||||
int n = 0;
|
int n = 0;
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(NULL, &n),
|
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(NULL, &n),
|
||||||
"&n\n");
|
" &n\n Which is:");
|
||||||
}
|
}
|
||||||
#endif // GTEST_CAN_COMPARE_NULL
|
#endif // GTEST_CAN_COMPARE_NULL
|
||||||
|
|
||||||
|
@ -4442,7 +4441,7 @@ TEST(ExpectTest, EXPECT_EQ_0) {
|
||||||
|
|
||||||
// A failure.
|
// A failure.
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(0, 5.6),
|
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(0, 5.6),
|
||||||
"Expected equality of these values:\n 0\n 5.6");
|
" 0\n 5.6");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests EXPECT_NE.
|
// Tests EXPECT_NE.
|
||||||
|
@ -4542,7 +4541,7 @@ TEST(ExpectTest, EXPECT_ANY_THROW) {
|
||||||
TEST(ExpectTest, ExpectPrecedence) {
|
TEST(ExpectTest, ExpectPrecedence) {
|
||||||
EXPECT_EQ(1 < 2, true);
|
EXPECT_EQ(1 < 2, true);
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(true, true && false),
|
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(true, true && false),
|
||||||
"true && false");
|
" true && false\n Which is: false");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4689,14 +4688,14 @@ TEST(EqAssertionTest, Bool) {
|
||||||
EXPECT_FATAL_FAILURE({
|
EXPECT_FATAL_FAILURE({
|
||||||
bool false_value = false;
|
bool false_value = false;
|
||||||
ASSERT_EQ(false_value, true);
|
ASSERT_EQ(false_value, true);
|
||||||
}, "Which is: false");
|
}, " false_value\n Which is: false\n true");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests using int values in {EXPECT|ASSERT}_EQ.
|
// Tests using int values in {EXPECT|ASSERT}_EQ.
|
||||||
TEST(EqAssertionTest, Int) {
|
TEST(EqAssertionTest, Int) {
|
||||||
ASSERT_EQ(32, 32);
|
ASSERT_EQ(32, 32);
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(32, 33),
|
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(32, 33),
|
||||||
"33");
|
" 32\n 33");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests using time_t values in {EXPECT|ASSERT}_EQ.
|
// Tests using time_t values in {EXPECT|ASSERT}_EQ.
|
||||||
|
@ -4713,9 +4712,9 @@ TEST(EqAssertionTest, Char) {
|
||||||
ASSERT_EQ('z', 'z');
|
ASSERT_EQ('z', 'z');
|
||||||
const char ch = 'b';
|
const char ch = 'b';
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_EQ('\0', ch),
|
EXPECT_NONFATAL_FAILURE(EXPECT_EQ('\0', ch),
|
||||||
"ch");
|
" ch\n Which is: 'b'");
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_EQ('a', ch),
|
EXPECT_NONFATAL_FAILURE(EXPECT_EQ('a', ch),
|
||||||
"ch");
|
" ch\n Which is: 'b'");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests using wchar_t values in {EXPECT|ASSERT}_EQ.
|
// Tests using wchar_t values in {EXPECT|ASSERT}_EQ.
|
||||||
|
@ -4735,7 +4734,7 @@ TEST(EqAssertionTest, WideChar) {
|
||||||
"wchar");
|
"wchar");
|
||||||
wchar = 0x8119;
|
wchar = 0x8119;
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_EQ(static_cast<wchar_t>(0x8120), wchar),
|
EXPECT_FATAL_FAILURE(ASSERT_EQ(static_cast<wchar_t>(0x8120), wchar),
|
||||||
"wchar");
|
" wchar\n Which is: L'");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests using ::std::string values in {EXPECT|ASSERT}_EQ.
|
// Tests using ::std::string values in {EXPECT|ASSERT}_EQ.
|
||||||
|
@ -4764,8 +4763,7 @@ TEST(EqAssertionTest, StdString) {
|
||||||
static ::std::string str3(str1);
|
static ::std::string str3(str1);
|
||||||
str3.at(2) = '\0';
|
str3.at(2) = '\0';
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_EQ(str1, str3),
|
EXPECT_FATAL_FAILURE(ASSERT_EQ(str1, str3),
|
||||||
" str3\n"
|
" str3\n Which is: \"A \\0 in the middle\"");
|
||||||
" Which is: \"A \\0 in the middle\"");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_HAS_STD_WSTRING
|
#if GTEST_HAS_STD_WSTRING
|
||||||
|
@ -4885,9 +4883,9 @@ TEST(EqAssertionTest, CharPointer) {
|
||||||
ASSERT_EQ(p1, p1);
|
ASSERT_EQ(p1, p1);
|
||||||
|
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p0, p2),
|
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p0, p2),
|
||||||
"p2");
|
" p2\n Which is:");
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, p2),
|
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, p2),
|
||||||
"p2");
|
" p2\n Which is:");
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_EQ(reinterpret_cast<char*>(0x1234),
|
EXPECT_FATAL_FAILURE(ASSERT_EQ(reinterpret_cast<char*>(0x1234),
|
||||||
reinterpret_cast<char*>(0xABC0)),
|
reinterpret_cast<char*>(0xABC0)),
|
||||||
"ABC0");
|
"ABC0");
|
||||||
|
@ -4907,9 +4905,9 @@ TEST(EqAssertionTest, WideCharPointer) {
|
||||||
EXPECT_EQ(p0, p0);
|
EXPECT_EQ(p0, p0);
|
||||||
|
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p0, p2),
|
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p0, p2),
|
||||||
"p2");
|
" p2\n Which is:");
|
||||||
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, p2),
|
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, p2),
|
||||||
"p2");
|
" p2\n Which is:");
|
||||||
void* pv3 = (void*)0x1234; // NOLINT
|
void* pv3 = (void*)0x1234; // NOLINT
|
||||||
void* pv4 = (void*)0xABC0; // NOLINT
|
void* pv4 = (void*)0xABC0; // NOLINT
|
||||||
const wchar_t* p3 = reinterpret_cast<const wchar_t*>(pv3);
|
const wchar_t* p3 = reinterpret_cast<const wchar_t*>(pv3);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user