Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
testing::gtest_printers_test Namespace Reference

Classes

class  AllowsGenericStreaming
 
class  AllowsGenericStreamingAndImplicitConversionTemplate
 
class  AllowsGenericStreamingTemplate
 
struct  Big
 
struct  const_iterator
 
struct  Foo
 
struct  iterator
 

Functions

template<typename T >
std::string Print (const T &value)
 
template<typename T >
std::string PrintByRef (const T &value)
 
 TEST (PrintEnumTest, AnonymousEnum)
 
 TEST (PrintEnumTest, EnumWithoutPrinter)
 
 TEST (PrintEnumTest, EnumWithStreaming)
 
 TEST (PrintEnumTest, EnumWithPrintTo)
 
 TEST (PrintClassTest, BiggestIntConvertible)
 
 TEST (PrintCharTest, PlainChar)
 
 TEST (PrintCharTest, SignedChar)
 
 TEST (PrintCharTest, UnsignedChar)
 
 TEST (PrintBuiltInTypeTest, Bool)
 
 TEST (PrintBuiltInTypeTest, Wchar_t)
 
 TEST (PrintTypeSizeTest, Wchar_t)
 
 TEST (PrintBuiltInTypeTest, Integer)
 
 TEST (PrintBuiltInTypeTest, Size_t)
 
 TEST (PrintBuiltInTypeTest, FloatingPoints)
 
 TEST (PrintCStringTest, Const)
 
 TEST (PrintCStringTest, NonConst)
 
 TEST (PrintCStringTest, Null)
 
 TEST (PrintCStringTest, EscapesProperly)
 
 TEST (PrintWideCStringTest, Const)
 
 TEST (PrintWideCStringTest, NonConst)
 
 TEST (PrintWideCStringTest, Null)
 
 TEST (PrintWideCStringTest, EscapesProperly)
 
 TEST (PrintCharPointerTest, SignedChar)
 
 TEST (PrintCharPointerTest, ConstSignedChar)
 
 TEST (PrintCharPointerTest, UnsignedChar)
 
 TEST (PrintCharPointerTest, ConstUnsignedChar)
 
 TEST (PrintPointerToBuiltInTypeTest, Bool)
 
 TEST (PrintPointerToBuiltInTypeTest, Void)
 
 TEST (PrintPointerToBuiltInTypeTest, ConstVoid)
 
 TEST (PrintPointerToPointerTest, IntPointerPointer)
 
void MyFunction (int)
 
 TEST (PrintPointerTest, NonMemberFunctionPointer)
 
template<typename StringType >
AssertionResult HasPrefix (const StringType &str, const StringType &prefix)
 
 TEST (PrintPointerTest, MemberVariablePointer)
 
 TEST (PrintPointerTest, MemberFunctionPointer)
 
template<typename T , size_t N>
std::string PrintArrayHelper (T(&a)[N])
 
 TEST (PrintArrayTest, OneDimensionalArray)
 
 TEST (PrintArrayTest, TwoDimensionalArray)
 
 TEST (PrintArrayTest, ConstArray)
 
 TEST (PrintArrayTest, CharArrayWithNoTerminatingNul)
 
 TEST (PrintArrayTest, ConstCharArrayWithTerminatingNul)
 
 TEST (PrintArrayTest, WCharArrayWithNoTerminatingNul)
 
 TEST (PrintArrayTest, WConstCharArrayWithTerminatingNul)
 
 TEST (PrintArrayTest, ObjectArray)
 
 TEST (PrintArrayTest, BigArray)
 
 TEST (PrintStringTest, StringInStdNamespace)
 
 TEST (PrintStringTest, StringAmbiguousHex)
 
template<typename Char , typename CharTraits >
std::basic_ostream< Char, CharTraits > & operator<< (std::basic_ostream< Char, CharTraits > &os, const AllowsGenericStreaming &)
 
 TEST (PrintTypeWithGenericStreamingTest, NonTemplateType)
 
template<typename Char , typename CharTraits , typename T >
std::basic_ostream< Char, CharTraits > & operator<< (std::basic_ostream< Char, CharTraits > &os, const AllowsGenericStreamingTemplate< T > &)
 
 TEST (PrintTypeWithGenericStreamingTest, TemplateType)
 
template<typename Char , typename CharTraits , typename T >
std::basic_ostream< Char, CharTraits > & operator<< (std::basic_ostream< Char, CharTraits > &os, const AllowsGenericStreamingAndImplicitConversionTemplate< T > &)
 
 TEST (PrintTypeWithGenericStreamingTest, TypeImplicitlyConvertible)
 
 TEST (PrintStlContainerTest, EmptyDeque)
 
 TEST (PrintStlContainerTest, NonEmptyDeque)
 
 TEST (PrintStlContainerTest, List)
 
 TEST (PrintStlContainerTest, Map)
 
 TEST (PrintStlContainerTest, MultiMap)
 
 TEST (PrintStlContainerTest, Set)
 
 TEST (PrintStlContainerTest, MultiSet)
 
 TEST (PrintStlContainerTest, Pair)
 
 TEST (PrintStlContainerTest, Vector)
 
 TEST (PrintStlContainerTest, LongSequence)
 
 TEST (PrintStlContainerTest, NestedContainer)
 
 TEST (PrintStlContainerTest, OneDimensionalNativeArray)
 
 TEST (PrintStlContainerTest, TwoDimensionalNativeArray)
 
 TEST (PrintStlContainerTest, Iterator)
 
 TEST (PrintStlContainerTest, ConstIterator)
 
 TEST (PrintUnprintableTypeTest, InGlobalNamespace)
 
 TEST (PrintUnprintableTypeTest, InUserNamespace)
 
 TEST (PrintUnpritableTypeTest, BigObject)
 
 TEST (PrintStreamableTypeTest, InGlobalNamespace)
 
 TEST (PrintStreamableTypeTest, TemplateTypeInUserNamespace)
 
 TEST (PrintStreamableTypeTest, PathLikeInUserNamespace)
 
 TEST (PrintPrintableTypeTest, InUserNamespace)
 
 TEST (PrintPrintableTypeTest, PointerInUserNamespace)
 
 TEST (PrintPrintableTypeTest, TemplateInUserNamespace)
 
 TEST (PrintReferenceTest, PrintsAddressAndValue)
 
 TEST (PrintReferenceTest, HandlesFunctionPointer)
 
 TEST (PrintReferenceTest, HandlesMemberFunctionPointer)
 
 TEST (PrintReferenceTest, HandlesMemberVariablePointer)
 
 TEST (FormatForComparisonFailureMessageTest, WorksForScalar)
 
 TEST (FormatForComparisonFailureMessageTest, WorksForNonCharPointer)
 
 TEST (FormatForComparisonFailureMessageTest, FormatsNonCharArrayAsPointer)
 
 TEST (FormatForComparisonFailureMessageTest, WorksForCharPointerVsPointer)
 
 TEST (FormatForComparisonFailureMessageTest, WorksForWCharPointerVsPointer)
 
 TEST (FormatForComparisonFailureMessageTest, WorksForCharPointerVsStdString)
 
 TEST (FormatForComparisonFailureMessageTest, WorksForCharArrayVsPointer)
 
 TEST (FormatForComparisonFailureMessageTest, WorksForCharArrayVsCharArray)
 
 TEST (FormatForComparisonFailureMessageTest, WorksForWCharArrayVsPointer)
 
 TEST (FormatForComparisonFailureMessageTest, WorksForWCharArrayVsWCharArray)
 
 TEST (FormatForComparisonFailureMessageTest, WorksForCharArrayVsStdString)
 
 TEST (PrintToStringTest, WorksForScalar)
 
 TEST (PrintToStringTest, WorksForPointerToConstChar)
 
 TEST (PrintToStringTest, WorksForPointerToNonConstChar)
 
 TEST (PrintToStringTest, EscapesForPointerToConstChar)
 
 TEST (PrintToStringTest, EscapesForPointerToNonConstChar)
 
 TEST (PrintToStringTest, WorksForArray)
 
 TEST (PrintToStringTest, WorksForCharArray)
 
 TEST (PrintToStringTest, WorksForCharArrayWithEmbeddedNul)
 
 TEST (PrintToStringTest, ContainsNonLatin)
 
 TEST (IsValidUTF8Test, IllFormedUTF8)
 
 TEST (UniversalTersePrintTest, WorksForNonReference)
 
 TEST (UniversalTersePrintTest, WorksForReference)
 
 TEST (UniversalTersePrintTest, WorksForCString)
 
 TEST (UniversalPrintTest, WorksForNonReference)
 
 TEST (UniversalPrintTest, WorksForReference)
 
 TEST (UniversalPrintTest, WorksForCString)
 
 TEST (UniversalPrintTest, WorksForCharArray)
 

