proxygen
gtest-printers_test.cc File Reference
#include "gtest/gtest-printers.h"
#include <ctype.h>
#include <limits.h>
#include <string.h>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include "gtest/gtest.h"

Go to the source code of this file.

Classes

class  BiggestIntConvertible
 
class  UnprintableTemplateInGlobal< T >
 
class  StreamableInGlobal
 
class  foo::UnprintableInFoo
 
struct  foo::PrintableViaPrintTo
 
struct  foo::PointerPrintable
 
class  foo::PrintableViaPrintToTemplate< T >
 
class  foo::StreamableTemplateInFoo< T >
 
struct  testing::gtest_printers_test::Foo
 
class  testing::gtest_printers_test::AllowsGenericStreaming
 
class  testing::gtest_printers_test::AllowsGenericStreamingTemplate< T >
 
class  testing::gtest_printers_test::AllowsGenericStreamingAndImplicitConversionTemplate< T >
 
struct  testing::gtest_printers_test::iterator
 
struct  testing::gtest_printers_test::const_iterator
 
struct  testing::gtest_printers_test::Big
 

Namespaces

 foo
 
 testing
 
 testing::gtest_printers_test
 

Macros

#define EXPECT_PRINT_TO_STRING_(value, expected_string)
 

Enumerations

enum  AnonymousEnum {
  kAE1 = -1, kAE2 = 1, kAE1 = -1, kAE2 = 1,
  kAE1 = -1, kAE2 = 1
}
 
enum  EnumWithoutPrinter {
  kEWP1 = -2, kEWP2 = 42, kEWP1 = -2, kEWP2 = 42,
  kEWP1 = -2, kEWP2 = 42
}
 
enum  EnumWithStreaming { kEWS1 = 10, kEWS1 = 10, kEWS1 = 10 }
 
enum  EnumWithPrintTo { kEWPT1 = 1, kEWPT1 = 1, kEWPT1 = 1 }
 

Functions

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

Macro Definition Documentation

#define EXPECT_PRINT_TO_STRING_ (   value,
  expected_string 
)
Value:
EXPECT_TRUE(PrintToString(value) == (expected_string)) \
<< " where " #value " prints as " << (PrintToString(value))
::std::string PrintToString(const T &value)
static const char *const value
Definition: Conv.cpp:50
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859

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

Enumeration Type Documentation

Enumerator
kAE1 
kAE2 
kAE1 
kAE2 
kAE1 
kAE2 

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

68  {
69  kAE1 = -1,
70  kAE2 = 1
71 };
Enumerator
kEWP1 
kEWP2 
kEWP1 
kEWP2 
kEWP1 
kEWP2 

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

74  {
75  kEWP1 = -2,
76  kEWP2 = 42
77 };
Enumerator
kEWPT1 
kEWPT1 
kEWPT1 

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

89  {
90  kEWPT1 = 1
91 };
Enumerator
kEWS1 
kEWS1 
kEWS1 

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

80  {
81  kEWS1 = 10
82 };

Function Documentation

std::ostream& operator<< ( std::ostream &  os,
EnumWithStreaming  e 
)

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

References kEWS1.

84  {
85  return os << (e == kEWS1 ? "kEWS1" : "invalid");
86 }
void operator<< ( ::std::ostream &  os,
const StreamableInGlobal  
)
inline

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

118  {
119  os << "StreamableInGlobal";
120 }
void operator<< ( ::std::ostream &  os,
const StreamableInGlobal  
)

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

122  {
123  os << "StreamableInGlobal*";
124 }
void PrintTo ( EnumWithPrintTo  e,
std::ostream *  os 
)

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

References kEWPT1.

93  {
94  *os << (e == kEWPT1 ? "kEWPT1" : "invalid");
95 }