proxygen
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 >
string Print (const T &value)
 
template<typename T >
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)
 
static string PrintPointer (const void *p)
 
 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>
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 (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 (UniversalTersePrintTest, WorksForNonReference)
 
 TEST (UniversalTersePrintTest, WorksForReference)
 
 TEST (UniversalTersePrintTest, WorksForCString)
 
 TEST (UniversalPrintTest, WorksForNonReference)
 
 TEST (UniversalPrintTest, WorksForReference)
 
 TEST (UniversalPrintTest, WorksForCString)
 
 TEST (UniversalPrintTest, WorksForCharArray)
 
static string PrintPointer (const void *p)
 
static string PrintPointer (const void *p)
 

Function Documentation

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

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

References testing::AssertionFailure(), and testing::AssertionSuccess().

Referenced by testing::gtest_printers_test::Big::Big(), testing::gtest_printers_test::Foo::MyVirtualMethod(), PrintPointer(), and TEST().

542  {
543  if (str.find(prefix, 0) == 0)
544  return AssertionSuccess();
545 
546  const bool is_wide_string = sizeof(prefix[0]) > 1;
547  const char* const begin_string_quote = is_wide_string ? "L\"" : "\"";
548  return AssertionFailure()
549  << begin_string_quote << prefix << "\" is not a prefix of "
550  << begin_string_quote << str << "\"\n";
551 }
GTEST_API_ AssertionResult AssertionFailure()
Definition: gtest.cc:1015
bool prefix(Cursor &c, uint32_t expected)
GTEST_API_ AssertionResult AssertionSuccess()
Definition: gtest.cc:1010
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 736 of file gtest-printers_test.cc.

738  {
739  return os << "AllowsGenericStreaming";
740 }
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 753 of file gtest-printers_test.cc.

755  {
756  return os << "AllowsGenericStreamingTemplate";
757 }
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 774 of file gtest-printers_test.cc.

776  {
777  return os << "AllowsGenericStreamingAndImplicitConversionTemplate";
778 }
template<typename T , size_t N>
string testing::gtest_printers_test::PrintArrayHelper ( T(&)  a[N])

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

References a, and Print().

Referenced by testing::gtest_printers_test::Foo::MyVirtualMethod(), and TEST().

595  {
596  return Print(a);
597 }
char a
template<typename T >
string testing::gtest_printers_test::PrintByRef ( const T value)

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

References Print().

Referenced by testing::gtest_printers_test::Big::Big(), TEST(), and foo::StreamableTemplateInFoo< T >::value().

245  {
246  ::std::stringstream ss;
248  return ss.str();
249 }
static const char *const value
Definition: Conv.cpp:50
static string testing::gtest_printers_test::PrintPointer ( const void *  p)
static

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

382  {
383  ::std::stringstream expected_result_stream;
384  expected_result_stream << p;
385  return expected_result_stream.str();
386 }
static string testing::gtest_printers_test::PrintPointer ( const void *  p)
static

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

References testing::AssertionFailure(), testing::AssertionSuccess(), EXPECT_EQ, HasPrefix(), MyFunction(), prefix(), Print(), PrintPointer(), s, and TEST().

382  {
383  ::std::stringstream expected_result_stream;
384  expected_result_stream << p;
385  return expected_result_stream.str();
386 }
static string testing::gtest_printers_test::PrintPointer ( const void *  p)
static

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

References testing::AssertionFailure(), testing::AssertionSuccess(), EXPECT_EQ, HasPrefix(), MyFunction(), prefix(), Print(), s, and TEST().

Referenced by testing::gtest_printers_test::Big::Big(), testing::gtest_printers_test::AllowsGenericStreamingAndImplicitConversionTemplate< T >::operator bool(), PrintPointer(), and TEST().

382  {
383  ::std::stringstream expected_result_stream;
384  expected_result_stream << p;
385  return expected_result_stream.str();
386 }
testing::gtest_printers_test::TEST ( PrintEnumTest  ,
AnonymousEnum   
)

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

References EXPECT_EQ, kAE1, kAE2, and Print().

253  {
254  EXPECT_EQ("-1", Print(kAE1));
255  EXPECT_EQ("1", Print(kAE2));
256 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintEnumTest  ,
EnumWithoutPrinter   
)

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

References EXPECT_EQ, kEWP1, kEWP2, and Print().

258  {
259  EXPECT_EQ("-2", Print(kEWP1));
260  EXPECT_EQ("42", Print(kEWP2));
261 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintEnumTest  ,
EnumWithStreaming   
)

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

References EXPECT_EQ, kEWS1, and Print().

263  {
264  EXPECT_EQ("kEWS1", Print(kEWS1));
265  EXPECT_EQ("invalid", Print(static_cast<EnumWithStreaming>(0)));
266 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintEnumTest  ,
EnumWithPrintTo   
)

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

References EXPECT_EQ, kEWPT1, and Print().

268  {
269  EXPECT_EQ("kEWPT1", Print(kEWPT1));
270  EXPECT_EQ("invalid", Print(static_cast<EnumWithPrintTo>(0)));
271 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintClassTest  ,
BiggestIntConvertible   
)

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

References EXPECT_EQ, and Print().

275  {
277 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintCharTest  ,
PlainChar   
)

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

References EXPECT_EQ, and Print().

282  {
283  EXPECT_EQ("'\\0'", Print('\0'));
284  EXPECT_EQ("'\\'' (39, 0x27)", Print('\''));
285  EXPECT_EQ("'\"' (34, 0x22)", Print('"'));
286  EXPECT_EQ("'?' (63, 0x3F)", Print('?'));
287  EXPECT_EQ("'\\\\' (92, 0x5C)", Print('\\'));
288  EXPECT_EQ("'\\a' (7)", Print('\a'));
289  EXPECT_EQ("'\\b' (8)", Print('\b'));
290  EXPECT_EQ("'\\f' (12, 0xC)", Print('\f'));
291  EXPECT_EQ("'\\n' (10, 0xA)", Print('\n'));
292  EXPECT_EQ("'\\r' (13, 0xD)", Print('\r'));
293  EXPECT_EQ("'\\t' (9)", Print('\t'));
294  EXPECT_EQ("'\\v' (11, 0xB)", Print('\v'));
295  EXPECT_EQ("'\\x7F' (127)", Print('\x7F'));
296  EXPECT_EQ("'\\xFF' (255)", Print('\xFF'));
297  EXPECT_EQ("' ' (32, 0x20)", Print(' '));
298  EXPECT_EQ("'a' (97, 0x61)", Print('a'));
299 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintCharTest  ,
SignedChar   
)

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

References EXPECT_EQ, and Print().

302  {
303  EXPECT_EQ("'\\0'", Print(static_cast<signed char>('\0')));
304  EXPECT_EQ("'\\xCE' (-50)",
305  Print(static_cast<signed char>(-50)));
306 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintCharTest  ,
UnsignedChar   
)

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

References EXPECT_EQ, and Print().

309  {
310  EXPECT_EQ("'\\0'", Print(static_cast<unsigned char>('\0')));
311  EXPECT_EQ("'b' (98, 0x62)",
312  Print(static_cast<unsigned char>('b')));
313 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintBuiltInTypeTest  ,
Bool   
)

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

References EXPECT_EQ, and Print().

318  {
319  EXPECT_EQ("false", Print(false));
320  EXPECT_EQ("true", Print(true));
321 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintBuiltInTypeTest  ,
Wchar_t   
)

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

References EXPECT_EQ, and Print().

324  {
325  EXPECT_EQ("L'\\0'", Print(L'\0'));
326  EXPECT_EQ("L'\\'' (39, 0x27)", Print(L'\''));
327  EXPECT_EQ("L'\"' (34, 0x22)", Print(L'"'));
328  EXPECT_EQ("L'?' (63, 0x3F)", Print(L'?'));
329  EXPECT_EQ("L'\\\\' (92, 0x5C)", Print(L'\\'));
330  EXPECT_EQ("L'\\a' (7)", Print(L'\a'));
331  EXPECT_EQ("L'\\b' (8)", Print(L'\b'));
332  EXPECT_EQ("L'\\f' (12, 0xC)", Print(L'\f'));
333  EXPECT_EQ("L'\\n' (10, 0xA)", Print(L'\n'));
334  EXPECT_EQ("L'\\r' (13, 0xD)", Print(L'\r'));
335  EXPECT_EQ("L'\\t' (9)", Print(L'\t'));
336  EXPECT_EQ("L'\\v' (11, 0xB)", Print(L'\v'));
337  EXPECT_EQ("L'\\x7F' (127)", Print(L'\x7F'));
338  EXPECT_EQ("L'\\xFF' (255)", Print(L'\xFF'));
339  EXPECT_EQ("L' ' (32, 0x20)", Print(L' '));
340  EXPECT_EQ("L'a' (97, 0x61)", Print(L'a'));
341  EXPECT_EQ("L'\\x576' (1398)", Print(static_cast<wchar_t>(0x576)));
342  EXPECT_EQ("L'\\xC74D' (51021)", Print(static_cast<wchar_t>(0xC74D)));
343 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintTypeSizeTest  ,
Wchar_t   
)

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

References EXPECT_LT.

346  {
347  EXPECT_LT(sizeof(wchar_t), sizeof(testing::internal::Int64));
348 }
TypeWithSize< 8 >::Int Int64
Definition: gtest-port.h:2496
#define EXPECT_LT(val1, val2)
Definition: gtest.h:1930
testing::gtest_printers_test::TEST ( PrintBuiltInTypeTest  ,
Integer   
)

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

References EXPECT_EQ, and Print().

351  {
352  EXPECT_EQ("'\\xFF' (255)", Print(static_cast<unsigned char>(255))); // uint8
353  EXPECT_EQ("'\\x80' (-128)", Print(static_cast<signed char>(-128))); // int8
354  EXPECT_EQ("65535", Print(USHRT_MAX)); // uint16
355  EXPECT_EQ("-32768", Print(SHRT_MIN)); // int16
356  EXPECT_EQ("4294967295", Print(UINT_MAX)); // uint32
357  EXPECT_EQ("-2147483648", Print(INT_MIN)); // int32
358  EXPECT_EQ("18446744073709551615",
359  Print(static_cast<testing::internal::UInt64>(-1))); // uint64
360  EXPECT_EQ("-9223372036854775808",
361  Print(static_cast<testing::internal::Int64>(1) << 63)); // int64
362 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintBuiltInTypeTest  ,
Size_t   
)

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

References EXPECT_EQ, and Print().

365  {
366  EXPECT_EQ("1", Print(sizeof('a'))); // size_t.
367 #if !GTEST_OS_WINDOWS
368  // Windows has no ssize_t type.
369  EXPECT_EQ("-2", Print(static_cast<ssize_t>(-2))); // ssize_t.
370 #endif // !GTEST_OS_WINDOWS
371 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintBuiltInTypeTest  ,
FloatingPoints   
)

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

References EXPECT_EQ, f, and Print().

374  {
375  EXPECT_EQ("1.5", Print(1.5f)); // float
376  EXPECT_EQ("-2.5", Print(-2.5)); // double
377 }
auto f
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintCStringTest  ,
Const   
)

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