Function Documentation

◆ HasPrefix()

template<typename StringType >
AssertionResult testing::gtest_printers_test::HasPrefix ( const StringType & str,
const StringType & prefix )

Definition at line 547 of file gtest-printers_test.cc.

547 {
548 if (str.find(prefix, 0) == 0)
549 return AssertionSuccess();
550
551 const bool is_wide_string = sizeof(prefix[0]) > 1;
552 const char* const begin_string_quote = is_wide_string ? "L\"" : "\"";
553 return AssertionFailure()
554 << begin_string_quote << prefix << "\" is not a prefix of "
555 << begin_string_quote << str << "\"\n";
556}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ MyFunction()

void testing::gtest_printers_test::MyFunction ( int )

Definition at line 529 of file gtest-printers_test.cc.

529{}
Here is the caller graph for this function:

◆ operator<<() [1/3]

template<typename Char , typename CharTraits >
std::basic_ostream< Char, CharTraits > & testing::gtest_printers_test::operator<< ( std::basic_ostream< Char, CharTraits > & os,
const AllowsGenericStreaming &  )

Definition at line 684 of file gtest-printers_test.cc.

743 {
744 return os << "AllowsGenericStreaming";
745}
os_t os
Here is the call graph for this function:

◆ operator<<() [2/3]

template<typename Char , typename CharTraits , typename T >
std::basic_ostream< Char, CharTraits > & testing::gtest_printers_test::operator<< ( std::basic_ostream< Char, CharTraits > & os,
const AllowsGenericStreamingAndImplicitConversionTemplate< T > &  )

Definition at line 764 of file gtest-printers_test.cc.

781 {
782 return os << "AllowsGenericStreamingAndImplicitConversionTemplate";
783}
Here is the call graph for this function:

◆ operator<<() [3/3]

template<typename Char , typename CharTraits , typename T >
std::basic_ostream< Char, CharTraits > & testing::gtest_printers_test::operator<< ( std::basic_ostream< Char, CharTraits > & os,
const AllowsGenericStreamingTemplate< T > &  )

Definition at line 747 of file gtest-printers_test.cc.

760 {
761 return os << "AllowsGenericStreamingTemplate";
762}
Here is the call graph for this function:

◆ Print()

template<typename T >
std::string testing::gtest_printers_test::Print ( const T & value)

Definition at line 240 of file gtest-printers_test.cc.

240 {
241 ::std::stringstream ss;
242 UniversalPrinter<T>::Print(value, &ss);
243 return ss.str();
244}
#define value
Definition pkcs11.h:157

◆ PrintArrayHelper()

template<typename T , size_t N>
std::string testing::gtest_printers_test::PrintArrayHelper ( T(&) a[N])

Definition at line 600 of file gtest-printers_test.cc.

600 {
601 return Print(a);
602}
std::string Print(const T &value)
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrintByRef()

template<typename T >
std::string testing::gtest_printers_test::PrintByRef ( const T & value)

Definition at line 250 of file gtest-printers_test.cc.

250 {
251 ::std::stringstream ss;
252 UniversalPrinter<T&>::Print(value, &ss);
253 return ss.str();
254}
Here is the caller graph for this function:

◆ TEST() [1/103]

testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest ,
FormatsNonCharArrayAsPointer  )

Definition at line 1277 of file gtest-printers_test.cc.

1277 {
1278 // In expression 'array == x', 'array' is compared by pointer.
1279 // Therefore we want to print an array operand as a pointer.
1280 int n[] = { 1, 2, 3 };
1281 EXPECT_EQ(PrintPointer(n),
1282 FormatForComparisonFailureMessage(n, n).c_str());
1283}
#define EXPECT_EQ(val1, val2)
Definition gtest.h:1954

◆ TEST() [2/103]

testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest ,
WorksForCharArrayVsCharArray  )

Definition at line 1399 of file gtest-printers_test.cc.

1399 {
1400 const char str[] = "hi \"world\"";
1401 EXPECT_EQ(PrintPointer(str),
1402 FormatForComparisonFailureMessage(str, str).c_str());
1403}

◆ TEST() [3/103]

testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest ,
WorksForCharArrayVsPointer  )

Definition at line 1391 of file gtest-printers_test.cc.

1391 {
1392 char str[] = "hi \"world\"";
1393 char* p = NULL;
1394 EXPECT_EQ(PrintPointer(str),
1395 FormatForComparisonFailureMessage(str, p).c_str());
1396}
const mie::Vuint & p
Definition bn.cpp:27

◆ TEST() [4/103]

testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest ,
WorksForCharArrayVsStdString  )

Definition at line 1434 of file gtest-printers_test.cc.

1434 {
1435 const char str[] = "hi \"world\"";
1436 EXPECT_STREQ("\"hi \\\"world\\\"\"", // The content should be escaped.
1437 FormatForComparisonFailureMessage(str, ::std::string()).c_str());
1438}
#define EXPECT_STREQ(s1, s2)
Definition gtest.h:2027

◆ TEST() [5/103]

testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest ,
WorksForCharPointerVsPointer  )

Definition at line 1290 of file gtest-printers_test.cc.

1290 {
1291 // In expression 'p == x', where 'p' and 'x' are (const or not) char
1292 // pointers, the operands are compared by pointer. Therefore we
1293 // want to print 'p' as a pointer instead of a C string (we don't
1294 // even know if it's supposed to point to a valid C string).
1295
1296 // const char*
1297 const char* s = "hello";
1298 EXPECT_EQ(PrintPointer(s),
1299 FormatForComparisonFailureMessage(s, s).c_str());
1300
1301 // char*
1302 char ch = 'a';
1303 EXPECT_EQ(PrintPointer(&ch),
1304 FormatForComparisonFailureMessage(&ch, &ch).c_str());
1305}
char * s

◆ TEST() [6/103]

testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest ,
WorksForCharPointerVsStdString  )

Definition at line 1344 of file gtest-printers_test.cc.

1344 {
1345 const char* s = "hello \"world";
1346 EXPECT_STREQ("\"hello \\\"world\"", // The string content should be escaped.
1347 FormatForComparisonFailureMessage(s, ::std::string()).c_str());
1348
1349 // char*
1350 char str[] = "hi\1";
1351 char* p = str;
1352 EXPECT_STREQ("\"hi\\x1\"", // The string content should be escaped.
1353 FormatForComparisonFailureMessage(p, ::std::string()).c_str());
1354}

◆ TEST() [7/103]

testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest ,
WorksForNonCharPointer  )

Definition at line 1270 of file gtest-printers_test.cc.

1270 {
1271 int n = 0;
1272 EXPECT_EQ(PrintPointer(&n),
1273 FormatForComparisonFailureMessage(&n, &n).c_str());
1274}

◆ TEST() [8/103]

testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest ,
WorksForScalar  )

Definition at line 1264 of file gtest-printers_test.cc.

1264 {
1265 EXPECT_STREQ("123",
1266 FormatForComparisonFailureMessage(123, 124).c_str());
1267}

◆ TEST() [9/103]

testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest ,
WorksForWCharArrayVsPointer  )

Definition at line 1406 of file gtest-printers_test.cc.

1406 {
1407 wchar_t str[] = L"hi \"world\"";
1408 wchar_t* p = NULL;
1409 EXPECT_EQ(PrintPointer(str),
1410 FormatForComparisonFailureMessage(str, p).c_str());
1411}

◆ TEST() [10/103]

testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest ,
WorksForWCharArrayVsWCharArray  )

Definition at line 1414 of file gtest-printers_test.cc.

1414 {
1415 const wchar_t str[] = L"hi \"world\"";
1416 EXPECT_EQ(PrintPointer(str),
1417 FormatForComparisonFailureMessage(str, str).c_str());
1418}

◆ TEST() [11/103]

testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest ,
WorksForWCharPointerVsPointer  )

Definition at line 1308 of file gtest-printers_test.cc.

1308 {
1309 // In expression 'p == x', where 'p' and 'x' are (const or not) char
1310 // pointers, the operands are compared by pointer. Therefore we
1311 // want to print 'p' as a pointer instead of a wide C string (we don't
1312 // even know if it's supposed to point to a valid wide C string).
1313
1314 // const wchar_t*
1315 const wchar_t* s = L"hello";
1316 EXPECT_EQ(PrintPointer(s),
1317 FormatForComparisonFailureMessage(s, s).c_str());
1318
1319 // wchar_t*
1320 wchar_t ch = L'a';
1321 EXPECT_EQ(PrintPointer(&ch),
1322 FormatForComparisonFailureMessage(&ch, &ch).c_str());
1323}

◆ TEST() [12/103]

testing::gtest_printers_test::TEST ( IsValidUTF8Test ,
IllFormedUTF8  )

Definition at line 1523 of file gtest-printers_test.cc.

1523 {
1524 // The following test strings are ill-formed UTF-8 and are printed
1525 // as hex only (or ASCII, in case of ASCII bytes) because IsValidUTF8() is
1526 // expected to fail, thus output does not contain "As Text:".
1527
1528 static const char *const kTestdata[][2] = {
1529 // 2-byte lead byte followed by a single-byte character.
1530 {"\xC3\x74", "\"\\xC3t\""},
1531 // Valid 2-byte character followed by an orphan trail byte.
1532 {"\xC3\x84\xA4", "\"\\xC3\\x84\\xA4\""},
1533 // Lead byte without trail byte.
1534 {"abc\xC3", "\"abc\\xC3\""},
1535 // 3-byte lead byte, single-byte character, orphan trail byte.
1536 {"x\xE2\x70\x94", "\"x\\xE2p\\x94\""},
1537 // Truncated 3-byte character.
1538 {"\xE2\x80", "\"\\xE2\\x80\""},
1539 // Truncated 3-byte character followed by valid 2-byte char.
1540 {"\xE2\x80\xC3\x84", "\"\\xE2\\x80\\xC3\\x84\""},
1541 // Truncated 3-byte character followed by a single-byte character.
1542 {"\xE2\x80\x7A", "\"\\xE2\\x80z\""},
1543 // 3-byte lead byte followed by valid 3-byte character.
1544 {"\xE2\xE2\x80\x94", "\"\\xE2\\xE2\\x80\\x94\""},
1545 // 4-byte lead byte followed by valid 3-byte character.
1546 {"\xF0\xE2\x80\x94", "\"\\xF0\\xE2\\x80\\x94\""},
1547 // Truncated 4-byte character.
1548 {"\xF0\xE2\x80", "\"\\xF0\\xE2\\x80\""},
1549 // Invalid UTF-8 byte sequences embedded in other chars.
1550 {"abc\xE2\x80\x94\xC3\x74xyc", "\"abc\\xE2\\x80\\x94\\xC3txyc\""},
1551 {"abc\xC3\x84\xE2\x80\xC3\x84xyz",
1552 "\"abc\\xC3\\x84\\xE2\\x80\\xC3\\x84xyz\""},
1553 // Non-shortest UTF-8 byte sequences are also ill-formed.
1554 // The classics: xC0, xC1 lead byte.
1555 {"\xC0\x80", "\"\\xC0\\x80\""},
1556 {"\xC1\x81", "\"\\xC1\\x81\""},
1557 // Non-shortest sequences.
1558 {"\xE0\x80\x80", "\"\\xE0\\x80\\x80\""},
1559 {"\xf0\x80\x80\x80", "\"\\xF0\\x80\\x80\\x80\""},
1560 // Last valid code point before surrogate range, should be printed as text,
1561 // too.
1562 {"\xED\x9F\xBF", "\"\\xED\\x9F\\xBF\"\n As Text: \"퟿\""},
1563 // Start of surrogate lead. Surrogates are not printed as text.
1564 {"\xED\xA0\x80", "\"\\xED\\xA0\\x80\""},
1565 // Last non-private surrogate lead.
1566 {"\xED\xAD\xBF", "\"\\xED\\xAD\\xBF\""},
1567 // First private-use surrogate lead.
1568 {"\xED\xAE\x80", "\"\\xED\\xAE\\x80\""},
1569 // Last private-use surrogate lead.
1570 {"\xED\xAF\xBF", "\"\\xED\\xAF\\xBF\""},
1571 // Mid-point of surrogate trail.
1572 {"\xED\xB3\xBF", "\"\\xED\\xB3\\xBF\""},
1573 // First valid code point after surrogate range, should be printed as text,
1574 // too.
1575 {"\xEE\x80\x80", "\"\\xEE\\x80\\x80\"\n As Text: \"\""}
1576 };
1577
1578 for (int i = 0; i < int(sizeof(kTestdata)/sizeof(kTestdata[0])); ++i) {
1579 EXPECT_PRINT_TO_STRING_(kTestdata[i][0], kTestdata[i][1]);
1580 }
1581}
#define EXPECT_PRINT_TO_STRING_(value, expected_string)

◆ TEST() [13/103]

testing::gtest_printers_test::TEST ( PrintArrayTest ,
BigArray  )

Definition at line 658 of file gtest-printers_test.cc.

658 {
659 int a[100] = { 1, 2, 3 };
660 EXPECT_EQ("{ 1, 2, 3, 0, 0, 0, 0, 0, ..., 0, 0, 0, 0, 0, 0, 0, 0 }",
661 PrintArrayHelper(a));
662}
Here is the call graph for this function:

◆ TEST() [14/103]

testing::gtest_printers_test::TEST ( PrintArrayTest ,
CharArrayWithNoTerminatingNul  )

Definition at line 626 of file gtest-printers_test.cc.

626 {
627 // Array a contains '\0' in the middle and doesn't end with '\0'.
628 char a[] = { 'H', '\0', 'i' };
629 EXPECT_EQ("\"H\\0i\" (no terminating NUL)", PrintArrayHelper(a));
630}
Here is the call graph for this function:

◆ TEST() [15/103]

testing::gtest_printers_test::TEST ( PrintArrayTest ,
ConstArray  )

Definition at line 620 of file gtest-printers_test.cc.

620 {
621 const bool a[1] = { false };
622 EXPECT_EQ("{ false }", PrintArrayHelper(a));
623}
Here is the call graph for this function:

◆ TEST() [16/103]

testing::gtest_printers_test::TEST ( PrintArrayTest ,
ConstCharArrayWithTerminatingNul  )

Definition at line 633 of file gtest-printers_test.cc.

633 {
634 const char a[] = "\0Hi";
635 EXPECT_EQ("\"\\0Hi\"", PrintArrayHelper(a));
636}
std::string PrintArrayHelper(T(&a)[N])
Here is the call graph for this function:

◆ TEST() [17/103]

testing::gtest_printers_test::TEST ( PrintArrayTest ,
ObjectArray  )

Definition at line 652 of file gtest-printers_test.cc.

652 {
653 std::string a[3] = {"Hi", "Hello", "Ni hao"};
654 EXPECT_EQ("{ \"Hi\", \"Hello\", \"Ni hao\" }", PrintArrayHelper(a));
655}
Here is the call graph for this function:

◆ TEST() [18/103]

testing::gtest_printers_test::TEST ( PrintArrayTest ,
OneDimensionalArray  )

Definition at line 605 of file gtest-printers_test.cc.

605 {
606 int a[5] = { 1, 2, 3, 4, 5 };
607 EXPECT_EQ("{ 1, 2, 3, 4, 5 }", PrintArrayHelper(a));
608}
Here is the call graph for this function:

◆ TEST() [19/103]

testing::gtest_printers_test::TEST ( PrintArrayTest ,
TwoDimensionalArray  )

Definition at line 611 of file gtest-printers_test.cc.

611 {
612 int a[2][5] = {
613 { 1, 2, 3, 4, 5 },
614 { 6, 7, 8, 9, 0 }
615 };
616 EXPECT_EQ("{ { 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 0 } }", PrintArrayHelper(a));
617}
Here is the call graph for this function:

◆ TEST() [20/103]

testing::gtest_printers_test::TEST ( PrintArrayTest ,
WCharArrayWithNoTerminatingNul  )

Definition at line 639 of file gtest-printers_test.cc.

639 {
640 // Array a contains '\0' in the middle and doesn't end with '\0'.
641 const wchar_t a[] = { L'H', L'\0', L'i' };
642 EXPECT_EQ("L\"H\\0i\" (no terminating NUL)", PrintArrayHelper(a));
643}
Here is the call graph for this function:

◆ TEST() [21/103]

testing::gtest_printers_test::TEST ( PrintArrayTest ,
WConstCharArrayWithTerminatingNul  )

Definition at line 646 of file gtest-printers_test.cc.

646 {
647 const wchar_t a[] = L"\0Hi";
648 EXPECT_EQ("L\"\\0Hi\"", PrintArrayHelper(a));
649}
Here is the call graph for this function:

◆ TEST() [22/103]

testing::gtest_printers_test::TEST ( PrintBuiltInTypeTest ,
Bool  )

Definition at line 323 of file gtest-printers_test.cc.

323 {
324 EXPECT_EQ("false", Print(false));
325 EXPECT_EQ("true", Print(true));
326}
Here is the call graph for this function:

◆ TEST() [23/103]

testing::gtest_printers_test::TEST ( PrintBuiltInTypeTest ,
FloatingPoints  )

Definition at line 379 of file gtest-printers_test.cc.

379 {
380 EXPECT_EQ("1.5", Print(1.5f)); // float
381 EXPECT_EQ("-2.5", Print(-2.5)); // double
382}
Here is the call graph for this function:

◆ TEST() [24/103]

testing::gtest_printers_test::TEST ( PrintBuiltInTypeTest ,
Integer  )

Definition at line 356 of file gtest-printers_test.cc.

356 {
357 EXPECT_EQ("'\\xFF' (255)", Print(static_cast<unsigned char>(255))); // uint8
358 EXPECT_EQ("'\\x80' (-128)", Print(static_cast<signed char>(-128))); // int8
359 EXPECT_EQ("65535", Print(USHRT_MAX)); // uint16
360 EXPECT_EQ("-32768", Print(SHRT_MIN)); // int16
361 EXPECT_EQ("4294967295", Print(UINT_MAX)); // uint32
362 EXPECT_EQ("-2147483648", Print(INT_MIN)); // int32
363 EXPECT_EQ("18446744073709551615",
364 Print(static_cast<testing::internal::UInt64>(-1))); // uint64
365 EXPECT_EQ("-9223372036854775808",
366 Print(static_cast<testing::internal::Int64>(1) << 63)); // int64
367}
TypeWithSize< 8 >::Int Int64
TypeWithSize< 8 >::UInt UInt64
Here is the call graph for this function:

◆ TEST() [25/103]

testing::gtest_printers_test::TEST ( PrintBuiltInTypeTest ,
Size_t  )

Definition at line 370 of file gtest-printers_test.cc.

370 {
371 EXPECT_EQ("1", Print(sizeof('a'))); // size_t.
372#if !GTEST_OS_WINDOWS
373 // Windows has no ssize_t type.
374 EXPECT_EQ("-2", Print(static_cast<ssize_t>(-2))); // ssize_t.
375#endif // !GTEST_OS_WINDOWS
376}
Here is the call graph for this function:

◆ TEST() [26/103]

testing::gtest_printers_test::TEST ( PrintBuiltInTypeTest ,
Wchar_t  )

Definition at line 329 of file gtest-printers_test.cc.

329 {
330 EXPECT_EQ("L'\\0'", Print(L'\0'));
331 EXPECT_EQ("L'\\'' (39, 0x27)", Print(L'\''));
332 EXPECT_EQ("L'\"' (34, 0x22)", Print(L'"'));
333 EXPECT_EQ("L'?' (63, 0x3F)", Print(L'?'));
334 EXPECT_EQ("L'\\\\' (92, 0x5C)", Print(L'\\'));
335 EXPECT_EQ("L'\\a' (7)", Print(L'\a'));
336 EXPECT_EQ("L'\\b' (8)", Print(L'\b'));
337 EXPECT_EQ("L'\\f' (12, 0xC)", Print(L'\f'));
338 EXPECT_EQ("L'\\n' (10, 0xA)", Print(L'\n'));
339 EXPECT_EQ("L'\\r' (13, 0xD)", Print(L'\r'));
340 EXPECT_EQ("L'\\t' (9)", Print(L'\t'));
341 EXPECT_EQ("L'\\v' (11, 0xB)", Print(L'\v'));
342 EXPECT_EQ("L'\\x7F' (127)", Print(L'\x7F'));
343 EXPECT_EQ("L'\\xFF' (255)", Print(L'\xFF'));
344 EXPECT_EQ("L' ' (32, 0x20)", Print(L' '));
345 EXPECT_EQ("L'a' (97, 0x61)", Print(L'a'));
346 EXPECT_EQ("L'\\x576' (1398)", Print(static_cast<wchar_t>(0x576)));
347 EXPECT_EQ("L'\\xC74D' (51021)", Print(static_cast<wchar_t>(0xC74D)));
348}
Here is the call graph for this function:

◆ TEST() [27/103]

testing::gtest_printers_test::TEST ( PrintCharPointerTest ,
ConstSignedChar  )

Definition at line 470 of file gtest-printers_test.cc.

470 {
471 signed char* p = reinterpret_cast<signed char*>(0x1234);
472 EXPECT_EQ(PrintPointer(p), Print(p));
473 p = NULL;
474 EXPECT_EQ("NULL", Print(p));
475}
Here is the call graph for this function:

◆ TEST() [28/103]

testing::gtest_printers_test::TEST ( PrintCharPointerTest ,
ConstUnsignedChar  )

Definition at line 486 of file gtest-printers_test.cc.

486 {
487 const unsigned char* p = reinterpret_cast<const unsigned char*>(0x1234);
488 EXPECT_EQ(PrintPointer(p), Print(p));
489 p = NULL;
490 EXPECT_EQ("NULL", Print(p));
491}
Here is the call graph for this function:

◆ TEST() [29/103]

testing::gtest_printers_test::TEST ( PrintCharPointerTest ,
SignedChar  )

Definition at line 462 of file gtest-printers_test.cc.

462 {
463 signed char* p = reinterpret_cast<signed char*>(0x1234);
464 EXPECT_EQ(PrintPointer(p), Print(p));
465 p = NULL;
466 EXPECT_EQ("NULL", Print(p));
467}
Here is the call graph for this function:

◆ TEST() [30/103]

testing::gtest_printers_test::TEST ( PrintCharPointerTest ,
UnsignedChar  )

Definition at line 478 of file gtest-printers_test.cc.

478 {
479 unsigned char* p = reinterpret_cast<unsigned char*>(0x1234);
480 EXPECT_EQ(PrintPointer(p), Print(p));
481 p = NULL;
482 EXPECT_EQ("NULL", Print(p));
483}
Here is the call graph for this function:

◆ TEST() [31/103]

testing::gtest_printers_test::TEST ( PrintCharTest ,
PlainChar  )

Definition at line 287 of file gtest-printers_test.cc.

287 {
288 EXPECT_EQ("'\\0'", Print('\0'));
289 EXPECT_EQ("'\\'' (39, 0x27)", Print('\''));
290 EXPECT_EQ("'\"' (34, 0x22)", Print('"'));
291 EXPECT_EQ("'?' (63, 0x3F)", Print('?'));
292 EXPECT_EQ("'\\\\' (92, 0x5C)", Print('\\'));
293 EXPECT_EQ("'\\a' (7)", Print('\a'));
294 EXPECT_EQ("'\\b' (8)", Print('\b'));
295 EXPECT_EQ("'\\f' (12, 0xC)", Print('\f'));
296 EXPECT_EQ("'\\n' (10, 0xA)", Print('\n'));
297 EXPECT_EQ("'\\r' (13, 0xD)", Print('\r'));
298 EXPECT_EQ("'\\t' (9)", Print('\t'));
299 EXPECT_EQ("'\\v' (11, 0xB)", Print('\v'));
300 EXPECT_EQ("'\\x7F' (127)", Print('\x7F'));
301 EXPECT_EQ("'\\xFF' (255)", Print('\xFF'));
302 EXPECT_EQ("' ' (32, 0x20)", Print(' '));
303 EXPECT_EQ("'a' (97, 0x61)", Print('a'));
304}
Here is the call graph for this function:

◆ TEST() [32/103]

testing::gtest_printers_test::TEST ( PrintCharTest ,
SignedChar  )

Definition at line 307 of file gtest-printers_test.cc.