References EXPECT_EQ, Print(), and PrintPointer().

391  {
392  const char* p = "World";
393  EXPECT_EQ(PrintPointer(p) + " pointing to \"World\"", Print(p));
394 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
testing::gtest_printers_test::TEST ( PrintCStringTest  ,
NonConst   
)

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

References EXPECT_EQ, Print(), and PrintPointer().

397  {
398  char p[] = "Hi";
399  EXPECT_EQ(PrintPointer(p) + " pointing to \"Hi\"",
400  Print(static_cast<char*>(p)));
401 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
testing::gtest_printers_test::TEST ( PrintCStringTest  ,
Null   
)

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

References EXPECT_EQ, and Print().

404  {
405  const char* p = NULL;
406  EXPECT_EQ("NULL", Print(p));
407 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintCStringTest  ,
EscapesProperly   
)

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

References EXPECT_EQ, Print(), and PrintPointer().

410  {
411  const char* p = "'\"?\\\a\b\f\n\r\t\v\x7F\xFF a";
412  EXPECT_EQ(PrintPointer(p) + " pointing to \"'\\\"?\\\\\\a\\b\\f"
413  "\\n\\r\\t\\v\\x7F\\xFF a\"",
414  Print(p));
415 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
testing::gtest_printers_test::TEST ( PrintWideCStringTest  ,
Const   
)

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

References EXPECT_EQ, Print(), and PrintPointer().

426  {
427  const wchar_t* p = L"World";
428  EXPECT_EQ(PrintPointer(p) + " pointing to L\"World\"", Print(p));
429 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
testing::gtest_printers_test::TEST ( PrintWideCStringTest  ,
NonConst   
)

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

References EXPECT_EQ, Print(), and PrintPointer().

432  {
433  wchar_t p[] = L"Hi";
434  EXPECT_EQ(PrintPointer(p) + " pointing to L\"Hi\"",
435  Print(static_cast<wchar_t*>(p)));
436 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
testing::gtest_printers_test::TEST ( PrintWideCStringTest  ,
Null   
)

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

References EXPECT_EQ, and Print().

439  {
440  const wchar_t* p = NULL;
441  EXPECT_EQ("NULL", Print(p));
442 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintWideCStringTest  ,
EscapesProperly   
)

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

References EXPECT_EQ, Print(), PrintPointer(), and s.

445  {
446  const wchar_t s[] = {'\'', '"', '?', '\\', '\a', '\b', '\f', '\n', '\r',
447  '\t', '\v', 0xD3, 0x576, 0x8D3, 0xC74D, ' ', 'a', '\0'};
448  EXPECT_EQ(PrintPointer(s) + " pointing to L\"'\\\"?\\\\\\a\\b\\f"
449  "\\n\\r\\t\\v\\xD3\\x576\\x8D3\\xC74D a\"",
450  Print(static_cast<const wchar_t*>(s)));
451 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
static set< string > s
testing::gtest_printers_test::TEST ( PrintCharPointerTest  ,
SignedChar   
)

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

References EXPECT_EQ, Print(), and PrintPointer().

457  {
458  signed char* p = reinterpret_cast<signed char*>(0x1234);
459  EXPECT_EQ(PrintPointer(p), Print(p));
460  p = NULL;
461  EXPECT_EQ("NULL", Print(p));
462 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
testing::gtest_printers_test::TEST ( PrintCharPointerTest  ,
ConstSignedChar   
)

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

References EXPECT_EQ, Print(), and PrintPointer().

465  {
466  signed char* p = reinterpret_cast<signed char*>(0x1234);
467  EXPECT_EQ(PrintPointer(p), Print(p));
468  p = NULL;
469  EXPECT_EQ("NULL", Print(p));
470 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
testing::gtest_printers_test::TEST ( PrintCharPointerTest  ,
UnsignedChar   
)

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

References EXPECT_EQ, Print(), and PrintPointer().

473  {
474  unsigned char* p = reinterpret_cast<unsigned char*>(0x1234);
475  EXPECT_EQ(PrintPointer(p), Print(p));
476  p = NULL;
477  EXPECT_EQ("NULL", Print(p));
478 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
testing::gtest_printers_test::TEST ( PrintCharPointerTest  ,
ConstUnsignedChar   
)

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

References EXPECT_EQ, Print(), and PrintPointer().

481  {
482  const unsigned char* p = reinterpret_cast<const unsigned char*>(0x1234);
483  EXPECT_EQ(PrintPointer(p), Print(p));
484  p = NULL;
485  EXPECT_EQ("NULL", Print(p));
486 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
testing::gtest_printers_test::TEST ( PrintPointerToBuiltInTypeTest  ,
Bool   
)

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

References EXPECT_EQ, Print(), and PrintPointer().

491  {
492  bool* p = reinterpret_cast<bool*>(0xABCD);
493  EXPECT_EQ(PrintPointer(p), Print(p));
494  p = NULL;
495  EXPECT_EQ("NULL", Print(p));
496 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
testing::gtest_printers_test::TEST ( PrintPointerToBuiltInTypeTest  ,
Void   
)

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

References EXPECT_EQ, Print(), and PrintPointer().

499  {
500  void* p = reinterpret_cast<void*>(0xABCD);
501  EXPECT_EQ(PrintPointer(p), Print(p));
502  p = NULL;
503  EXPECT_EQ("NULL", Print(p));
504 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
testing::gtest_printers_test::TEST ( PrintPointerToBuiltInTypeTest  ,
ConstVoid   
)

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

References EXPECT_EQ, Print(), and PrintPointer().

507  {
508  const void* p = reinterpret_cast<const void*>(0xABCD);
509  EXPECT_EQ(PrintPointer(p), Print(p));
510  p = NULL;
511  EXPECT_EQ("NULL", Print(p));
512 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
testing::gtest_printers_test::TEST ( PrintPointerToPointerTest  ,
IntPointerPointer   
)

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

References EXPECT_EQ, Print(), and PrintPointer().

515  {
516  int** p = reinterpret_cast<int**>(0xABCD);
517  EXPECT_EQ(PrintPointer(p), Print(p));
518  p = NULL;
519  EXPECT_EQ("NULL", Print(p));
520 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
testing::gtest_printers_test::TEST ( PrintPointerTest  ,
NonMemberFunctionPointer   
)

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

References EXPECT_EQ, MyFunction(), Print(), and PrintPointer().

526  {
527  // We cannot directly cast &MyFunction to const void* because the
528  // standard disallows casting between pointers to functions and
529  // pointers to objects, and some compilers (e.g. GCC 3.4) enforce
530  // this limitation.
531  EXPECT_EQ(
532  PrintPointer(reinterpret_cast<const void*>(
533  reinterpret_cast<internal::BiggestInt>(&MyFunction))),
534  Print(&MyFunction));
535  int (*p)(bool) = NULL; // NOLINT
536  EXPECT_EQ("NULL", Print(p));
537 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
testing::gtest_printers_test::TEST ( PrintPointerTest  ,
MemberVariablePointer   
)

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

References EXPECT_TRUE, HasPrefix(), Print(), and value.

567  {
569  Print(sizeof(&Foo::value)) + "-byte object "));
570  int (Foo::*p) = NULL; // NOLINT
572  Print(sizeof(p)) + "-byte object "));
573 }
static const char *const value
Definition: Conv.cpp:50
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
AssertionResult HasPrefix(const StringType &str, const StringType &prefix)
testing::gtest_printers_test::TEST ( PrintPointerTest  ,
MemberFunctionPointer   
)

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

References EXPECT_TRUE, HasPrefix(), and Print().

579  {
580  EXPECT_TRUE(HasPrefix(Print(&Foo::MyMethod),
581  Print(sizeof(&Foo::MyMethod)) + "-byte object "));
582  EXPECT_TRUE(
583  HasPrefix(Print(&Foo::MyVirtualMethod),
584  Print(sizeof((&Foo::MyVirtualMethod))) + "-byte object "));
585  int (Foo::*p)(char) = NULL; // NOLINT
587  Print(sizeof(p)) + "-byte object "));
588 }
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
AssertionResult HasPrefix(const StringType &str, const StringType &prefix)
testing::gtest_printers_test::TEST ( PrintArrayTest  ,
OneDimensionalArray   
)

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

References a, EXPECT_EQ, and PrintArrayHelper().

600  {
601  int a[5] = { 1, 2, 3, 4, 5 };
602  EXPECT_EQ("{ 1, 2, 3, 4, 5 }", PrintArrayHelper(a));
603 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
char a
testing::gtest_printers_test::TEST ( PrintArrayTest  ,
TwoDimensionalArray   
)

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

References a, EXPECT_EQ, and PrintArrayHelper().

606  {
607  int a[2][5] = {
608  { 1, 2, 3, 4, 5 },
609  { 6, 7, 8, 9, 0 }
610  };
611  EXPECT_EQ("{ { 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 0 } }", PrintArrayHelper(a));
612 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
char a
testing::gtest_printers_test::TEST ( PrintArrayTest  ,
ConstArray   
)

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

References a, EXPECT_EQ, and PrintArrayHelper().

615  {
616  const bool a[1] = { false };
617  EXPECT_EQ("{ false }", PrintArrayHelper(a));
618 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
char a
testing::gtest_printers_test::TEST ( PrintArrayTest  ,
CharArrayWithNoTerminatingNul   
)

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

References a, EXPECT_EQ, and PrintArrayHelper().

621  {
622  // Array a contains '\0' in the middle and doesn't end with '\0'.
623  char a[] = { 'H', '\0', 'i' };
624  EXPECT_EQ("\"H\\0i\" (no terminating NUL)", PrintArrayHelper(a));
625 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
char a
testing::gtest_printers_test::TEST ( PrintArrayTest  ,
ConstCharArrayWithTerminatingNul   
)

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

References a, EXPECT_EQ, and PrintArrayHelper().

628  {
629  const char a[] = "\0Hi";
630  EXPECT_EQ("\"\\0Hi\"", PrintArrayHelper(a));
631 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
char a
testing::gtest_printers_test::TEST ( PrintArrayTest  ,
WCharArrayWithNoTerminatingNul   
)

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

References a, EXPECT_EQ, and PrintArrayHelper().

634  {
635  // Array a contains '\0' in the middle and doesn't end with '\0'.
636  const wchar_t a[] = { L'H', L'\0', L'i' };
637  EXPECT_EQ("L\"H\\0i\" (no terminating NUL)", PrintArrayHelper(a));
638 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
char a
testing::gtest_printers_test::TEST ( PrintArrayTest  ,
WConstCharArrayWithTerminatingNul   
)

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

References a, EXPECT_EQ, and PrintArrayHelper().

641  {
642  const wchar_t a[] = L"\0Hi";
643  EXPECT_EQ("L\"\\0Hi\"", PrintArrayHelper(a));
644 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
char a
testing::gtest_printers_test::TEST ( PrintArrayTest  ,
ObjectArray   
)

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

References a, EXPECT_EQ, and PrintArrayHelper().

647  {
648  string a[3] = { "Hi", "Hello", "Ni hao" };
649  EXPECT_EQ("{ \"Hi\", \"Hello\", \"Ni hao\" }", PrintArrayHelper(a));
650 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
char a
testing::gtest_printers_test::TEST ( PrintArrayTest  ,
BigArray   
)

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

References a, EXPECT_EQ, Print(), PrintArrayHelper(), s, string, and TEST().

653  {
654  int a[100] = { 1, 2, 3 };
655  EXPECT_EQ("{ 1, 2, 3, 0, 0, 0, 0, 0, ..., 0, 0, 0, 0, 0, 0, 0, 0 }",
656  PrintArrayHelper(a));
657 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
char a
testing::gtest_printers_test::TEST ( PrintStringTest  ,
StringInStdNamespace   
)

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

References EXPECT_EQ, Print(), s, and string.

672  {
673  const char s[] = "'\"?\\\a\b\f\n\0\r\t\v\x7F\xFF a";
674  const ::std::string str(s, sizeof(s));
675  EXPECT_EQ("\"'\\\"?\\\\\\a\\b\\f\\n\\0\\r\\t\\v\\x7F\\xFF a\\0\"",
676  Print(str));
677 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
const char * string
Definition: Conv.cpp:212
static set< string > s
testing::gtest_printers_test::TEST ( PrintStringTest  ,
StringAmbiguousHex   
)

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

References EXPECT_EQ, Print(), s, string, and TEST().

679  {
680  // "\x6BANANA" is ambiguous, it can be interpreted as starting with either of:
681  // '\x6', '\x6B', or '\x6BA'.
682 
683  // a hex escaping sequence following by a decimal digit
684  EXPECT_EQ("\"0\\x12\" \"3\"", Print(::std::string("0\x12" "3")));
685  // a hex escaping sequence following by a hex digit (lower-case)
686  EXPECT_EQ("\"mm\\x6\" \"bananas\"", Print(::std::string("mm\x6" "bananas")));
687  // a hex escaping sequence following by a hex digit (upper-case)
688  EXPECT_EQ("\"NOM\\x6\" \"BANANA\"", Print(::std::string("NOM\x6" "BANANA")));
689  // a hex escaping sequence following by a non-xdigit
690  EXPECT_EQ("\"!\\x5-!\"", Print(::std::string("!\x5-!")));
691 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
const char * string
Definition: Conv.cpp:212
testing::gtest_printers_test::TEST ( PrintTypeWithGenericStreamingTest  ,
NonTemplateType   
)

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

References a, EXPECT_EQ, and Print().

742  {
743  AllowsGenericStreaming a;
744  EXPECT_EQ("AllowsGenericStreaming", Print(a));
745 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
char a
testing::gtest_printers_test::TEST ( PrintTypeWithGenericStreamingTest  ,
TemplateType   
)

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

References a, EXPECT_EQ, and Print().

759  {
760  AllowsGenericStreamingTemplate<int> a;
761  EXPECT_EQ("AllowsGenericStreamingTemplate", Print(a));
762 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
char a
testing::gtest_printers_test::TEST ( PrintTypeWithGenericStreamingTest  ,
TypeImplicitlyConvertible   
)

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

References a, EXPECT_EQ, Print(), and TEST().

780  {
781  AllowsGenericStreamingAndImplicitConversionTemplate<int> a;
782  EXPECT_EQ("AllowsGenericStreamingAndImplicitConversionTemplate", Print(a));
783 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
char a
testing::gtest_printers_test::TEST ( PrintStlContainerTest  ,
EmptyDeque   
)

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

References folly::empty(), EXPECT_EQ, and Print().

804  {
806  EXPECT_EQ("{}", Print(empty));
807 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
constexpr auto empty(C const &c) -> decltype(c.empty())
Definition: Access.h:55
Definition: Traits.h:590
testing::gtest_printers_test::TEST ( PrintStlContainerTest  ,
NonEmptyDeque   
)

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

References a, ASSERT_EQ, ASSERT_NE, EXPECT_EQ, EXPECT_TRUE, i, Print(), and TEST().

809  {
810  deque<int> non_empty;
811  non_empty.push_back(1);
812  non_empty.push_back(3);
813  EXPECT_EQ("{ 1, 3 }", Print(non_empty));
814 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
Definition: Traits.h:590
testing::gtest_printers_test::TEST ( PrintStlContainerTest  ,
List   
)

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

References a, EXPECT_EQ, Print(), and strings.

877  {
878  const string a[] = {
879  "hello",
880  "world"
881  };
882  const list<string> strings(a, a + 2);
883  EXPECT_EQ("{ \"hello\", \"world\" }", Print(strings));
884 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
char a
static vector< fbstring > strings
testing::gtest_printers_test::TEST ( PrintStlContainerTest  ,
Map   
)

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

References EXPECT_EQ, and Print().

886  {
887  map<int, bool> map1;
888  map1[1] = true;
889  map1[5] = false;
890  map1[3] = true;
891  EXPECT_EQ("{ (1, true), (3, true), (5, false) }", Print(map1));
892 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
Definition: Traits.h:594
testing::gtest_printers_test::TEST ( PrintStlContainerTest  ,
MultiMap   
)

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

References EXPECT_EQ, and Print().

894  {
895  multimap<bool, int> map1;
896  // The make_pair template function would deduce the type as
897  // pair<bool, int> here, and since the key part in a multimap has to
898  // be constant, without a templated ctor in the pair class (as in
899  // libCstd on Solaris), make_pair call would fail to compile as no
900  // implicit conversion is found. Thus explicit typename is used
901  // here instead.
902  map1.insert(pair<const bool, int>(true, 0));
903  map1.insert(pair<const bool, int>(true, 1));
904  map1.insert(pair<const bool, int>(false, 2));
905  EXPECT_EQ("{ (false, 2), (true, 0), (true, 1) }", Print(map1));
906 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
Definition: Traits.h:577
testing::gtest_printers_test::TEST ( PrintStlContainerTest  ,
Set   
)

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

References a, EXPECT_EQ, and Print().

908  {
909  const unsigned int a[] = { 3, 0, 5 };
910  set<unsigned int> set1(a, a + 3);
911  EXPECT_EQ("{ 0, 3, 5 }", Print(set1));
912 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
char a
Definition: Traits.h:592
testing::gtest_printers_test::TEST ( PrintStlContainerTest  ,
MultiSet   
)

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

References a, EXPECT_EQ, Print(), and TEST().

914  {
915  const int a[] = { 1, 1, 2, 5, 1 };
916  multiset<int> set1(a, a + 5);
917  EXPECT_EQ("{ 1, 1, 1, 2, 5 }", Print(set1));
918 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
char a
testing::gtest_printers_test::TEST ( PrintStlContainerTest  ,
Pair   
)

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

References EXPECT_EQ, and Print().

931  {
932  pair<const bool, int> p(true, 5);
933  EXPECT_EQ("(true, 5)", Print(p));
934 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
Definition: Traits.h:577
testing::gtest_printers_test::TEST ( PrintStlContainerTest  ,
Vector   
)

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

References EXPECT_EQ, Print(), and v.

936  {
937  vector<int> v;
938  v.push_back(1);
939  v.push_back(2);
940  EXPECT_EQ("{ 1, 2 }", Print(v));
941 }
auto v
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
Definition: Traits.h:588
testing::gtest_printers_test::TEST ( PrintStlContainerTest  ,
LongSequence   
)

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

References a, EXPECT_EQ, Print(), and v.

943  {
944  const int a[100] = { 1, 2, 3 };
945  const vector<int> v(a, a + 100);
946  EXPECT_EQ("{ 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "
947  "0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... }", Print(v));
948 }
auto v
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
char a
Definition: Traits.h:588
testing::gtest_printers_test::TEST ( PrintStlContainerTest  ,
NestedContainer   
)

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

References EXPECT_EQ, Print(), and v.

950  {
951  const int a1[] = { 1, 2 };
952  const int a2[] = { 3, 4, 5 };
953  const list<int> l1(a1, a1 + 2);
954  const list<int> l2(a2, a2 + 3);
955 
957  v.push_back(l1);
958  v.push_back(l2);
959  EXPECT_EQ("{ { 1, 2 }, { 3, 4, 5 } }", Print(v));
960 }
auto v
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
Definition: Traits.h:588
testing::gtest_printers_test::TEST ( PrintStlContainerTest  ,
OneDimensionalNativeArray   
)

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

References a, b, EXPECT_EQ, and Print().

962  {
963  const int a[3] = { 1, 2, 3 };
964  NativeArray<int> b(a, 3, RelationToSourceReference());
965  EXPECT_EQ("{ 1, 2, 3 }", Print(b));
966 }
char b
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
char a
testing::gtest_printers_test::TEST ( PrintStlContainerTest  ,
TwoDimensionalNativeArray   
)

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

References a, b, EXPECT_EQ, and Print().

968  {
969  const int a[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } };
970  NativeArray<int[3]> b(a, 2, RelationToSourceReference());
971  EXPECT_EQ("{ { 1, 2, 3 }, { 4, 5, 6 } }", Print(b));
972 }
char b
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
char a
testing::gtest_printers_test::TEST ( PrintStlContainerTest  ,
Iterator   
)

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

References EXPECT_EQ, and Print().

980  {
981  iterator it = {};
982  EXPECT_EQ("1-byte object <00>", Print(it));
983 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintStlContainerTest  ,
ConstIterator   
)

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

References EXPECT_EQ, std::tr1::make_tuple(), Print(), PrintPointer(), and TEST().

991  {
992  const_iterator it = {};
993  EXPECT_EQ("1-byte object <00>", Print(it));
994 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintUnprintableTypeTest  ,
InGlobalNamespace   
)

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

References EXPECT_EQ, and Print().

1117  {
1118  EXPECT_EQ("1-byte object <00>",
1120 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintUnprintableTypeTest  ,
InUserNamespace   
)

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

References EXPECT_EQ, and Print().

1123  {
1124  EXPECT_EQ("16-byte object <EF-12 00-00 34-AB 00-00 00-00 00-00 00-00 00-00>",
1126 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintUnpritableTypeTest  ,
BigObject   
)

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

References EXPECT_EQ, and Print().

1135  {
1136  EXPECT_EQ("257-byte object <00-00 00-00 00-00 00-00 00-00 00-00 "
1137  "00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 "
1138  "00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 "
1139  "00-00 00-00 00-00 00-00 00-00 00-00 ... 00-00 00-00 00-00 "
1140  "00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 "
1141  "00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 "
1142  "00-00 00-00 00-00 00-00 00-00 00-00 00-00 00-00 00>",
1143  Print(Big()));
1144 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintStreamableTypeTest  ,
InGlobalNamespace   
)

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

References EXPECT_EQ, Print(), and x.

1149  {
1151  EXPECT_EQ("StreamableInGlobal", Print(x));
1152  EXPECT_EQ("StreamableInGlobal*", Print(&x));
1153 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
const int x
testing::gtest_printers_test::TEST ( PrintStreamableTypeTest  ,
TemplateTypeInUserNamespace   
)

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

References EXPECT_EQ, and Print().

1156  {
1157  EXPECT_EQ("StreamableTemplateInFoo: 0",
1159 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintPrintableTypeTest  ,
InUserNamespace   
)

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

References EXPECT_EQ, and Print().

1162  {
1163  EXPECT_EQ("PrintableViaPrintTo: 0",
1165 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintPrintableTypeTest  ,
PointerInUserNamespace   
)

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

References EXPECT_EQ, Print(), and x.

1169  {
1170  ::foo::PointerPrintable x;
1171  EXPECT_EQ("PointerPrintable*", Print(&x));
1172 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
const int x
testing::gtest_printers_test::TEST ( PrintPrintableTypeTest  ,
TemplateInUserNamespace   
)

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

References EXPECT_EQ, and Print().

1175  {
1176  EXPECT_EQ("PrintableViaPrintToTemplate: 5",
1178 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( PrintReferenceTest  ,
PrintsAddressAndValue   
)

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

References a, EXPECT_EQ, PrintByRef(), PrintPointer(), and x.

1182  {
1183  int n = 5;
1184  EXPECT_EQ("@" + PrintPointer(&n) + " 5", PrintByRef(n));
1185 
1186  int a[2][3] = {
1187  { 0, 1, 2 },
1188  { 3, 4, 5 }
1189  };
1190  EXPECT_EQ("@" + PrintPointer(a) + " { { 0, 1, 2 }, { 3, 4, 5 } }",
1191  PrintByRef(a));
1192 
1193  const ::foo::UnprintableInFoo x;
1194  EXPECT_EQ("@" + PrintPointer(&x) + " 16-byte object "
1195  "<EF-12 00-00 34-AB 00-00 00-00 00-00 00-00 00-00>",
1196  PrintByRef(x));
1197 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
const int x
static string PrintPointer(const void *p)
string PrintByRef(const T &value)
char a
testing::gtest_printers_test::TEST ( PrintReferenceTest  ,
HandlesFunctionPointer   
)

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

References EXPECT_EQ, MyFunction(), PrintByRef(), and PrintPointer().

1201  {
1202  void (*fp)(int n) = &MyFunction;
1203  const string fp_pointer_string =
1204  PrintPointer(reinterpret_cast<const void*>(&fp));
1205  // We cannot directly cast &MyFunction to const void* because the
1206  // standard disallows casting between pointers to functions and
1207  // pointers to objects, and some compilers (e.g. GCC 3.4) enforce
1208  // this limitation.
1209  const string fp_string = PrintPointer(reinterpret_cast<const void*>(
1210  reinterpret_cast<internal::BiggestInt>(fp)));
1211  EXPECT_EQ("@" + fp_pointer_string + " " + fp_string,
1212  PrintByRef(fp));
1213 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
string PrintByRef(const T &value)
testing::gtest_printers_test::TEST ( PrintReferenceTest  ,
HandlesMemberFunctionPointer   
)

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

References ch, EXPECT_TRUE, HasPrefix(), Print(), PrintByRef(), and PrintPointer().

1217  {
1218  int (Foo::*p)(char ch) = &Foo::MyMethod;
1220  PrintByRef(p),
1221  "@" + PrintPointer(reinterpret_cast<const void*>(&p)) + " " +
1222  Print(sizeof(p)) + "-byte object "));
1223 
1224  char (Foo::*p2)(int n) = &Foo::MyVirtualMethod;
1226  PrintByRef(p2),
1227  "@" + PrintPointer(reinterpret_cast<const void*>(&p2)) + " " +
1228  Print(sizeof(p2)) + "-byte object "));
1229 }
static string PrintPointer(const void *p)
auto ch
string PrintByRef(const T &value)
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
AssertionResult HasPrefix(const StringType &str, const StringType &prefix)
testing::gtest_printers_test::TEST ( PrintReferenceTest  ,
HandlesMemberVariablePointer   
)

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

References EXPECT_TRUE, HasPrefix(), Print(), PrintByRef(), PrintPointer(), and value.

1233  {
1234  int (Foo::*p) = &Foo::value; // NOLINT
1236  PrintByRef(p),
1237  "@" + PrintPointer(&p) + " " + Print(sizeof(p)) + "-byte object "));
1238 }
static string PrintPointer(const void *p)
string PrintByRef(const T &value)
static const char *const value
Definition: Conv.cpp:50
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
AssertionResult HasPrefix(const StringType &str, const StringType &prefix)
testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest  ,
WorksForScalar   
)

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

References EXPECT_STREQ, and testing::internal::FormatForComparisonFailureMessage().

1245  {
1246  EXPECT_STREQ("123",
1247  FormatForComparisonFailureMessage(123, 124).c_str());
1248 }
std::string FormatForComparisonFailureMessage(const T1 &value, const T2 &)
#define EXPECT_STREQ(s1, s2)
Definition: gtest.h:1995
testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest  ,
WorksForNonCharPointer   
)

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

References EXPECT_EQ, testing::internal::FormatForComparisonFailureMessage(), and PrintPointer().

1251  {
1252  int n = 0;
1253  EXPECT_EQ(PrintPointer(&n),
1254  FormatForComparisonFailureMessage(&n, &n).c_str());
1255 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
std::string FormatForComparisonFailureMessage(const T1 &value, const T2 &)
testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest  ,
FormatsNonCharArrayAsPointer   
)

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

References EXPECT_EQ, testing::internal::FormatForComparisonFailureMessage(), and PrintPointer().

1258  {
1259  // In expression 'array == x', 'array' is compared by pointer.
1260  // Therefore we want to print an array operand as a pointer.
1261  int n[] = { 1, 2, 3 };
1263  FormatForComparisonFailureMessage(n, n).c_str());
1264 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
std::string FormatForComparisonFailureMessage(const T1 &value, const T2 &)
testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest  ,
WorksForCharPointerVsPointer   
)

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

References ch, EXPECT_EQ, testing::internal::FormatForComparisonFailureMessage(), PrintPointer(), and s.

1271  {
1272  // In expression 'p == x', where 'p' and 'x' are (const or not) char
1273  // pointers, the operands are compared by pointer. Therefore we
1274  // want to print 'p' as a pointer instead of a C string (we don't
1275  // even know if it's supposed to point to a valid C string).
1276 
1277  // const char*
1278  const char* s = "hello";
1280  FormatForComparisonFailureMessage(s, s).c_str());
1281 
1282  // char*
1283  char ch = 'a';
1284  EXPECT_EQ(PrintPointer(&ch),
1285  FormatForComparisonFailureMessage(&ch, &ch).c_str());
1286 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
std::string FormatForComparisonFailureMessage(const T1 &value, const T2 &)
auto ch
static set< string > s
testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest  ,
WorksForWCharPointerVsPointer   
)

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

References ch, EXPECT_EQ, EXPECT_STREQ, testing::internal::FormatForComparisonFailureMessage(), PrintPointer(), s, and TEST().

1289  {
1290  // In expression 'p == x', where 'p' and 'x' are (const or not) char
1291  // pointers, the operands are compared by pointer. Therefore we
1292  // want to print 'p' as a pointer instead of a wide C string (we don't
1293  // even know if it's supposed to point to a valid wide C string).
1294 
1295  // const wchar_t*
1296  const wchar_t* s = L"hello";
1298  FormatForComparisonFailureMessage(s, s).c_str());
1299 
1300  // wchar_t*
1301  wchar_t ch = L'a';
1302  EXPECT_EQ(PrintPointer(&ch),
1303  FormatForComparisonFailureMessage(&ch, &ch).c_str());
1304 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
std::string FormatForComparisonFailureMessage(const T1 &value, const T2 &)
auto ch
static set< string > s
testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest  ,
WorksForCharPointerVsStdString   
)

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

References EXPECT_STREQ, testing::internal::FormatForComparisonFailureMessage(), s, string, and TEST().

1325  {
1326  const char* s = "hello \"world";
1327  EXPECT_STREQ("\"hello \\\"world\"", // The string content should be escaped.
1329 
1330  // char*
1331  char str[] = "hi\1";
1332  char* p = str;
1333  EXPECT_STREQ("\"hi\\x1\"", // The string content should be escaped.
1335 }
std::string FormatForComparisonFailureMessage(const T1 &value, const T2 &)
#define EXPECT_STREQ(s1, s2)
Definition: gtest.h:1995
const char * string
Definition: Conv.cpp:212
static set< string > s
testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest  ,
WorksForCharArrayVsPointer   
)

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

References EXPECT_EQ, testing::internal::FormatForComparisonFailureMessage(), and PrintPointer().

1372  {
1373  char str[] = "hi \"world\"";
1374  char* p = NULL;
1375  EXPECT_EQ(PrintPointer(str),
1376  FormatForComparisonFailureMessage(str, p).c_str());
1377 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
std::string FormatForComparisonFailureMessage(const T1 &value, const T2 &)
testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest  ,
WorksForCharArrayVsCharArray   
)

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

References EXPECT_EQ, testing::internal::FormatForComparisonFailureMessage(), and PrintPointer().

1380  {
1381  const char str[] = "hi \"world\"";
1382  EXPECT_EQ(PrintPointer(str),
1383  FormatForComparisonFailureMessage(str, str).c_str());
1384 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
std::string FormatForComparisonFailureMessage(const T1 &value, const T2 &)
testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest  ,
WorksForWCharArrayVsPointer   
)

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

References EXPECT_EQ, testing::internal::FormatForComparisonFailureMessage(), and PrintPointer().

1387  {
1388  wchar_t str[] = L"hi \"world\"";
1389  wchar_t* p = NULL;
1390  EXPECT_EQ(PrintPointer(str),
1391  FormatForComparisonFailureMessage(str, p).c_str());
1392 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
std::string FormatForComparisonFailureMessage(const T1 &value, const T2 &)
testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest  ,
WorksForWCharArrayVsWCharArray   
)

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

References EXPECT_EQ, EXPECT_STREQ, testing::internal::FormatForComparisonFailureMessage(), PrintPointer(), and TEST().

1395  {
1396  const wchar_t str[] = L"hi \"world\"";
1397  EXPECT_EQ(PrintPointer(str),
1398  FormatForComparisonFailureMessage(str, str).c_str());
1399 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
std::string FormatForComparisonFailureMessage(const T1 &value, const T2 &)
testing::gtest_printers_test::TEST ( FormatForComparisonFailureMessageTest  ,
WorksForCharArrayVsStdString   
)

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

References EXPECT_STREQ, testing::internal::FormatForComparisonFailureMessage(), string, and TEST().

1415  {
1416  const char str[] = "hi \"world\"";
1417  EXPECT_STREQ("\"hi \\\"world\\\"\"", // The content should be escaped.
1419 }
std::string FormatForComparisonFailureMessage(const T1 &value, const T2 &)
#define EXPECT_STREQ(s1, s2)
Definition: gtest.h:1995
const char * string
Definition: Conv.cpp:212
testing::gtest_printers_test::TEST ( PrintToStringTest  ,
WorksForScalar   
)

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

References EXPECT_PRINT_TO_STRING_.

1448  {
1449  EXPECT_PRINT_TO_STRING_(123, "123");
1450 }
#define EXPECT_PRINT_TO_STRING_(value, expected_string)
testing::gtest_printers_test::TEST ( PrintToStringTest  ,
WorksForPointerToConstChar   
)

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

References EXPECT_PRINT_TO_STRING_.

1452  {
1453  const char* p = "hello";
1454  EXPECT_PRINT_TO_STRING_(p, "\"hello\"");
1455 }
#define EXPECT_PRINT_TO_STRING_(value, expected_string)
testing::gtest_printers_test::TEST ( PrintToStringTest  ,
WorksForPointerToNonConstChar   
)

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

References EXPECT_PRINT_TO_STRING_, and s.

1457  {
1458  char s[] = "hello";
1459  char* p = s;
1460  EXPECT_PRINT_TO_STRING_(p, "\"hello\"");
1461 }
#define EXPECT_PRINT_TO_STRING_(value, expected_string)
static set< string > s
testing::gtest_printers_test::TEST ( PrintToStringTest  ,
EscapesForPointerToConstChar   
)

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

References EXPECT_PRINT_TO_STRING_.

1463  {
1464  const char* p = "hello\n";
1465  EXPECT_PRINT_TO_STRING_(p, "\"hello\\n\"");
1466 }
#define EXPECT_PRINT_TO_STRING_(value, expected_string)
testing::gtest_printers_test::TEST ( PrintToStringTest  ,
EscapesForPointerToNonConstChar   
)

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

References EXPECT_PRINT_TO_STRING_, and s.

1468  {
1469  char s[] = "hello\1";
1470  char* p = s;
1471  EXPECT_PRINT_TO_STRING_(p, "\"hello\\x1\"");
1472 }
#define EXPECT_PRINT_TO_STRING_(value, expected_string)
static set< string > s
testing::gtest_printers_test::TEST ( PrintToStringTest  ,
WorksForArray   
)

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

References EXPECT_PRINT_TO_STRING_.

1474  {
1475  int n[3] = { 1, 2, 3 };
1476  EXPECT_PRINT_TO_STRING_(n, "{ 1, 2, 3 }");
1477 }
#define EXPECT_PRINT_TO_STRING_(value, expected_string)
testing::gtest_printers_test::TEST ( PrintToStringTest  ,
WorksForCharArray   
)

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

References EXPECT_PRINT_TO_STRING_, and s.

1479  {
1480  char s[] = "hello";
1481  EXPECT_PRINT_TO_STRING_(s, "\"hello\"");
1482 }
#define EXPECT_PRINT_TO_STRING_(value, expected_string)
static set< string > s
testing::gtest_printers_test::TEST ( PrintToStringTest  ,
WorksForCharArrayWithEmbeddedNul   
)

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

References EXPECT_PRINT_TO_STRING_.

1484  {
1485  const char str_with_nul[] = "hello\0 world";
1486  EXPECT_PRINT_TO_STRING_(str_with_nul, "\"hello\\0 world\"");
1487 
1488  char mutable_str_with_nul[] = "hello\0 world";
1489  EXPECT_PRINT_TO_STRING_(mutable_str_with_nul, "\"hello\\0 world\"");
1490 }
#define EXPECT_PRINT_TO_STRING_(value, expected_string)
testing::gtest_printers_test::TEST ( UniversalTersePrintTest  ,
WorksForNonReference   
)

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

References EXPECT_EQ, and testing::internal::UniversalTersePrint().

1494  {
1495  ::std::stringstream ss;
1496  UniversalTersePrint(123, &ss);
1497  EXPECT_EQ("123", ss.str());
1498 }
void UniversalTersePrint(const T &value,::std::ostream *os)
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( UniversalTersePrintTest  ,
WorksForReference   
)

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

References EXPECT_EQ, and testing::internal::UniversalTersePrint().

1500  {
1501  const int& n = 123;
1502  ::std::stringstream ss;
1503  UniversalTersePrint(n, &ss);
1504  EXPECT_EQ("123", ss.str());
1505 }
void UniversalTersePrint(const T &value,::std::ostream *os)
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( UniversalTersePrintTest  ,
WorksForCString   
)

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

References EXPECT_EQ, and testing::internal::UniversalTersePrint().

1507  {
1508  const char* s1 = "abc";
1509  ::std::stringstream ss1;
1510  UniversalTersePrint(s1, &ss1);
1511  EXPECT_EQ("\"abc\"", ss1.str());
1512 
1513  char* s2 = const_cast<char*>(s1);
1514  ::std::stringstream ss2;
1515  UniversalTersePrint(s2, &ss2);
1516  EXPECT_EQ("\"abc\"", ss2.str());
1517 
1518  const char* s3 = NULL;
1519  ::std::stringstream ss3;
1520  UniversalTersePrint(s3, &ss3);
1521  EXPECT_EQ("NULL", ss3.str());
1522 }
void UniversalTersePrint(const T &value,::std::ostream *os)
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gtest_printers_test::TEST ( UniversalPrintTest  ,
WorksForNonReference   
)

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

References EXPECT_EQ, and testing::internal::UniversalPrint().

1524  {
1525  ::std::stringstream ss;
1526  UniversalPrint(123, &ss);
1527  EXPECT_EQ("123", ss.str());
1528 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
void UniversalPrint(const T &value,::std::ostream *os)
testing::gtest_printers_test::TEST ( UniversalPrintTest  ,
WorksForReference   
)

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

References EXPECT_EQ, and testing::internal::UniversalPrint().

1530  {
1531  const int& n = 123;
1532  ::std::stringstream ss;
1533  UniversalPrint(n, &ss);
1534  EXPECT_EQ("123", ss.str());
1535 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
void UniversalPrint(const T &value,::std::ostream *os)
testing::gtest_printers_test::TEST ( UniversalPrintTest  ,
WorksForCString   
)

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

References EXPECT_EQ, PrintPointer(), and testing::internal::UniversalPrint().

1537  {
1538  const char* s1 = "abc";
1539  ::std::stringstream ss1;
1540  UniversalPrint(s1, &ss1);
1541  EXPECT_EQ(PrintPointer(s1) + " pointing to \"abc\"", string(ss1.str()));
1542 
1543  char* s2 = const_cast<char*>(s1);
1544  ::std::stringstream ss2;
1545  UniversalPrint(s2, &ss2);
1546  EXPECT_EQ(PrintPointer(s2) + " pointing to \"abc\"", string(ss2.str()));
1547 
1548  const char* s3 = NULL;
1549  ::std::stringstream ss3;
1550  UniversalPrint(s3, &ss3);
1551  EXPECT_EQ("NULL", ss3.str());
1552 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
static string PrintPointer(const void *p)
void UniversalPrint(const T &value,::std::ostream *os)
testing::gtest_printers_test::TEST ( UniversalPrintTest  ,
WorksForCharArray   
)

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

References ASSERT_EQ, EXPECT_EQ, std::tr1::make_tuple(), and testing::internal::UniversalPrint().

Referenced by testing::gtest_printers_test::Big::Big(), testing::gtest_printers_test::Foo::MyVirtualMethod(), testing::gtest_printers_test::AllowsGenericStreamingAndImplicitConversionTemplate< T >::operator bool(), PrintPointer(), TEST(), and foo::StreamableTemplateInFoo< T >::value().

1554  {
1555  const char str[] = "\"Line\0 1\"\nLine 2";
1556  ::std::stringstream ss1;
1557  UniversalPrint(str, &ss1);
1558  EXPECT_EQ("\"\\\"Line\\0 1\\\"\\nLine 2\"", ss1.str());
1559 
1560  const char mutable_str[] = "\"Line\0 1\"\nLine 2";
1561  ::std::stringstream ss2;
1562  UniversalPrint(mutable_str, &ss2);
1563  EXPECT_EQ("\"\\\"Line\\0 1\\\"\\nLine 2\"", ss2.str());
1564 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
void UniversalPrint(const T &value,::std::ostream *os)