307 {
308 EXPECT_EQ("'\\0'", Print(static_cast<signed char>('\0')));
309 EXPECT_EQ("'\\xCE' (-50)",
310 Print(static_cast<signed char>(-50)));
311}
Here is the call graph for this function:

◆ TEST() [33/103]

testing::gtest_printers_test::TEST ( PrintCharTest ,
UnsignedChar  )

Definition at line 314 of file gtest-printers_test.cc.

314 {
315 EXPECT_EQ("'\\0'", Print(static_cast<unsigned char>('\0')));
316 EXPECT_EQ("'b' (98, 0x62)",
317 Print(static_cast<unsigned char>('b')));
318}
Here is the call graph for this function:

◆ TEST() [34/103]

testing::gtest_printers_test::TEST ( PrintClassTest ,
BiggestIntConvertible  )

Definition at line 280 of file gtest-printers_test.cc.

Here is the call graph for this function:

◆ TEST() [35/103]

testing::gtest_printers_test::TEST ( PrintCStringTest ,
Const  )

Definition at line 396 of file gtest-printers_test.cc.

396 {
397 const char* p = "World";
398 EXPECT_EQ(PrintPointer(p) + " pointing to \"World\"", Print(p));
399}
Here is the call graph for this function:

◆ TEST() [36/103]

testing::gtest_printers_test::TEST ( PrintCStringTest ,
EscapesProperly  )

Definition at line 415 of file gtest-printers_test.cc.

415 {
416 const char* p = "'\"?\\\a\b\f\n\r\t\v\x7F\xFF a";
417 EXPECT_EQ(PrintPointer(p) + " pointing to \"'\\\"?\\\\\\a\\b\\f"
418 "\\n\\r\\t\\v\\x7F\\xFF a\"",
419 Print(p));
420}
Here is the call graph for this function:

◆ TEST() [37/103]

testing::gtest_printers_test::TEST ( PrintCStringTest ,
NonConst  )

Definition at line 402 of file gtest-printers_test.cc.

402 {
403 char p[] = "Hi";
404 EXPECT_EQ(PrintPointer(p) + " pointing to \"Hi\"",
405 Print(static_cast<char*>(p)));
406}
Here is the call graph for this function:

◆ TEST() [38/103]

testing::gtest_printers_test::TEST ( PrintCStringTest ,
Null  )

Definition at line 409 of file gtest-printers_test.cc.

409 {
410 const char* p = NULL;
411 EXPECT_EQ("NULL", Print(p));
412}
Here is the call graph for this function:

◆ TEST() [39/103]

testing::gtest_printers_test::TEST ( PrintEnumTest ,
AnonymousEnum  )

Definition at line 258 of file gtest-printers_test.cc.

258 {
259 EXPECT_EQ("-1", Print(kAE1));
260 EXPECT_EQ("1", Print(kAE2));
261}
Here is the call graph for this function:

◆ TEST() [40/103]

testing::gtest_printers_test::TEST ( PrintEnumTest ,
EnumWithoutPrinter  )

Definition at line 263 of file gtest-printers_test.cc.

263 {
264 EXPECT_EQ("-2", Print(kEWP1));
265 EXPECT_EQ("42", Print(kEWP2));
266}
Here is the call graph for this function:

◆ TEST() [41/103]

testing::gtest_printers_test::TEST ( PrintEnumTest ,
EnumWithPrintTo  )

Definition at line 273 of file gtest-printers_test.cc.

273 {
274 EXPECT_EQ("kEWPT1", Print(kEWPT1));
275 EXPECT_EQ("invalid", Print(static_cast<EnumWithPrintTo>(0)));
276}
Here is the call graph for this function:

◆ TEST() [42/103]

testing::gtest_printers_test::TEST ( PrintEnumTest ,
EnumWithStreaming  )

Definition at line 268 of file gtest-printers_test.cc.

268 {
269 EXPECT_EQ("kEWS1", Print(kEWS1));
270 EXPECT_EQ("invalid", Print(static_cast<EnumWithStreaming>(0)));
271}
EnumWithStreaming
Here is the call graph for this function:

◆ TEST() [43/103]

testing::gtest_printers_test::TEST ( PrintPointerTest ,
MemberFunctionPointer  )

Definition at line 584 of file gtest-printers_test.cc.

584 {
585 EXPECT_TRUE(HasPrefix(Print(&Foo::MyMethod),
586 Print(sizeof(&Foo::MyMethod)) + "-byte object "));
588 HasPrefix(Print(&Foo::MyVirtualMethod),
589 Print(sizeof((&Foo::MyVirtualMethod))) + "-byte object "));
590 int (Foo::*p)(char) = NULL; // NOLINT
592 Print(sizeof(p)) + "-byte object "));
593}
#define EXPECT_TRUE(condition)
Definition gtest.h:1895
AssertionResult HasPrefix(const StringType &str, const StringType &prefix)
Here is the call graph for this function:

◆ TEST() [44/103]

testing::gtest_printers_test::TEST ( PrintPointerTest ,
MemberVariablePointer  )

Definition at line 572 of file gtest-printers_test.cc.

572 {
574 Print(sizeof(&Foo::value)) + "-byte object "));
575 int (Foo::*p) = NULL; // NOLINT
577 Print(sizeof(p)) + "-byte object "));
578}
Value * value
Definition fwdtest.cpp:78
Here is the call graph for this function:

◆ TEST() [45/103]

testing::gtest_printers_test::TEST ( PrintPointerTest ,
NonMemberFunctionPointer  )

Definition at line 531 of file gtest-printers_test.cc.

531 {
532 // We cannot directly cast &MyFunction to const void* because the
533 // standard disallows casting between pointers to functions and
534 // pointers to objects, and some compilers (e.g. GCC 3.4) enforce
535 // this limitation.
536 EXPECT_EQ(
537 PrintPointer(reinterpret_cast<const void*>(
538 reinterpret_cast<internal::BiggestInt>(&MyFunction))),
539 Print(&MyFunction));
540 int (*p)(bool) = NULL; // NOLINT
541 EXPECT_EQ("NULL", Print(p));
542}
long long BiggestInt
Here is the call graph for this function:

◆ TEST() [46/103]

testing::gtest_printers_test::TEST ( PrintPointerToBuiltInTypeTest ,
Bool  )

Definition at line 496 of file gtest-printers_test.cc.

496 {
497 bool* p = reinterpret_cast<bool*>(0xABCD);
498 EXPECT_EQ(PrintPointer(p), Print(p));
499 p = NULL;
500 EXPECT_EQ("NULL", Print(p));
501}
Here is the call graph for this function:

◆ TEST() [47/103]

testing::gtest_printers_test::TEST ( PrintPointerToBuiltInTypeTest ,
ConstVoid  )

Definition at line 512 of file gtest-printers_test.cc.

512 {
513 const void* p = reinterpret_cast<const void*>(0xABCD);
514 EXPECT_EQ(PrintPointer(p), Print(p));
515 p = NULL;
516 EXPECT_EQ("NULL", Print(p));
517}
Here is the call graph for this function:

◆ TEST() [48/103]

testing::gtest_printers_test::TEST ( PrintPointerToBuiltInTypeTest ,
Void  )

Definition at line 504 of file gtest-printers_test.cc.

504 {
505 void* p = reinterpret_cast<void*>(0xABCD);
506 EXPECT_EQ(PrintPointer(p), Print(p));
507 p = NULL;
508 EXPECT_EQ("NULL", Print(p));
509}
Here is the call graph for this function:

◆ TEST() [49/103]

testing::gtest_printers_test::TEST ( PrintPointerToPointerTest ,
IntPointerPointer  )

Definition at line 520 of file gtest-printers_test.cc.

520 {
521 int** p = reinterpret_cast<int**>(0xABCD);
522 EXPECT_EQ(PrintPointer(p), Print(p));
523 p = NULL;
524 EXPECT_EQ("NULL", Print(p));
525}
Here is the call graph for this function:

◆ TEST() [50/103]

testing::gtest_printers_test::TEST ( PrintPrintableTypeTest ,
InUserNamespace  )

Definition at line 1181 of file gtest-printers_test.cc.

1181 {
1182 EXPECT_EQ("PrintableViaPrintTo: 0",
1184}
Here is the call graph for this function:

◆ TEST() [51/103]

testing::gtest_printers_test::TEST ( PrintPrintableTypeTest ,
PointerInUserNamespace  )

Definition at line 1188 of file gtest-printers_test.cc.

1188 {
1190 EXPECT_EQ("PointerPrintable*", Print(&x));
1191}
Here is the call graph for this function:

◆ TEST() [52/103]

testing::gtest_printers_test::TEST ( PrintPrintableTypeTest ,
TemplateInUserNamespace  )

Definition at line 1194 of file gtest-printers_test.cc.

1194 {
1195 EXPECT_EQ("PrintableViaPrintToTemplate: 5",
1197}
Here is the call graph for this function:

◆ TEST() [53/103]

testing::gtest_printers_test::TEST ( PrintReferenceTest ,
HandlesFunctionPointer  )

Definition at line 1220 of file gtest-printers_test.cc.

1220 {
1221 void (*fp)(int n) = &MyFunction;
1222 const std::string fp_pointer_string =
1223 PrintPointer(reinterpret_cast<const void*>(&fp));
1224 // We cannot directly cast &MyFunction to const void* because the
1225 // standard disallows casting between pointers to functions and
1226 // pointers to objects, and some compilers (e.g. GCC 3.4) enforce
1227 // this limitation.
1228 const std::string fp_string = PrintPointer(reinterpret_cast<const void*>(
1229 reinterpret_cast<internal::BiggestInt>(fp)));
1230 EXPECT_EQ("@" + fp_pointer_string + " " + fp_string,
1231 PrintByRef(fp));
1232}
std::string PrintByRef(const T &value)
Here is the call graph for this function:

◆ TEST() [54/103]

testing::gtest_printers_test::TEST ( PrintReferenceTest ,
HandlesMemberFunctionPointer  )

Definition at line 1236 of file gtest-printers_test.cc.

1236 {
1237 int (Foo::*p)(char ch) = &Foo::MyMethod;
1239 PrintByRef(p),
1240 "@" + PrintPointer(reinterpret_cast<const void*>(&p)) + " " +
1241 Print(sizeof(p)) + "-byte object "));
1242
1243 char (Foo::*p2)(int n) = &Foo::MyVirtualMethod;
1245 PrintByRef(p2),
1246 "@" + PrintPointer(reinterpret_cast<const void*>(&p2)) + " " +
1247 Print(sizeof(p2)) + "-byte object "));
1248}
Here is the call graph for this function:

◆ TEST() [55/103]

testing::gtest_printers_test::TEST ( PrintReferenceTest ,
HandlesMemberVariablePointer  )

Definition at line 1252 of file gtest-printers_test.cc.

1252 {
1253 int (Foo::*p) = &Foo::value; // NOLINT
1255 PrintByRef(p),
1256 "@" + PrintPointer(&p) + " " + Print(sizeof(p)) + "-byte object "));
1257}
Here is the call graph for this function:

◆ TEST() [56/103]

testing::gtest_printers_test::TEST ( PrintReferenceTest ,
PrintsAddressAndValue  )

Definition at line 1201 of file gtest-printers_test.cc.

1201 {
1202 int n = 5;
1203 EXPECT_EQ("@" + PrintPointer(&n) + " 5", PrintByRef(n));
1204
1205 int a[2][3] = {
1206 { 0, 1, 2 },
1207 { 3, 4, 5 }
1208 };
1209 EXPECT_EQ("@" + PrintPointer(a) + " { { 0, 1, 2 }, { 3, 4, 5 } }",
1210 PrintByRef(a));
1211
1212 const ::foo::UnprintableInFoo x;
1213 EXPECT_EQ("@" + PrintPointer(&x) + " 16-byte object "
1214 "<EF-12 00-00 34-AB 00-00 00-00 00-00 00-00 00-00>",
1215 PrintByRef(x));
1216}
Here is the call graph for this function:

◆ TEST() [57/103]

testing::gtest_printers_test::TEST ( PrintStlContainerTest ,
ConstIterator  )

Definition at line 993 of file gtest-printers_test.cc.

993 {
994 const_iterator it = {};
995 EXPECT_EQ("1-byte object <00>", Print(it));
996}
Here is the call graph for this function:

◆ TEST() [58/103]

testing::gtest_printers_test::TEST ( PrintStlContainerTest ,
EmptyDeque  )

Definition at line 809 of file gtest-printers_test.cc.

809 {
810 deque<char> empty;
811 EXPECT_EQ("{}", Print(empty));
812}
Here is the call graph for this function:

◆ TEST() [59/103]

testing::gtest_printers_test::TEST ( PrintStlContainerTest ,
Iterator  )

Definition at line 982 of file gtest-printers_test.cc.

982 {
983 iterator it = {};
984 EXPECT_EQ("1-byte object <00>", Print(it));
985}
Here is the call graph for this function:

◆ TEST() [60/103]

testing::gtest_printers_test::TEST ( PrintStlContainerTest ,
List  )

Definition at line 882 of file gtest-printers_test.cc.

882 {
883 const std::string a[] = {"hello", "world"};
884 const list<std::string> strings(a, a + 2);
885 EXPECT_EQ("{ \"hello\", \"world\" }", Print(strings));
886}
Here is the call graph for this function:

◆ TEST() [61/103]

testing::gtest_printers_test::TEST ( PrintStlContainerTest ,
LongSequence  )

Definition at line 945 of file gtest-printers_test.cc.

945 {
946 const int a[100] = { 1, 2, 3 };
947 const vector<int> v(a, a + 100);
948 EXPECT_EQ("{ 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "
949 "0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... }", Print(v));
950}
Here is the call graph for this function:

◆ TEST() [62/103]

testing::gtest_printers_test::TEST ( PrintStlContainerTest ,
Map  )

Definition at line 888 of file gtest-printers_test.cc.

888 {
889 map<int, bool> map1;
890 map1[1] = true;
891 map1[5] = false;
892 map1[3] = true;
893 EXPECT_EQ("{ (1, true), (3, true), (5, false) }", Print(map1));
894}
Here is the call graph for this function:

◆ TEST() [63/103]

testing::gtest_printers_test::TEST ( PrintStlContainerTest ,
MultiMap  )

Definition at line 896 of file gtest-printers_test.cc.

896 {
897 multimap<bool, int> map1;
898 // The make_pair template function would deduce the type as
899 // pair<bool, int> here, and since the key part in a multimap has to
900 // be constant, without a templated ctor in the pair class (as in
901 // libCstd on Solaris), make_pair call would fail to compile as no
902 // implicit conversion is found. Thus explicit typename is used
903 // here instead.
904 map1.insert(pair<const bool, int>(true, 0));
905 map1.insert(pair<const bool, int>(true, 1));
906 map1.insert(pair<const bool, int>(false, 2));
907 EXPECT_EQ("{ (false, 2), (true, 0), (true, 1) }", Print(map1));
908}
Here is the call graph for this function:

◆ TEST() [64/103]

testing::gtest_printers_test::TEST ( PrintStlContainerTest ,
MultiSet  )

Definition at line 916 of file gtest-printers_test.cc.

916 {
917 const int a[] = { 1, 1, 2, 5, 1 };
918 multiset<int> set1(a, a + 5);
919 EXPECT_EQ("{ 1, 1, 1, 2, 5 }", Print(set1));
920}
Here is the call graph for this function:

◆ TEST() [65/103]

testing::gtest_printers_test::TEST ( PrintStlContainerTest ,
NestedContainer  )

Definition at line 952 of file gtest-printers_test.cc.

952 {
953 const int a1[] = { 1, 2 };
954 const int a2[] = { 3, 4, 5 };
955 const list<int> l1(a1, a1 + 2);
956 const list<int> l2(a2, a2 + 3);
957
958 vector<list<int> > v;
959 v.push_back(l1);
960 v.push_back(l2);
961 EXPECT_EQ("{ { 1, 2 }, { 3, 4, 5 } }", Print(v));
962}
Here is the call graph for this function:

◆ TEST() [66/103]

testing::gtest_printers_test::TEST ( PrintStlContainerTest ,
NonEmptyDeque  )

Definition at line 814 of file gtest-printers_test.cc.

814 {
815 deque<int> non_empty;
816 non_empty.push_back(1);
817 non_empty.push_back(3);
818 EXPECT_EQ("{ 1, 3 }", Print(non_empty));
819}
Here is the call graph for this function:

◆ TEST() [67/103]

testing::gtest_printers_test::TEST ( PrintStlContainerTest ,
OneDimensionalNativeArray  )

Definition at line 964 of file gtest-printers_test.cc.

964 {
965 const int a[3] = { 1, 2, 3 };
966 NativeArray<int> b(a, 3, RelationToSourceReference());
967 EXPECT_EQ("{ 1, 2, 3 }", Print(b));
968}
Here is the call graph for this function:

◆ TEST() [68/103]

testing::gtest_printers_test::TEST ( PrintStlContainerTest ,
Pair  )

Definition at line 933 of file gtest-printers_test.cc.

933 {
934 pair<const bool, int> p(true, 5);
935 EXPECT_EQ("(true, 5)", Print(p));
936}
Here is the call graph for this function:

◆ TEST() [69/103]

testing::gtest_printers_test::TEST ( PrintStlContainerTest ,
Set  )

Definition at line 910 of file gtest-printers_test.cc.

910 {
911 const unsigned int a[] = { 3, 0, 5 };
912 set<unsigned int> set1(a, a + 3);
913 EXPECT_EQ("{ 0, 3, 5 }", Print(set1));
914}
Here is the call graph for this function:

◆ TEST() [70/103]

testing::gtest_printers_test::TEST ( PrintStlContainerTest ,
TwoDimensionalNativeArray  )

Definition at line 970 of file gtest-printers_test.cc.

970 {
971 const int a[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } };
972 NativeArray<int[3]> b(a, 2, RelationToSourceReference());
973 EXPECT_EQ("{ { 1, 2, 3 }, { 4, 5, 6 } }", Print(b));
974}
Here is the call graph for this function:

◆ TEST() [71/103]

testing::gtest_printers_test::TEST ( PrintStlContainerTest ,
Vector  )

Definition at line 938 of file gtest-printers_test.cc.

938 {
939 vector<int> v;
940 v.push_back(1);
941 v.push_back(2);
942 EXPECT_EQ("{ 1, 2 }", Print(v));
943}
Here is the call graph for this function:

◆ TEST() [72/103]

testing::gtest_printers_test::TEST ( PrintStreamableTypeTest ,
InGlobalNamespace  )

Definition at line 1159 of file gtest-printers_test.cc.

1159 {
1161 EXPECT_EQ("StreamableInGlobal", Print(x));
1162 EXPECT_EQ("StreamableInGlobal*", Print(&x));
1163}
Here is the call graph for this function:

◆ TEST() [73/103]

testing::gtest_printers_test::TEST ( PrintStreamableTypeTest ,
PathLikeInUserNamespace  )

Definition at line 1173 of file gtest-printers_test.cc.

1173 {
1175 EXPECT_EQ("Streamable-PathLike", Print(x));
1176 const ::foo::PathLike cx;
1177 EXPECT_EQ("Streamable-PathLike", Print(cx));
1178}
Here is the call graph for this function:

◆ TEST() [74/103]

testing::gtest_printers_test::TEST ( PrintStreamableTypeTest ,
TemplateTypeInUserNamespace  )

Definition at line 1166 of file gtest-printers_test.cc.

1166 {
1167 EXPECT_EQ("StreamableTemplateInFoo: 0",
1169}
Here is the call graph for this function:

◆ TEST() [75/103]

testing::gtest_printers_test::TEST ( PrintStringTest ,
StringAmbiguousHex  )

Definition at line 684 of file gtest-printers_test.cc.

684 {
685 // "\x6BANANA" is ambiguous, it can be interpreted as starting with either of:
686 // '\x6', '\x6B', or '\x6BA'.
687
688 // a hex escaping sequence following by a decimal digit
689 EXPECT_EQ("\"0\\x12\" \"3\"", Print(::std::string("0\x12" "3")));
690 // a hex escaping sequence following by a hex digit (lower-case)
691 EXPECT_EQ("\"mm\\x6\" \"bananas\"", Print(::std::string("mm\x6" "bananas")));
692 // a hex escaping sequence following by a hex digit (upper-case)
693 EXPECT_EQ("\"NOM\\x6\" \"BANANA\"", Print(::std::string("NOM\x6" "BANANA")));
694 // a hex escaping sequence following by a non-xdigit
695 EXPECT_EQ("\"!\\x5-!\"", Print(::std::string("!\x5-!")));
696}

◆ TEST() [76/103]

testing::gtest_printers_test::TEST ( PrintStringTest ,
StringInStdNamespace  )

Definition at line 677 of file gtest-printers_test.cc.

677 {
678 const char s[] = "'\"?\\\a\b\f\n\0\r\t\v\x7F\xFF a";
679 const ::std::string str(s, sizeof(s));
680 EXPECT_EQ("\"'\\\"?\\\\\\a\\b\\f\\n\\0\\r\\t\\v\\x7F\\xFF a\\0\"",
681 Print(str));
682}
Here is the call graph for this function:

◆ TEST() [77/103]

testing::gtest_printers_test::TEST ( PrintToStringTest ,
ContainsNonLatin  )

Definition at line 1511 of file gtest-printers_test.cc.

1511 {
1512 // Sanity test with valid UTF-8. Prints both in hex and as text.
1513 std::string non_ascii_str = ::std::string("오전 4:30");
1514 EXPECT_PRINT_TO_STRING_(non_ascii_str,
1515 "\"\\xEC\\x98\\xA4\\xEC\\xA0\\x84 4:30\"\n"
1516 " As Text: \"오전 4:30\"");
1517 non_ascii_str = ::std::string("From ä — ẑ");
1518 EXPECT_PRINT_TO_STRING_(non_ascii_str,
1519 "\"From \\xC3\\xA4 \\xE2\\x80\\x94 \\xE1\\xBA\\x91\""
1520 "\n As Text: \"From ä — ẑ\"");
1521}

◆ TEST() [78/103]

testing::gtest_printers_test::TEST ( PrintToStringTest ,
EscapesForPointerToConstChar  )

Definition at line 1482 of file gtest-printers_test.cc.

1482 {
1483 const char* p = "hello\n";
1484 EXPECT_PRINT_TO_STRING_(p, "\"hello\\n\"");
1485}

◆ TEST() [79/103]

testing::gtest_printers_test::TEST ( PrintToStringTest ,
EscapesForPointerToNonConstChar  )

Definition at line 1487 of file gtest-printers_test.cc.

1487 {
1488 char s[] = "hello\1";
1489 char* p = s;
1490 EXPECT_PRINT_TO_STRING_(p, "\"hello\\x1\"");
1491}

◆ TEST() [80/103]

testing::gtest_printers_test::TEST ( PrintToStringTest ,
WorksForArray  )

Definition at line 1493 of file gtest-printers_test.cc.

1493 {
1494 int n[3] = { 1, 2, 3 };
1495 EXPECT_PRINT_TO_STRING_(n, "{ 1, 2, 3 }");
1496}

◆ TEST() [81/103]

testing::gtest_printers_test::TEST ( PrintToStringTest ,
WorksForCharArray  )

Definition at line 1498 of file gtest-printers_test.cc.

1498 {
1499 char s[] = "hello";
1500 EXPECT_PRINT_TO_STRING_(s, "\"hello\"");
1501}

◆ TEST() [82/103]

testing::gtest_printers_test::TEST ( PrintToStringTest ,
WorksForCharArrayWithEmbeddedNul  )

Definition at line 1503 of file gtest-printers_test.cc.

1503 {
1504 const char str_with_nul[] = "hello\0 world";
1505 EXPECT_PRINT_TO_STRING_(str_with_nul, "\"hello\\0 world\"");
1506
1507 char mutable_str_with_nul[] = "hello\0 world";
1508 EXPECT_PRINT_TO_STRING_(mutable_str_with_nul, "\"hello\\0 world\"");
1509}

◆ TEST() [83/103]

testing::gtest_printers_test::TEST ( PrintToStringTest ,
WorksForPointerToConstChar  )

Definition at line 1471 of file gtest-printers_test.cc.

1471 {
1472 const char* p = "hello";
1473 EXPECT_PRINT_TO_STRING_(p, "\"hello\"");
1474}

◆ TEST() [84/103]

testing::gtest_printers_test::TEST ( PrintToStringTest ,
WorksForPointerToNonConstChar  )

Definition at line 1476 of file gtest-printers_test.cc.

1476 {
1477 char s[] = "hello";
1478 char* p = s;
1479 EXPECT_PRINT_TO_STRING_(p, "\"hello\"");
1480}

◆ TEST() [85/103]

testing::gtest_printers_test::TEST ( PrintToStringTest ,
WorksForScalar  )

Definition at line 1467 of file gtest-printers_test.cc.

1467 {
1468 EXPECT_PRINT_TO_STRING_(123, "123");
1469}

◆ TEST() [86/103]

testing::gtest_printers_test::TEST ( PrintTypeSizeTest ,
Wchar_t  )

Definition at line 351 of file gtest-printers_test.cc.

351 {
352 EXPECT_LT(sizeof(wchar_t), sizeof(testing::internal::Int64));
353}
#define EXPECT_LT(val1, val2)
Definition gtest.h:1962

◆ TEST() [87/103]

testing::gtest_printers_test::TEST ( PrintTypeWithGenericStreamingTest ,
NonTemplateType  )

Definition at line 747 of file gtest-printers_test.cc.

◆ TEST() [88/103]

testing::gtest_printers_test::TEST ( PrintTypeWithGenericStreamingTest ,
TemplateType  )

◆ TEST() [89/103]

testing::gtest_printers_test::TEST ( PrintTypeWithGenericStreamingTest ,
TypeImplicitlyConvertible  )

Definition at line 785 of file gtest-printers_test.cc.

Here is the call graph for this function:

◆ TEST() [90/103]

testing::gtest_printers_test::TEST ( PrintUnprintableTypeTest ,
InGlobalNamespace  )

Definition at line 1127 of file gtest-printers_test.cc.

Here is the call graph for this function:

◆ TEST() [91/103]

testing::gtest_printers_test::TEST ( PrintUnprintableTypeTest ,
InUserNamespace  )

Definition at line 1133 of file gtest-printers_test.cc.

1133 {
1134 EXPECT_EQ("16-byte object <EF-12 00-00 34-AB 00-00 00-00 00-00 00-00 00-00>",
1136}
Here is the call graph for this function:

◆ TEST() [92/103]

testing::gtest_printers_test::TEST ( PrintUnpritableTypeTest ,
BigObject  )

Definition at line 1145 of file gtest-printers_test.cc.

1145 {
1146 EXPECT_EQ("257-byte object <00-00 00-00 00-00 00-00 00-00 00-00 "
1147 "00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 "
1148 "00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 "
1149 "00-00 00-00 00-00 00-00 00-00 00-00 ... 00-00 00-00 00-00 "
1150 "00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 "
1151 "00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 "
1152 "00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00>",
1153 Print(Big()));
1154}
Here is the call graph for this function:

◆ TEST() [93/103]

testing::gtest_printers_test::TEST ( PrintWideCStringTest ,
Const  )

Definition at line 431 of file gtest-printers_test.cc.

431 {
432 const wchar_t* p = L"World";
433 EXPECT_EQ(PrintPointer(p) + " pointing to L\"World\"", Print(p));
434}
Here is the call graph for this function:

◆ TEST() [94/103]

testing::gtest_printers_test::TEST ( PrintWideCStringTest ,
EscapesProperly  )

Definition at line 450 of file gtest-printers_test.cc.

450 {
451 const wchar_t s[] = {'\'', '"', '?', '\\', '\a', '\b', '\f', '\n', '\r',
452 '\t', '\v', 0xD3, 0x576, 0x8D3, 0xC74D, ' ', 'a', '\0'};
453 EXPECT_EQ(PrintPointer(s) + " pointing to L\"'\\\"?\\\\\\a\\b\\f"
454 "\\n\\r\\t\\v\\xD3\\x576\\x8D3\\xC74D a\"",
455 Print(static_cast<const wchar_t*>(s)));
456}
Here is the call graph for this function:

◆ TEST() [95/103]

testing::gtest_printers_test::TEST ( PrintWideCStringTest ,
NonConst  )

Definition at line 437 of file gtest-printers_test.cc.

437 {
438 wchar_t p[] = L"Hi";
439 EXPECT_EQ(PrintPointer(p) + " pointing to L\"Hi\"",
440 Print(static_cast<wchar_t*>(p)));
441}
Here is the call graph for this function:

◆ TEST() [96/103]

testing::gtest_printers_test::TEST ( PrintWideCStringTest ,
Null  )

Definition at line 444 of file gtest-printers_test.cc.

444 {
445 const wchar_t* p = NULL;
446 EXPECT_EQ("NULL", Print(p));
447}
Here is the call graph for this function:

◆ TEST() [97/103]

testing::gtest_printers_test::TEST ( UniversalPrintTest ,
WorksForCharArray  )

Definition at line 1645 of file gtest-printers_test.cc.

1645 {
1646 const char str[] = "\"Line\0 1\"\nLine 2";
1647 ::std::stringstream ss1;
1648 UniversalPrint(str, &ss1);
1649 EXPECT_EQ("\"\\\"Line\\0 1\\\"\\nLine 2\"", ss1.str());
1650
1651 const char mutable_str[] = "\"Line\0 1\"\nLine 2";
1652 ::std::stringstream ss2;
1653 UniversalPrint(mutable_str, &ss2);
1654 EXPECT_EQ("\"\\\"Line\\0 1\\\"\\nLine 2\"", ss2.str());
1655}

◆ TEST() [98/103]

testing::gtest_printers_test::TEST ( UniversalPrintTest ,
WorksForCString  )

Definition at line 1628 of file gtest-printers_test.cc.

1628 {
1629 const char* s1 = "abc";
1630 ::std::stringstream ss1;
1631 UniversalPrint(s1, &ss1);
1632 EXPECT_EQ(PrintPointer(s1) + " pointing to \"abc\"", std::string(ss1.str()));
1633
1634 char* s2 = const_cast<char*>(s1);
1635 ::std::stringstream ss2;
1636 UniversalPrint(s2, &ss2);
1637 EXPECT_EQ(PrintPointer(s2) + " pointing to \"abc\"", std::string(ss2.str()));
1638
1639 const char* s3 = NULL;
1640 ::std::stringstream ss3;
1641 UniversalPrint(s3, &ss3);
1642 EXPECT_EQ("NULL", ss3.str());
1643}

◆ TEST() [99/103]

testing::gtest_printers_test::TEST ( UniversalPrintTest ,
WorksForNonReference  )

Definition at line 1615 of file gtest-printers_test.cc.

1615 {
1616 ::std::stringstream ss;
1617 UniversalPrint(123, &ss);
1618 EXPECT_EQ("123", ss.str());
1619}

◆ TEST() [100/103]

testing::gtest_printers_test::TEST ( UniversalPrintTest ,
WorksForReference  )

Definition at line 1621 of file gtest-printers_test.cc.

1621 {
1622 const int& n = 123;
1623 ::std::stringstream ss;
1624 UniversalPrint(n, &ss);
1625 EXPECT_EQ("123", ss.str());
1626}

◆ TEST() [101/103]

testing::gtest_printers_test::TEST ( UniversalTersePrintTest ,
WorksForCString  )

Definition at line 1598 of file gtest-printers_test.cc.

1598 {
1599 const char* s1 = "abc";
1600 ::std::stringstream ss1;
1601 UniversalTersePrint(s1, &ss1);
1602 EXPECT_EQ("\"abc\"", ss1.str());
1603
1604 char* s2 = const_cast<char*>(s1);
1605 ::std::stringstream ss2;
1606 UniversalTersePrint(s2, &ss2);
1607 EXPECT_EQ("\"abc\"", ss2.str());
1608
1609 const char* s3 = NULL;
1610 ::std::stringstream ss3;
1611 UniversalTersePrint(s3, &ss3);
1612 EXPECT_EQ("NULL", ss3.str());
1613}

◆ TEST() [102/103]

testing::gtest_printers_test::TEST ( UniversalTersePrintTest ,
WorksForNonReference  )

Definition at line 1585 of file gtest-printers_test.cc.

1585 {
1586 ::std::stringstream ss;
1587 UniversalTersePrint(123, &ss);
1588 EXPECT_EQ("123", ss.str());
1589}

◆ TEST() [103/103]

testing::gtest_printers_test::TEST ( UniversalTersePrintTest ,
WorksForReference  )

Definition at line 1591 of file gtest-printers_test.cc.

1591 {
1592 const int& n = 123;
1593 ::std::stringstream ss;
1594 UniversalTersePrint(n, &ss);
1595 EXPECT_EQ("123", ss.str());
1596}