tesseract v5.3.3.20231005
testing::internal Namespace Reference

Namespaces

namespace  edit_distance
 
namespace  gmockpp
 
namespace  internal_stream_operator_without_lexical_name_lookup
 
namespace  posix
 

Classes

struct  ActionImpl
 
struct  ActionImpl< R(Args...), Impl >
 
class  AssertHelper
 
class  AssignAction
 
class  Base
 
class  BriefUnitTestResultPrinter
 
class  BuiltInDefaultValue
 
class  BuiltInDefaultValue< const T >
 
class  BuiltInDefaultValue< T * >
 
struct  BuiltInDefaultValueGetter
 
struct  BuiltInDefaultValueGetter< T, false >
 
struct  ByMoveWrapper
 
class  CartesianProductGenerator
 
class  CartesianProductHolder
 
class  Castable
 
struct  CodeLocation
 
class  ConstAndNonConstCastable
 
class  ConstCastable
 
struct  ConstCharPtr
 
struct  ConstRef
 
struct  ConstRef< T & >
 
struct  ContainerPrinter
 
struct  ConvertibleToIntegerPrinter
 
struct  ConvertibleToStringViewPrinter
 
struct  DefaultNameGenerator
 
struct  DeleteArgAction
 
class  Derived
 
struct  DoAllAction
 
class  DoDefaultAction
 
struct  DoubleSequence
 
struct  DoubleSequence< false, IndexSequence< I... >, sizeofT >
 
struct  DoubleSequence< true, IndexSequence< I... >, sizeofT >
 
struct  ElemFromList
 
struct  ElemFromListImpl
 
struct  ElemFromListImpl< IndexSequence< I... > >
 
class  EnvironmentInvocationCatcher
 
class  EqHelper
 
class  EventRecordingListener
 
class  EventRecordingListener2
 
struct  ExcessiveArg
 
class  ExpectationTester
 
class  FailureReporterInterface
 
struct  faketype
 
struct  FallbackPrinter
 
class  FinalSuccessChecker
 
struct  FindFirstPrinter
 
struct  FindFirstPrinter< T, decltype(Printer::PrintValue(std::declval< const T & >(), nullptr)), Printer, Printers... >
 
class  FlatTuple
 
struct  FlatTupleBase
 
struct  FlatTupleBase< FlatTuple< T... >, IndexSequence< Idx... > >
 
struct  FlatTupleConstructTag
 
struct  FlatTupleElemBase
 
struct  FlatTupleElemBase< FlatTuple< T... >, I >
 
class  FloatingPoint
 
class  FormatForComparison
 
class  FormatForComparison< ToPrint[N], OtherOperand >
 
struct  Function
 
struct  Function< R(Args...)>
 
struct  FunctionPointerPrinter
 
struct  GenerateTypeList
 
class  GoogleTestFailureReporter
 
class  GTestLog
 
class  GTestMutexLock
 
class  HasDebugStringAndShortDebugString
 
struct  Ignore
 
class  IgnoredValue
 
class  IgnoreResultAction
 
struct  ImplBase
 
struct  IndexSequence
 
struct  InvokeArgumentAction
 
struct  InvokeMethodAction
 
struct  InvokeMethodWithoutArgsAction
 
struct  InvokeWithoutArgsAction
 
struct  is_proxy_type_list
 
struct  is_proxy_type_list< ProxyTypeList< Ts... > >
 
struct  IsHashTable
 
struct  IsRecursiveContainer
 
struct  IsRecursiveContainerImpl
 
struct  IsRecursiveContainerImpl< C, false >
 
struct  IsRecursiveContainerImpl< C, true >
 
class  JsonUnitTestResultPrinter
 
struct  KindOf
 
struct  LessByName
 
class  ListenerTest
 
struct  MakeIndexSequenceImpl
 
struct  MakeIndexSequenceImpl< 0 >
 
struct  MarkAsIgnored
 
class  MaxBipartiteMatchState
 
class  Mutex
 
class  NaggyMockImpl
 
struct  NameGeneratorSelector
 
class  NativeArray
 
class  NiceMockImpl
 
class  NoDefaultContructor
 
struct  None
 
class  ParameterizedTestFactory
 
class  ParameterizedTestSuiteInfo
 
class  ParameterizedTestSuiteInfoBase
 
class  ParameterizedTestSuiteRegistry
 
class  ParamGenerator
 
class  ParamGeneratorInterface
 
class  ParamIterator
 
class  ParamIteratorInterface
 
struct  PointerPrinter
 
class  PrettyUnitTestResultPrinter
 
struct  ProtobufPrinter
 
struct  ProxyTypeList
 
class  Random
 
class  RangeGenerator
 
struct  RawBytesPrinter
 
class  RE
 
struct  RelationToSourceCopy
 
struct  RelationToSourceReference
 
struct  RemoveConstFromKey
 
struct  RemoveConstFromKey< std::pair< const K, V > >
 
class  ReturnAction
 
struct  ReturnArgAction
 
struct  ReturnNewAction
 
class  ReturnNullAction
 
struct  ReturnPointeeAction
 
class  ReturnRefAction
 
class  ReturnRefOfCopyAction
 
class  ReturnRoundRobinAction
 
class  ReturnVoidAction
 
struct  SaveArgAction
 
struct  SaveArgPointeeAction
 
class  ScopedPrematureExitFile
 
struct  SetArgRefereeAction
 
struct  SetArgumentPointeeAction
 
struct  SetArrayArgumentAction
 
class  SetErrnoAndReturnAction
 
class  StlContainerView
 
class  StlContainerView< ::std::tuple< ElementPointer, Size > >
 
class  StlContainerView< Element[N]>
 
class  StrictMockImpl
 
class  String
 
struct  SuiteApiResolver
 
struct  Templates
 
struct  Templates< Head_ >
 
struct  TemplateSel
 
class  TestEventListenersAccessor
 
class  TestEventRepeater
 
class  TestFactoryBase
 
class  TestFactoryImpl
 
class  TestMetaFactory
 
class  TestMetaFactoryBase
 
class  TestSuiteNameIs
 
class  TestSuiteWithCommentTest
 
struct  ThisRefAdjuster
 
class  ThreadLocal
 
class  Timer
 
class  To
 
struct  TrueWithString
 
class  TypeIdHelper
 
class  TypeParameterizedTest
 
class  TypeParameterizedTest< Fixture, TestSel, internal::None >
 
class  TypeParameterizedTestSuite
 
class  TypeParameterizedTestSuite< Fixture, internal::None, Types >
 
class  TypeParameterizedTestSuiteRegistry
 
struct  Types
 
struct  Types< Head_ >
 
class  TypeWithSize
 
class  TypeWithSize< 4 >
 
class  TypeWithSize< 8 >
 
class  UnitTestHelper
 
class  UnitTestRecordPropertyTestHelper
 
class  UniversalPrinter
 
class  UniversalPrinter< const T >
 
class  UniversalPrinter< T & >
 
class  UniversalPrinter< T[N]>
 
class  UniversalPrinter< Wrapper< T > >
 
class  UniversalTersePrinter
 
class  UniversalTersePrinter< char * >
 
class  UniversalTersePrinter< char16_t * >
 
class  UniversalTersePrinter< char32_t * >
 
class  UniversalTersePrinter< const char * >
 
class  UniversalTersePrinter< const char16_t * >
 
class  UniversalTersePrinter< const char32_t * >
 
class  UniversalTersePrinter< T & >
 
class  UniversalTersePrinter< T[N]>
 
class  UniversalTersePrinter< wchar_t * >
 
class  ValueArray
 
class  ValuesInIteratorRangeGenerator
 
struct  WithArgsAction
 
class  WithoutMatchers
 
class  XmlUnitTestResultPrinter
 

Typedefs

template<typename P , typename Q >
using disjunction = typename ::std::conditional< P::value, P, Q >::type
 
template<typename T >
using identity_t = T
 
template<TypeKind kFromKind, typename From , TypeKind kToKind, typename To >
using LosslessArithmeticConvertibleImpl = std::integral_constant< bool,(kFromKind==kBool) ? true :(kFromKind !=kToKind) ? false :(kFromKind==kInteger &&(((sizeof(From)< sizeof(To)) &&!(std::is_signed< From >::value &&!std::is_signed< To >::value))||((sizeof(From)==sizeof(To)) &&(std::is_signed< From >::value==std::is_signed< To >::value)))) ? true :(kFromKind==kFloatingPoint &&(sizeof(From)<=sizeof(To))) ? true :false >
 
template<typename From , typename To >
using LosslessArithmeticConvertible = LosslessArithmeticConvertibleImpl< GMOCK_KIND_OF_(From), From, GMOCK_KIND_OF_(To), To >
 
typedef ::std::vector< ::std::string > Strings
 
typedef FloatingPoint< float > Float
 
typedef FloatingPoint< double > Double
 
typedef const void * TypeId
 
using SetUpTestSuiteFunc = void(*)()
 
using TearDownTestSuiteFunc = void(*)()
 
using SetUpTearDownSuiteFuncType = void(*)()
 
using TypedTestCasePState = TypedTestSuitePState
 
typedef int IsContainer
 
typedef char IsNotContainer
 
template<size_t N>
using MakeIndexSequence = typename MakeIndexSequenceImpl< N >::type
 
template<typename... T>
using IndexSequenceFor = typename MakeIndexSequence< sizeof...(T)>::type
 
template<class TestCase >
using ParameterizedTestCaseInfo = ParameterizedTestSuiteInfo< TestCase >
 
typedef GTestMutexLock MutexLock
 
using BiggestInt = long long
 
using TimeInMillis = int64_t
 

Enumerations

enum  TypeKind { kBool , kInteger , kFloatingPoint , kOther }
 
enum  LogSeverity { kInfo = 0 , kWarning = 1 }
 
enum  GTestLogSeverity { GTEST_INFO , GTEST_WARNING , GTEST_ERROR , GTEST_FATAL }
 
enum  CharFormat { kAsIs , kHexEscape , kSpecialEscape }
 

Functions

 GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (void,)
 
 GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (::std::string, "")
 
 GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (bool, false)
 
 GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (unsigned char, '\0')
 
 GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (signed char, '\0')
 
 GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (char, '\0')
 
 GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (unsigned short, 0U)
 
 GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (signed short, 0)
 
 GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (unsigned int, 0U)
 
 GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (signed int, 0)
 
 GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (unsigned long, 0UL)
 
 GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (signed long, 0L)
 
 GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (unsigned long long, 0)
 
 GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (signed long long, 0)
 
 GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (float, 0)
 
 GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (double, 0)
 
template<typename F , typename Impl >
::testing::Action< F > MakeAction ()
 
template<typename F , typename Impl >
::testing::Action< F > MakeAction (std::shared_ptr< Impl > impl)
 
template<typename F , typename... Args>
auto InvokeArgument (F f, Args... args) -> decltype(f(args...))
 
template<typename T >
std::true_type StrictnessModifierProbe (const NiceMock< T > &)
 
template<typename T >
std::true_type StrictnessModifierProbe (const NaggyMock< T > &)
 
template<typename T >
std::true_type StrictnessModifierProbe (const StrictMock< T > &)
 
std::false_type StrictnessModifierProbe (...)
 
template<typename T >
constexpr bool HasStrictnessModifier ()
 
GTEST_API_ std::string JoinAsTuple (const Strings &fields)
 
GTEST_API_ std::string ConvertIdentifierNameToWords (const char *id_name)
 
template<typename Pointer >
const Pointer::element_type * GetRawPointer (const Pointer &p)
 
template<typename Element >
Element * GetRawPointer (Element *p)
 
 GMOCK_DECLARE_KIND_ (bool, kBool)
 
 GMOCK_DECLARE_KIND_ (char, kInteger)
 
 GMOCK_DECLARE_KIND_ (signed char, kInteger)
 
 GMOCK_DECLARE_KIND_ (unsigned char, kInteger)
 
 GMOCK_DECLARE_KIND_ (short, kInteger)
 
 GMOCK_DECLARE_KIND_ (unsigned short, kInteger)
 
 GMOCK_DECLARE_KIND_ (int, kInteger)
 
 GMOCK_DECLARE_KIND_ (unsigned int, kInteger)
 
 GMOCK_DECLARE_KIND_ (long, kInteger)
 
 GMOCK_DECLARE_KIND_ (unsigned long, kInteger)
 
 GMOCK_DECLARE_KIND_ (long long, kInteger)
 
 GMOCK_DECLARE_KIND_ (unsigned long long, kInteger)
 
 GMOCK_DECLARE_KIND_ (wchar_t, kInteger)
 
 GMOCK_DECLARE_KIND_ (float, kFloatingPoint)
 
 GMOCK_DECLARE_KIND_ (double, kFloatingPoint)
 
 GMOCK_DECLARE_KIND_ (long double, kFloatingPoint)
 
GTEST_API_ FailureReporterInterfaceGetFailureReporter ()
 
void Assert (bool condition, const char *file, int line, const std::string &msg)
 
void Assert (bool condition, const char *file, int line)
 
void Expect (bool condition, const char *file, int line, const std::string &msg)
 
void Expect (bool condition, const char *file, int line)
 
GTEST_API_ bool LogIsVisible (LogSeverity severity)
 
GTEST_API_ void Log (LogSeverity severity, const std::string &message, int stack_frames_to_skip)
 
GTEST_API_ WithoutMatchers GetWithoutMatchers ()
 
template<typename T >
Invalid ()
 
GTEST_API_ void IllegalDoDefault (const char *file, int line)
 
template<typename F , typename Tuple , size_t... Idx>
auto ApplyImpl (F &&f, Tuple &&args, IndexSequence< Idx... >) -> decltype(std::forward< F >(f)(std::get< Idx >(std::forward< Tuple >(args))...))
 
template<typename F , typename Tuple >
auto Apply (F &&f, Tuple &&args) -> decltype(ApplyImpl(std::forward< F >(f), std::forward< Tuple >(args), MakeIndexSequence< std::tuple_size< typename std::remove_reference< Tuple >::type >::value >()))
 
GTEST_API_ std::string FormatMatcherDescription (bool negation, const char *matcher_name, const Strings &param_values)
 
GTEST_API_ ElementMatcherPairs FindMaxBipartiteMatching (const MatchMatrix &g)
 
GTEST_API_ GTEST_DEFINE_STATIC_MUTEX_ (g_gmock_mutex)
 
GTEST_API_ void LogWithLocation (testing::internal::LogSeverity severity, const char *file, int line, const std::string &message)
 
void ReportUninterestingCall (CallReaction reaction, const std::string &msg)
 
CallReaction intToCallReaction (int mock_behavior)
 
template<typename CharType >
void InitGoogleMockImpl (int *argc, CharType **argv)
 
template<typename T >
std::string StreamableToString (const T &streamable)
 
template<typename T >
void UniversalPrint (const T &value, ::std::ostream *os)
 
GTEST_API_ void PrintBytesInObjectTo (const unsigned char *obj_bytes, size_t count, ::std::ostream *os)
 
template<typename T >
void PrintWithFallback (const T &value, ::std::ostream *os)
 
 GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_ (char)
 
 GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_ (wchar_t)
 
 GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_ (char16_t)
 
 GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_ (char32_t)
 
 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_ (char, ::std::string)
 
 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_ (char16_t, ::std::u16string)
 
 GTEST_IMPL_FORMAT_C_STRING_AS_STRING_ (char32_t, ::std::u32string)
 
template<typename T1 , typename T2 >
std::string FormatForComparisonFailureMessage (const T1 &value, const T2 &)
 
template<typename T >
void PrintTo (const T &value, ::std::ostream *os)
 
GTEST_API_ void PrintTo (unsigned char c, ::std::ostream *os)
 
GTEST_API_ void PrintTo (signed char c, ::std::ostream *os)
 
void PrintTo (char c, ::std::ostream *os)
 
void PrintTo (bool x, ::std::ostream *os)
 
GTEST_API_ void PrintTo (wchar_t wc, ::std::ostream *os)
 
GTEST_API_ void PrintTo (char32_t c, ::std::ostream *os)
 
void PrintTo (char16_t c, ::std::ostream *os)
 
GTEST_API_ void PrintTo (const char *s, ::std::ostream *os)
 
void PrintTo (char *s, ::std::ostream *os)
 
void PrintTo (const signed char *s, ::std::ostream *os)
 
void PrintTo (signed char *s, ::std::ostream *os)
 
void PrintTo (const unsigned char *s, ::std::ostream *os)
 
void PrintTo (unsigned char *s, ::std::ostream *os)
 
GTEST_API_ void PrintTo (const char16_t *s, ::std::ostream *os)
 
void PrintTo (char16_t *s, ::std::ostream *os)
 
GTEST_API_ void PrintTo (const char32_t *s, ::std::ostream *os)
 
void PrintTo (char32_t *s, ::std::ostream *os)
 
GTEST_API_ void PrintTo (const wchar_t *s, ::std::ostream *os)
 
void PrintTo (wchar_t *s, ::std::ostream *os)
 
template<typename T >
void PrintRawArrayTo (const T a[], size_t count, ::std::ostream *os)
 
GTEST_API_ void PrintStringTo (const ::std::string &s, ::std::ostream *os)
 
void PrintTo (const ::std::string &s, ::std::ostream *os)
 
GTEST_API_ void PrintU16StringTo (const ::std::u16string &s, ::std::ostream *os)
 
void PrintTo (const ::std::u16string &s, ::std::ostream *os)
 
GTEST_API_ void PrintU32StringTo (const ::std::u32string &s, ::std::ostream *os)
 
void PrintTo (const ::std::u32string &s, ::std::ostream *os)
 
void PrintTo (std::nullptr_t, ::std::ostream *os)
 
template<typename T >
void PrintTo (std::reference_wrapper< T > ref, ::std::ostream *os)
 
const void * VoidifyPointer (const void *p)
 
const void * VoidifyPointer (volatile const void *p)
 
template<typename T , typename Ptr >
void PrintSmartPointer (const Ptr &ptr, std::ostream *os, char)
 
template<typename T , typename Ptr , typename = typename std::enable_if<!std::is_void<T>::value && !std::is_array<T>::value>::type>
void PrintSmartPointer (const Ptr &ptr, std::ostream *os, int)
 
template<typename T , typename D >
void PrintTo (const std::unique_ptr< T, D > &ptr, std::ostream *os)
 
template<typename T >
void PrintTo (const std::shared_ptr< T > &ptr, std::ostream *os)
 
template<typename T >
void PrintTupleTo (const T &, std::integral_constant< size_t, 0 >, ::std::ostream *)
 
template<typename T , size_t I>
void PrintTupleTo (const T &t, std::integral_constant< size_t, I >, ::std::ostream *os)
 
template<typename... Types>
void PrintTo (const ::std::tuple< Types... > &t, ::std::ostream *os)
 
template<typename T1 , typename T2 >
void PrintTo (const ::std::pair< T1, T2 > &value, ::std::ostream *os)
 
template<typename T >
void UniversalPrintArray (const T *begin, size_t len, ::std::ostream *os)
 
GTEST_API_ void UniversalPrintArray (const char *begin, size_t len, ::std::ostream *os)
 
GTEST_API_ void UniversalPrintArray (const char16_t *begin, size_t len, ::std::ostream *os)
 
GTEST_API_ void UniversalPrintArray (const char32_t *begin, size_t len, ::std::ostream *os)
 
GTEST_API_ void UniversalPrintArray (const wchar_t *begin, size_t len, ::std::ostream *os)
 
template<typename T >
void UniversalTersePrint (const T &value, ::std::ostream *os)
 
template<typename Tuple >
void TersePrintPrefixToStrings (const Tuple &, std::integral_constant< size_t, 0 >, Strings *)
 
template<typename Tuple , size_t I>
void TersePrintPrefixToStrings (const Tuple &t, std::integral_constant< size_t, I >, Strings *strings)
 
template<typename Tuple >
Strings UniversalTersePrintTupleFieldsToStrings (const Tuple &value)
 
template<typename T1 , typename T2 >
AssertionResult CmpHelperEQFailure (const char *lhs_expression, const char *rhs_expression, const T1 &lhs, const T2 &rhs)
 
bool operator== (faketype, faketype)
 
bool operator!= (faketype, faketype)
 
template<typename T1 , typename T2 >
AssertionResult CmpHelperEQ (const char *lhs_expression, const char *rhs_expression, const T1 &lhs, const T2 &rhs)
 
template<typename T1 , typename T2 >
AssertionResult CmpHelperOpFailure (const char *expr1, const char *expr2, const T1 &val1, const T2 &val2, const char *op)
 
GTEST_API_ AssertionResult CmpHelperSTREQ (const char *s1_expression, const char *s2_expression, const char *s1, const char *s2)
 
GTEST_API_ AssertionResult CmpHelperSTRCASEEQ (const char *s1_expression, const char *s2_expression, const char *s1, const char *s2)
 
GTEST_API_ AssertionResult CmpHelperSTRNE (const char *s1_expression, const char *s2_expression, const char *s1, const char *s2)
 
GTEST_API_ AssertionResult CmpHelperSTRCASENE (const char *s1_expression, const char *s2_expression, const char *s1, const char *s2)
 
GTEST_API_ AssertionResult CmpHelperSTREQ (const char *s1_expression, const char *s2_expression, const wchar_t *s1, const wchar_t *s2)
 
GTEST_API_ AssertionResult CmpHelperSTRNE (const char *s1_expression, const char *s2_expression, const wchar_t *s1, const wchar_t *s2)
 
template<typename RawType >
AssertionResult CmpHelperFloatingPointEQ (const char *lhs_expression, const char *rhs_expression, RawType lhs_value, RawType rhs_value)
 
GTEST_API_ AssertionResult DoubleNearPredFormat (const char *expr1, const char *expr2, const char *abs_error_expr, double val1, double val2, double abs_error)
 
 GTEST_DECLARE_string_ (internal_run_death_test)
 
GTEST_API_ std::string AppendUserMessage (const std::string &gtest_msg, const Message &user_msg)
 
GTEST_API_ std::string DiffStrings (const std::string &left, const std::string &right, size_t *total_line_count)
 
GTEST_API_ AssertionResult EqFailure (const char *expected_expression, const char *actual_expression, const std::string &expected_value, const std::string &actual_value, bool ignoring_case)
 
GTEST_API_ std::string GetBoolAssertionFailureMessage (const AssertionResult &assertion_result, const char *expression_text, const char *actual_predicate_value, const char *expected_predicate_value)
 
template<typename T >
TypeId GetTypeId ()
 
GTEST_API_ TypeId GetTestTypeId ()
 
SetUpTearDownSuiteFuncType GetNotDefaultOrNull (SetUpTearDownSuiteFuncType a, SetUpTearDownSuiteFuncType def)
 
GTEST_API_ TestInfoMakeAndRegisterTestInfo (const char *test_suite_name, const char *name, const char *type_param, const char *value_param, CodeLocation code_location, TypeId fixture_class_id, SetUpTestSuiteFunc set_up_tc, TearDownTestSuiteFunc tear_down_tc, TestFactoryBase *factory)
 
GTEST_API_ bool SkipPrefix (const char *prefix, const char **pstr)
 
 GTEST_DISABLE_MSC_WARNINGS_PUSH_ (4251) class GTEST_API_ TypedTestSuitePState
 
 GTEST_DISABLE_MSC_WARNINGS_POP_ () inline const char *SkipComma(const char *str)
 
std::string GetPrefixUntilComma (const char *str)
 
void SplitString (const ::std::string &str, char delimiter, ::std::vector< ::std::string > *dest)
 
template<typename NameGenerator >
void GenerateNamesRecursively (internal::None, std::vector< std::string > *, int)
 
template<typename NameGenerator , typename Types >
void GenerateNamesRecursively (Types, std::vector< std::string > *result, int i)
 
template<typename NameGenerator , typename Types >
std::vector< std::string > GenerateNames ()
 
GTEST_API_ void RegisterTypeParameterizedTestSuite (const char *test_suite_name, CodeLocation code_location)
 
GTEST_API_ void RegisterTypeParameterizedTestSuiteInstantiation (const char *case_name)
 
GTEST_API_ std::string GetCurrentOsStackTraceExceptTop (UnitTest *unit_test, int skip_count)
 
GTEST_API_ bool AlwaysTrue ()
 
bool AlwaysFalse ()
 
template<class C , class Iterator = decltype(::std::declval<const C&>().begin()), class = decltype(::std::declval<const C&>().end()), class = decltype(++::std::declval<Iterator&>()), class = decltype(*::std::declval<Iterator>()), class = typename C::const_iterator>
IsContainer IsContainerTest (int)
 
template<class C >
IsNotContainer IsContainerTest (long)
 
template<typename T , typename U >
bool ArrayEq (const T *lhs, size_t size, const U *rhs)
 
template<typename T , typename U >
bool ArrayEq (const T &lhs, const U &rhs)
 
template<typename T , typename U , size_t N>
bool ArrayEq (const T(&lhs)[N], const U(&rhs)[N])
 
template<typename Iter , typename Element >
Iter ArrayAwareFind (Iter begin, Iter end, const Element &elem)
 
template<typename T , typename U >
void CopyArray (const T *from, size_t size, U *to)
 
template<typename T , typename U >
void CopyArray (const T &from, U *to)
 
template<typename T , typename U , size_t N>
void CopyArray (const T(&from)[N], U(*to)[N])
 
 GTEST_INTERNAL_DEPRECATED ("INSTANTIATE_TEST_CASE_P is deprecated, please use " "INSTANTIATE_TEST_SUITE_P") const expr bool InstantiateTestCase_P_IsDeprecated()
 
 GTEST_INTERNAL_DEPRECATED ("TYPED_TEST_CASE_P is deprecated, please use " "TYPED_TEST_SUITE_P") const expr bool TypedTestCase_P_IsDeprecated()
 
 GTEST_INTERNAL_DEPRECATED ("TYPED_TEST_CASE is deprecated, please use " "TYPED_TEST_SUITE") const expr bool TypedTestCaseIsDeprecated()
 
 GTEST_INTERNAL_DEPRECATED ("REGISTER_TYPED_TEST_CASE_P is deprecated, please use " "REGISTER_TYPED_TEST_SUITE_P") const expr bool RegisterTypedTestCase_P_IsDeprecated()
 
 GTEST_INTERNAL_DEPRECATED ("INSTANTIATE_TYPED_TEST_CASE_P is deprecated, please use " "INSTANTIATE_TYPED_TEST_SUITE_P") const expr bool InstantiateTypedTestCase_P_IsDeprecated()
 
GTEST_API_ void ReportInvalidTestSuiteType (const char *test_suite_name, CodeLocation code_location)
 
template<class ParamType >
std::string DefaultParamName (const TestParamInfo< ParamType > &info)
 
template<typename T = int>
void TestNotEmpty ()
 
template<typename T = int>
void TestNotEmpty (const T &)
 
GTEST_API_ void InsertSyntheticTestCase (const std::string &name, CodeLocation location, bool has_test_p)
 
GTEST_API_ bool IsTrue (bool condition)
 
GTEST_API_::std::string FormatFileLocation (const char *file, int line)
 
GTEST_API_::std::string FormatCompilerIndependentFileLocation (const char *file, int line)
 
void LogToStderr ()
 
void FlushInfoLog ()
 
template<typename To >
To ImplicitCast_ (To x)
 
template<typename To , typename From >
To DownCast_ (From *f)
 
template<class Derived , class Base >
Derived * CheckedDowncastToActualType (Base *base)
 
GTEST_API_ void CaptureStdout ()
 
GTEST_API_ std::string GetCapturedStdout ()
 
GTEST_API_ void CaptureStderr ()
 
GTEST_API_ std::string GetCapturedStderr ()
 
GTEST_API_ size_t GetFileSize (FILE *file)
 
GTEST_API_ std::string ReadEntireFile (FILE *file)
 
GTEST_API_ std::vector< std::string > GetArgvs ()
 
GTEST_API_ size_t GetThreadCount ()
 
bool IsAlpha (char ch)
 
bool IsAlNum (char ch)
 
bool IsDigit (char ch)
 
bool IsLower (char ch)
 
bool IsSpace (char ch)
 
bool IsUpper (char ch)
 
bool IsXDigit (char ch)
 
bool IsXDigit (char16_t ch)
 
bool IsXDigit (char32_t ch)
 
bool IsXDigit (wchar_t ch)
 
char ToLower (char ch)
 
char ToUpper (char ch)
 
std::string StripTrailingSpaces (std::string str)
 
GTEST_API_ bool ParseInt32 (const Message &src_text, const char *str, int32_t *value)
 
bool BoolFromGTestEnv (const char *flag, bool default_val)
 
GTEST_API_ int32_t Int32FromGTestEnv (const char *flag, int32_t default_val)
 
std::string OutputFlagAlsoCheckEnvVar ()
 
const char * StringFromGTestEnv (const char *flag, const char *default_val)
 
GTEST_API_ std::string StringStreamToString (::std::stringstream *stream)
 
std::string CanonicalizeForStdLibVersioning (std::string s)
 
template<typename T >
std::string GetTypeName ()
 
 GTEST_DEFINE_string_ (internal_run_death_test, "", "Indicates the file, line number, temporal index of " "the single death test to run, and a file descriptor to " "which a success code may be sent, all separated by " "the '|' characters. This flag is specified if and only if the " "current process is a sub-process launched for running a thread-safe " "death test. FOR INTERNAL USE ONLY.")
 
void PrintBytesInObjectTo (const unsigned char *obj_bytes, size_t count, ostream *os)
 
bool IsPrintableAscii (char32_t c)
 
template<typename Char >
void PrintCharAndCodeTo (Char c, ostream *os)
 
void PrintTo (wchar_t wc, ostream *os)
 
void UniversalPrintArray (const char *begin, size_t len, ostream *os)
 
void UniversalPrintArray (const char16_t *begin, size_t len, ostream *os)
 
void UniversalPrintArray (const char32_t *begin, size_t len, ostream *os)
 
void UniversalPrintArray (const wchar_t *begin, size_t len, ostream *os)
 
void PrintTo (const char *s, ostream *os)
 
void PrintTo (const char16_t *s, ostream *os)
 
void PrintTo (const char32_t *s, ostream *os)
 
void PrintTo (const wchar_t *s, ostream *os)
 
void PrintStringTo (const ::std::string &s, ostream *os)
 
void PrintU16StringTo (const ::std::u16string &s, ostream *os)
 
void PrintU32StringTo (const ::std::u32string &s, ostream *os)
 
std::set< std::string > * GetIgnoredParameterizedTestSuites ()
 
FilePath GetCurrentExecutableName ()
 
TimeInMillis GetTimeInMillis ()
 
template<typename RawType >
AssertionResult FloatingPointLE (const char *expr1, const char *expr2, RawType val1, RawType val2)
 
uint32_t ChopLowBits (uint32_t *bits, int n)
 
std::string CodePointToUtf8 (uint32_t code_point)
 
bool IsUtf16SurrogatePair (wchar_t first, wchar_t second)
 
uint32_t CreateCodePointFromUtf16SurrogatePair (wchar_t first, wchar_t second)
 
std::string WideStringToUtf8 (const wchar_t *str, int num_chars)
 
void ReportFailureInUnknownLocation (TestPartResult::Type result_type, const std::string &message)
 
template<class T , typename Result >
Result HandleSehExceptionsInMethodIfSupported (T *object, Result(T::*method)(), const char *location)
 
template<class T , typename Result >
Result HandleExceptionsInMethodIfSupported (T *object, Result(T::*method)(), const char *location)
 
bool ShouldUseColor (bool stdout_is_tty)
 
std::string FormatTimeInMillisAsSeconds (TimeInMillis ms)
 
std::string FormatEpochTimeInMillisAsIso8601 (TimeInMillis ms)
 
void WriteToShardStatusFileIfNeeded ()
 
bool ShouldShard (const char *total_shards_env, const char *shard_index_env, bool in_subprocess_for_death_test)
 
int32_t Int32FromEnvOrDie (const char *var, int32_t default_val)
 
bool ShouldRunTestOnShard (int total_shards, int shard_index, int test_id)
 
bool ParseInt32Flag (const char *str, const char *flag, int32_t *value)
 
template<typename CharType >
void ParseGoogleTestFlagsOnlyImpl (int *argc, CharType **argv)
 
void ParseGoogleTestFlagsOnly (int *argc, char **argv)
 
void ParseGoogleTestFlagsOnly (int *argc, wchar_t **argv)
 
template<typename CharType >
void InitGoogleTestImpl (int *argc, CharType **argv)
 
 TEST_F (ListenerTest, DoesFoo)
 
 TEST_F (ListenerTest, DoesBar)
 
 TEST (IsXDigitTest, WorksForNarrowAscii)
 
 TEST (IsXDigitTest, ReturnsFalseForNarrowNonAscii)
 
 TEST (IsXDigitTest, WorksForWideAscii)
 
 TEST (IsXDigitTest, ReturnsFalseForWideNonAscii)
 
 TEST (ImplicitCastTest, ConvertsPointers)
 
 TEST (ImplicitCastTest, CanUseInheritance)
 
 TEST (ImplicitCastTest, CanUseNonConstCastOperator)
 
 TEST (ImplicitCastTest, CanUseConstCastOperatorOnConstValues)
 
 TEST (ImplicitCastTest, CanSelectBetweenConstAndNonConstCasrAppropriately)
 
 TEST (ImplicitCastTest, CanUseImplicitConstructor)
 
 TEST (GtestCheckSyntaxTest, BehavesLikeASingleStatement)
 
 TEST (GtestCheckSyntaxTest, WorksWithSwitch)
 
 TEST (FormatFileLocationTest, FormatsFileLocation)
 
 TEST (FormatFileLocationTest, FormatsUnknownFile)
 
 TEST (FormatFileLocationTest, FormatsUknownLine)
 
 TEST (FormatFileLocationTest, FormatsUknownFileAndLine)
 
 TEST (FormatCompilerIndependentFileLocationTest, FormatsFileLocation)
 
 TEST (FormatCompilerIndependentFileLocationTest, FormatsUknownFile)
 
 TEST (FormatCompilerIndependentFileLocationTest, FormatsUknownLine)
 
 TEST (FormatCompilerIndependentFileLocationTest, FormatsUknownFileAndLine)
 
 TEST (GetThreadCountTest, ReturnsZeroWhenUnableToCountThreads)
 
 TEST (GtestCheckDeathTest, DiesWithCorrectOutputOnFailure)
 
 TEST (RegexEngineSelectionTest, SelectsCorrectRegexEngine)
 
 TEST (CaptureTest, CapturesStdout)
 
 TEST (CaptureTest, CapturesStderr)
 
 TEST (CaptureTest, CapturesStdoutAndStderr)
 
 TEST (CaptureDeathTest, CannotReenterStdoutCapture)
 
 TEST (ThreadLocalTest, DefaultConstructorInitializesToDefaultValues)
 
 TEST (ThreadLocalTest, SingleParamConstructorInitializesToParam)
 
 TEST (ThreadLocalTest, ValueDefaultContructorIsNotRequiredForParamVersion)
 
 TEST (ThreadLocalTest, GetAndPointerReturnSameValue)
 
 TEST (ThreadLocalTest, PointerAndConstPointerReturnSameValue)
 
 TYPED_TEST_SUITE (TestSuiteWithCommentTest, Types< int >)
 
 TYPED_TEST (TestSuiteWithCommentTest, Dummy)
 
 TEST (ApiTest, UnitTestImmutableAccessorsWork)
 
AssertionResult IsNull (const char *str)
 
 TEST (ApiTest, TestSuiteImmutableAccessorsWork)
 
 TEST (ApiTest, TestSuiteDisabledAccessorsWork)
 
 TEST (ApiTest, DISABLED_Dummy1)
 
 TEST (DISABLED_Test, Dummy2)
 

Variables

const char kInfoVerbosity [] = "info"
 
const char kWarningVerbosity [] = "warning"
 
const char kErrorVerbosity [] = "error"
 
GTEST_API_ ThreadLocal< Sequence * > g_gmock_implicit_sequence
 
const char kDeathTestStyleFlag [] = "death_test_style"
 
const char kDeathTestUseFork [] = "death_test_use_fork"
 
const char kInternalRunDeathTestFlag [] = "internal_run_death_test"
 
GTEST_API_ const char kStackTraceMarker [] = "\nStack trace:\n"
 
constexpr BiggestInt kMaxBiggestInt = (std::numeric_limits<BiggestInt>::max)()
 
const char kPathSeparator = '/'
 
const char kCurrentDirectoryString [] = "./"
 
const int kStdOutFileno = STDOUT_FILENO
 
const int kStdErrFileno = STDERR_FILENO
 
const char kUnknownFile [] = "unknown file"
 
bool g_help_flag = false
 
static ::std::vector< std::string > g_argvs
 
const TypeId kTestTypeIdInGoogleTest = GetTestTypeId()
 
constexpr uint32_t kMaxCodePoint1 = (static_cast<uint32_t>(1) << 7) - 1
 
constexpr uint32_t kMaxCodePoint2 = (static_cast<uint32_t>(1) << (5 + 6)) - 1
 
constexpr uint32_t kMaxCodePoint3 = (static_cast<uint32_t>(1) << (4 + 2*6)) - 1
 
constexpr uint32_t kMaxCodePoint4 = (static_cast<uint32_t>(1) << (3 + 3*6)) - 1
 
const int kTypedTestSuites = 1
 
const int kTypedTests = 1
 

Typedef Documentation

◆ BiggestInt

using testing::internal::BiggestInt = typedef long long

Definition at line 2151 of file gtest-port.h.

◆ disjunction

template<typename P , typename Q >
using testing::internal::disjunction = typedef typename ::std::conditional<P::value, P, Q>::type

Definition at line 269 of file gmock-actions.h.

◆ Double

Definition at line 409 of file gtest-internal.h.

◆ Float

Definition at line 408 of file gtest-internal.h.

◆ identity_t

template<typename T >
using testing::internal::identity_t = typedef T

Definition at line 49 of file gmock-function-mocker.h.

◆ IndexSequenceFor

template<typename... T>
using testing::internal::IndexSequenceFor = typedef typename MakeIndexSequence<sizeof...(T)>::type

Definition at line 1188 of file gtest-internal.h.

◆ IsContainer

Definition at line 944 of file gtest-internal.h.

◆ IsNotContainer

Definition at line 955 of file gtest-internal.h.

◆ LosslessArithmeticConvertible

Definition at line 187 of file gmock-internal-utils.h.

◆ LosslessArithmeticConvertibleImpl

template<TypeKind kFromKind, typename From , TypeKind kToKind, typename To >
using testing::internal::LosslessArithmeticConvertibleImpl = typedef std::integral_constant< bool, (kFromKind == kBool) ? true : (kFromKind != kToKind) ? false : (kFromKind == kInteger && (((sizeof(From) < sizeof(To)) && !(std::is_signed<From>::value && !std::is_signed<To>::value)) || ((sizeof(From) == sizeof(To)) && (std::is_signed<From>::value == std::is_signed<To>::value))) ) ? true : (kFromKind == kFloatingPoint && (sizeof(From) <= sizeof(To))) ? true : false >

Definition at line 154 of file gmock-internal-utils.h.

◆ MakeIndexSequence

template<size_t N>
using testing::internal::MakeIndexSequence = typedef typename MakeIndexSequenceImpl<N>::type

Definition at line 1185 of file gtest-internal.h.

◆ MutexLock

Definition at line 1886 of file gtest-port.h.

◆ ParameterizedTestCaseInfo

template<class TestCase >
using testing::internal::ParameterizedTestCaseInfo = typedef ParameterizedTestSuiteInfo<TestCase>

Definition at line 675 of file gtest-param-util.h.

◆ SetUpTearDownSuiteFuncType

Definition at line 504 of file gtest-internal.h.

◆ SetUpTestSuiteFunc

using testing::internal::SetUpTestSuiteFunc = typedef void (*)()

Definition at line 489 of file gtest-internal.h.

◆ Strings

typedef ::std::vector< ::std::string> testing::internal::Strings

Definition at line 983 of file gtest-printers.h.

◆ TearDownTestSuiteFunc

using testing::internal::TearDownTestSuiteFunc = typedef void (*)()

Definition at line 490 of file gtest-internal.h.

◆ TimeInMillis

using testing::internal::TimeInMillis = typedef int64_t

Definition at line 2199 of file gtest-port.h.

◆ TypedTestCasePState

using testing::internal::TypedTestCasePState = typedef TypedTestSuitePState

Definition at line 645 of file gtest-internal.h.

◆ TypeId

typedef const void* testing::internal::TypeId

Definition at line 417 of file gtest-internal.h.

Enumeration Type Documentation

◆ CharFormat

Enumerator
kAsIs 
kHexEscape 
kSpecialEscape 

Definition at line 139 of file gtest-printers.cc.

◆ GTestLogSeverity

Enumerator
GTEST_INFO 
GTEST_WARNING 
GTEST_ERROR 
GTEST_FATAL 

Definition at line 957 of file gtest-port.h.

◆ LogSeverity

Enumerator
kInfo 
kWarning 

Definition at line 240 of file gmock-internal-utils.h.

◆ TypeKind

Enumerator
kBool 
kInteger 
kFloatingPoint 
kOther 

Definition at line 100 of file gmock-internal-utils.h.

Function Documentation

◆ AlwaysFalse()

bool testing::internal::AlwaysFalse ( )
inline

Definition at line 844 of file gtest-internal.h.

844{ return !AlwaysTrue(); }
GTEST_API_ bool AlwaysTrue()
Definition: gtest.cc:6240

◆ AlwaysTrue()

bool testing::internal::AlwaysTrue ( )

Definition at line 6240 of file gtest.cc.

6240 {
6241#if GTEST_HAS_EXCEPTIONS
6242 // This condition is always false so AlwaysTrue() never actually throws,
6243 // but it makes the compiler think that it may throw.
6244 if (IsTrue(false))
6245 throw ClassUniqueToAlwaysTrue();
6246#endif // GTEST_HAS_EXCEPTIONS
6247 return true;
6248}
GTEST_API_ bool IsTrue(bool condition)
Definition: gtest.cc:6238

◆ AppendUserMessage()

std::string testing::internal::AppendUserMessage ( const std::string &  gtest_msg,
const Message user_msg 
)

Definition at line 2183 of file gtest.cc.

2184 {
2185 // Appends the user message if it's non-empty.
2186 const std::string user_msg_string = user_msg.GetString();
2187 if (user_msg_string.empty()) {
2188 return gtest_msg;
2189 }
2190 if (gtest_msg.empty()) {
2191 return user_msg_string;
2192 }
2193 return gtest_msg + "\n" + user_msg_string;
2194}
std::string GetString() const
Definition: gtest.cc:1182

◆ Apply()

template<typename F , typename Tuple >
auto testing::internal::Apply ( F &&  f,
Tuple &&  args 
) -> decltype( ApplyImpl(std::forward<F>(f), std::forward<Tuple>(args), MakeIndexSequence<std::tuple_size< typename std::remove_reference<Tuple>::type>::value>()))

Definition at line 412 of file gmock-internal-utils.h.

415 {
416 return ApplyImpl(std::forward<F>(f), std::forward<Tuple>(args),
417 MakeIndexSequence<std::tuple_size<
419}
int value
auto ApplyImpl(F &&f, Tuple &&args, IndexSequence< Idx... >) -> decltype(std::forward< F >(f)(std::get< Idx >(std::forward< Tuple >(args))...))
typename MakeIndexSequenceImpl< N >::type MakeIndexSequence
type
Definition: upload.py:458

◆ ApplyImpl()

template<typename F , typename Tuple , size_t... Idx>
auto testing::internal::ApplyImpl ( F &&  f,
Tuple &&  args,
IndexSequence< Idx... >   
) -> decltype( std::forward<F>(f)(std::get<Idx>(std::forward<Tuple>(args))...))

Definition at line 405 of file gmock-internal-utils.h.

406 {
407 return std::forward<F>(f)(std::get<Idx>(std::forward<Tuple>(args))...);
408}

◆ ArrayAwareFind()

template<typename Iter , typename Element >
Iter testing::internal::ArrayAwareFind ( Iter  begin,
Iter  end,
const Element &  elem 
)

Definition at line 1043 of file gtest-internal.h.

1043 {
1044 for (Iter it = begin; it != end; ++it) {
1045 if (internal::ArrayEq(*it, elem))
1046 return it;
1047 }
1048 return end;
1049}
bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N])
def Iter(n, format, sep='')

◆ ArrayEq() [1/3]

template<typename T , typename U >
bool testing::internal::ArrayEq ( const T &  lhs,
const U &  rhs 
)
inline

Definition at line 1020 of file gtest-internal.h.

1020{ return lhs == rhs; }

◆ ArrayEq() [2/3]

template<typename T , typename U >
bool testing::internal::ArrayEq ( const T *  lhs,
size_t  size,
const U *  rhs 
)

Definition at line 1032 of file gtest-internal.h.

1032 {
1033 for (size_t i = 0; i != size; i++) {
1034 if (!internal::ArrayEq(lhs[i], rhs[i]))
1035 return false;
1036 }
1037 return true;
1038}

◆ ArrayEq() [3/3]

template<typename T , typename U , size_t N>
bool testing::internal::ArrayEq ( const T(&)  lhs[N],
const U(&)  rhs[N] 
)
inline

Definition at line 1024 of file gtest-internal.h.

1024 {
1025 return internal::ArrayEq(lhs, N, rhs);
1026}

◆ Assert() [1/2]

void testing::internal::Assert ( bool  condition,
const char *  file,
int  line 
)
inline

Definition at line 222 of file gmock-internal-utils.h.

222 {
223 Assert(condition, file, line, "Assertion failed.");
224}
void Assert(bool condition, const char *file, int line)

◆ Assert() [2/2]

void testing::internal::Assert ( bool  condition,
const char *  file,
int  line,
const std::string &  msg 
)
inline

Definition at line 215 of file gmock-internal-utils.h.

216 {
217 if (!condition) {
218 GetFailureReporter()->ReportFailure(FailureReporterInterface::kFatal,
219 file, line, msg);
220 }
221}
GTEST_API_ FailureReporterInterface * GetFailureReporter()
virtual void ReportFailure(FailureType type, const char *file, int line, const std::string &message)=0

◆ BoolFromGTestEnv()

bool testing::internal::BoolFromGTestEnv ( const char *  flag,
bool  default_val 
)

Definition at line 1365 of file gtest-port.cc.

1365 {
1366#if defined(GTEST_GET_BOOL_FROM_ENV_)
1367 return GTEST_GET_BOOL_FROM_ENV_(flag, default_value);
1368#else
1369 const std::string env_var = FlagToEnvVar(flag);
1370 const char* const string_value = posix::GetEnv(env_var.c_str());
1371 return string_value == nullptr ? default_value
1372 : strcmp(string_value, "0") != 0;
1373#endif // defined(GTEST_GET_BOOL_FROM_ENV_)
1374}
const char * GetEnv(const char *name)
Definition: gtest-port.h:2103

◆ CanonicalizeForStdLibVersioning()

std::string testing::internal::CanonicalizeForStdLibVersioning ( std::string  s)
inline

Definition at line 55 of file gtest-type-util.h.

55 {
56 static const char prefix[] = "std::__";
57 if (s.compare(0, strlen(prefix), prefix) == 0) {
58 std::string::size_type end = s.find("::", strlen(prefix));
59 if (end != s.npos) {
60 // Erase everything between the initial `std` and the second `::`.
61 s.erase(strlen("std"), end - strlen("std"));
62 }
63 }
64 return s;
65}

◆ CaptureStderr()

GTEST_API_ void testing::internal::CaptureStderr ( )

◆ CaptureStdout()

GTEST_API_ void testing::internal::CaptureStdout ( )

◆ CheckedDowncastToActualType()

template<class Derived , class Base >
Derived * testing::internal::CheckedDowncastToActualType ( Base base)

Definition at line 1116 of file gtest-port.h.

1116 {
1117#if GTEST_HAS_RTTI
1118 GTEST_CHECK_(typeid(*base) == typeid(Derived));
1119#endif
1120
1121#if GTEST_HAS_DOWNCAST_
1122 return ::down_cast<Derived*>(base);
1123#elif GTEST_HAS_RTTI
1124 return dynamic_cast<Derived*>(base); // NOLINT
1125#else
1126 return static_cast<Derived*>(base); // Poor man's downcast.
1127#endif
1128}
#define GTEST_CHECK_(condition)
Definition: gtest-port.h:1008

◆ ChopLowBits()

uint32_t testing::internal::ChopLowBits ( uint32_t *  bits,
int  n 
)
inline

Definition at line 1918 of file gtest.cc.

1918 {
1919 const uint32_t low_bits = *bits & ((static_cast<uint32_t>(1) << n) - 1);
1920 *bits >>= n;
1921 return low_bits;
1922}

◆ CmpHelperEQ()

template<typename T1 , typename T2 >
AssertionResult testing::internal::CmpHelperEQ ( const char *  lhs_expression,
const char *  rhs_expression,
const T1 lhs,
const T2 rhs 
)

Definition at line 1541 of file gtest.h.

1544 {
1545 if (lhs == rhs) {
1546 return AssertionSuccess();
1547 }
1548
1549 return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs);
1550}
AssertionResult AssertionSuccess()
Definition: gtest.cc:1209
AssertionResult CmpHelperEQFailure(const char *lhs_expression, const char *rhs_expression, const T1 &lhs, const T2 &rhs)
Definition: gtest.h:1522

◆ CmpHelperEQFailure()

template<typename T1 , typename T2 >
AssertionResult testing::internal::CmpHelperEQFailure ( const char *  lhs_expression,
const char *  rhs_expression,
const T1 lhs,
const T2 rhs 
)

Definition at line 1522 of file gtest.h.

1524 {
1525 return EqFailure(lhs_expression,
1526 rhs_expression,
1529 false);
1530}
GTEST_API_ AssertionResult EqFailure(const char *expected_expression, const char *actual_expression, const std::string &expected_value, const std::string &actual_value, bool ignoring_case)
Definition: gtest.cc:1512
std::string FormatForComparisonFailureMessage(const T1 &value, const T2 &)

◆ CmpHelperFloatingPointEQ()

template<typename RawType >
AssertionResult testing::internal::CmpHelperFloatingPointEQ ( const char *  lhs_expression,
const char *  rhs_expression,
RawType  lhs_value,
RawType  rhs_value 
)

Definition at line 1733 of file gtest.h.

1736 {
1737 const FloatingPoint<RawType> lhs(lhs_value), rhs(rhs_value);
1738
1739 if (lhs.AlmostEquals(rhs)) {
1740 return AssertionSuccess();
1741 }
1742
1743 ::std::stringstream lhs_ss;
1744 lhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
1745 << lhs_value;
1746
1747 ::std::stringstream rhs_ss;
1748 rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
1749 << rhs_value;
1750
1751 return EqFailure(lhs_expression,
1752 rhs_expression,
1753 StringStreamToString(&lhs_ss),
1754 StringStreamToString(&rhs_ss),
1755 false);
1756}
GTEST_API_ std::string StringStreamToString(::std::stringstream *stream)
Definition: gtest.cc:2164

◆ CmpHelperOpFailure()

template<typename T1 , typename T2 >
AssertionResult testing::internal::CmpHelperOpFailure ( const char *  expr1,
const char *  expr2,
const T1 val1,
const T2 val2,
const char *  op 
)

Definition at line 1595 of file gtest.h.

1597 {
1598 return AssertionFailure()
1599 << "Expected: (" << expr1 << ") " << op << " (" << expr2
1600 << "), actual: " << FormatForComparisonFailureMessage(val1, val2)
1601 << " vs " << FormatForComparisonFailureMessage(val2, val1);
1602}
AssertionResult AssertionFailure()
Definition: gtest.cc:1214

◆ CmpHelperSTRCASEEQ()

AssertionResult testing::internal::CmpHelperSTRCASEEQ ( const char *  s1_expression,
const char *  s2_expression,
const char *  s1,
const char *  s2 
)

Definition at line 1676 of file gtest.cc.

1679 {
1680 if (String::CaseInsensitiveCStringEquals(lhs, rhs)) {
1681 return AssertionSuccess();
1682 }
1683
1684 return EqFailure(lhs_expression,
1685 rhs_expression,
1686 PrintToString(lhs),
1687 PrintToString(rhs),
1688 true);
1689}
::std::string PrintToString(const T &value)

◆ CmpHelperSTRCASENE()

AssertionResult testing::internal::CmpHelperSTRCASENE ( const char *  s1_expression,
const char *  s2_expression,
const char *  s1,
const char *  s2 
)

Definition at line 1706 of file gtest.cc.

1709 {
1710 if (!String::CaseInsensitiveCStringEquals(s1, s2)) {
1711 return AssertionSuccess();
1712 } else {
1713 return AssertionFailure()
1714 << "Expected: (" << s1_expression << ") != ("
1715 << s2_expression << ") (ignoring case), actual: \""
1716 << s1 << "\" vs \"" << s2 << "\"";
1717 }
1718}
AssertionResult AssertionFailure(const Message &message)
Definition: gtest.cc:1220

◆ CmpHelperSTREQ() [1/2]

AssertionResult testing::internal::CmpHelperSTREQ ( const char *  s1_expression,
const char *  s2_expression,
const char *  s1,
const char *  s2 
)

Definition at line 1660 of file gtest.cc.

1663 {
1664 if (String::CStringEquals(lhs, rhs)) {
1665 return AssertionSuccess();
1666 }
1667
1668 return EqFailure(lhs_expression,
1669 rhs_expression,
1670 PrintToString(lhs),
1671 PrintToString(rhs),
1672 false);
1673}

◆ CmpHelperSTREQ() [2/2]

AssertionResult testing::internal::CmpHelperSTREQ ( const char *  s1_expression,
const char *  s2_expression,
const wchar_t *  s1,
const wchar_t *  s2 
)

Definition at line 2043 of file gtest.cc.

2046 {
2047 if (String::WideCStringEquals(lhs, rhs)) {
2048 return AssertionSuccess();
2049 }
2050
2051 return EqFailure(lhs_expression,
2052 rhs_expression,
2053 PrintToString(lhs),
2054 PrintToString(rhs),
2055 false);
2056}

◆ CmpHelperSTRNE() [1/2]

AssertionResult testing::internal::CmpHelperSTRNE ( const char *  s1_expression,
const char *  s2_expression,
const char *  s1,
const char *  s2 
)

Definition at line 1692 of file gtest.cc.

1695 {
1696 if (!String::CStringEquals(s1, s2)) {
1697 return AssertionSuccess();
1698 } else {
1699 return AssertionFailure() << "Expected: (" << s1_expression << ") != ("
1700 << s2_expression << "), actual: \""
1701 << s1 << "\" vs \"" << s2 << "\"";
1702 }
1703}

◆ CmpHelperSTRNE() [2/2]

AssertionResult testing::internal::CmpHelperSTRNE ( const char *  s1_expression,
const char *  s2_expression,
const wchar_t *  s1,
const wchar_t *  s2 
)

Definition at line 2059 of file gtest.cc.

2062 {
2063 if (!String::WideCStringEquals(s1, s2)) {
2064 return AssertionSuccess();
2065 }
2066
2067 return AssertionFailure() << "Expected: (" << s1_expression << ") != ("
2068 << s2_expression << "), actual: "
2069 << PrintToString(s1)
2070 << " vs " << PrintToString(s2);
2071}

◆ CodePointToUtf8()

std::string testing::internal::CodePointToUtf8 ( uint32_t  code_point)

Definition at line 1930 of file gtest.cc.

1930 {
1931 if (code_point > kMaxCodePoint4) {
1932 return "(Invalid Unicode 0x" + String::FormatHexUInt32(code_point) + ")";
1933 }
1934
1935 char str[5]; // Big enough for the largest valid code point.
1936 if (code_point <= kMaxCodePoint1) {
1937 str[1] = '\0';
1938 str[0] = static_cast<char>(code_point); // 0xxxxxxx
1939 } else if (code_point <= kMaxCodePoint2) {
1940 str[2] = '\0';
1941 str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
1942 str[0] = static_cast<char>(0xC0 | code_point); // 110xxxxx
1943 } else if (code_point <= kMaxCodePoint3) {
1944 str[3] = '\0';
1945 str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
1946 str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
1947 str[0] = static_cast<char>(0xE0 | code_point); // 1110xxxx
1948 } else { // code_point <= kMaxCodePoint4
1949 str[4] = '\0';
1950 str[3] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
1951 str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
1952 str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx
1953 str[0] = static_cast<char>(0xF0 | code_point); // 11110xxx
1954 }
1955 return str;
1956}
constexpr uint32_t kMaxCodePoint3
Definition: gtest.cc:1910
constexpr uint32_t kMaxCodePoint2
Definition: gtest.cc:1907
constexpr uint32_t kMaxCodePoint1
Definition: gtest.cc:1904
constexpr uint32_t kMaxCodePoint4
Definition: gtest.cc:1913
uint32_t ChopLowBits(uint32_t *bits, int n)
Definition: gtest.cc:1918

◆ ConvertIdentifierNameToWords()

GTEST_API_ std::string testing::internal::ConvertIdentifierNameToWords ( const char *  id_name)

Definition at line 72 of file gmock-internal-utils.cc.

72 {
73 std::string result;
74 char prev_char = '\0';
75 for (const char* p = id_name; *p != '\0'; prev_char = *(p++)) {
76 // We don't care about the current locale as the input is
77 // guaranteed to be a valid C++ identifier name.
78 const bool starts_new_word = IsUpper(*p) ||
79 (!IsAlpha(prev_char) && IsLower(*p)) ||
80 (!IsDigit(prev_char) && IsDigit(*p));
81
82 if (IsAlNum(*p)) {
83 if (starts_new_word && result != "")
84 result += ' ';
85 result += ToLower(*p);
86 }
87 }
88 return result;
89}
const char * p
bool IsDigit(char ch)
Definition: gtest-port.h:1928
bool IsAlNum(char ch)
Definition: gtest-port.h:1925
bool IsUpper(char ch)
Definition: gtest-port.h:1937
bool IsLower(char ch)
Definition: gtest-port.h:1931
char ToLower(char ch)
Definition: gtest-port.h:1961
bool IsAlpha(char ch)
Definition: gtest-port.h:1922

◆ CopyArray() [1/3]

template<typename T , typename U >
void testing::internal::CopyArray ( const T &  from,
U *  to 
)
inline

Definition at line 1060 of file gtest-internal.h.

1060{ *to = from; }

◆ CopyArray() [2/3]

template<typename T , typename U >
void testing::internal::CopyArray ( const T *  from,
size_t  size,
U *  to 
)

Definition at line 1072 of file gtest-internal.h.

1072 {
1073 for (size_t i = 0; i != size; i++) {
1074 internal::CopyArray(from[i], to + i);
1075 }
1076}
void CopyArray(const T(&from)[N], U(*to)[N])

◆ CopyArray() [3/3]

template<typename T , typename U , size_t N>
void testing::internal::CopyArray ( const T(&)  from[N],
U(*)  to[N] 
)
inline

Definition at line 1064 of file gtest-internal.h.

1064 {
1065 internal::CopyArray(from, N, *to);
1066}

◆ CreateCodePointFromUtf16SurrogatePair()

uint32_t testing::internal::CreateCodePointFromUtf16SurrogatePair ( wchar_t  first,
wchar_t  second 
)
inline

Definition at line 1971 of file gtest.cc.

1972 {
1973 const auto first_u = static_cast<uint32_t>(first);
1974 const auto second_u = static_cast<uint32_t>(second);
1975 const uint32_t mask = (1 << 10) - 1;
1976 return (sizeof(wchar_t) == 2)
1977 ? (((first_u & mask) << 10) | (second_u & mask)) + 0x10000
1978 :
1979 // This function should not be called when the condition is
1980 // false, but we provide a sensible default in case it is.
1981 first_u;
1982}

◆ DefaultParamName()

template<class ParamType >
std::string testing::internal::DefaultParamName ( const TestParamInfo< ParamType > &  info)

Definition at line 376 of file gtest-param-util.h.

376 {
377 Message name_stream;
378 name_stream << info.index;
379 return name_stream.GetString();
380}

◆ DiffStrings()

GTEST_API_ std::string testing::internal::DiffStrings ( const std::string &  left,
const std::string &  right,
size_t *  total_line_count 
)

◆ DoubleNearPredFormat()

AssertionResult testing::internal::DoubleNearPredFormat ( const char *  expr1,
const char *  expr2,
const char *  abs_error_expr,
double  val1,
double  val2,
double  abs_error 
)

Definition at line 1563 of file gtest.cc.

1568 {
1569 const double diff = fabs(val1 - val2);
1570 if (diff <= abs_error) return AssertionSuccess();
1571
1572 // Find the value which is closest to zero.
1573 const double min_abs = std::min(fabs(val1), fabs(val2));
1574 // Find the distance to the next double from that value.
1575 const double epsilon =
1576 nextafter(min_abs, std::numeric_limits<double>::infinity()) - min_abs;
1577 // Detect the case where abs_error is so small that EXPECT_NEAR is
1578 // effectively the same as EXPECT_EQUAL, and give an informative error
1579 // message so that the situation can be more easily understood without
1580 // requiring exotic floating-point knowledge.
1581 // Don't do an epsilon check if abs_error is zero because that implies
1582 // that an equality check was actually intended.
1583 if (!(std::isnan)(val1) && !(std::isnan)(val2) && abs_error > 0 &&
1584 abs_error < epsilon) {
1585 return AssertionFailure()
1586 << "The difference between " << expr1 << " and " << expr2 << " is "
1587 << diff << ", where\n"
1588 << expr1 << " evaluates to " << val1 << ",\n"
1589 << expr2 << " evaluates to " << val2 << ".\nThe abs_error parameter "
1590 << abs_error_expr << " evaluates to " << abs_error
1591 << " which is smaller than the minimum distance between doubles for "
1592 "numbers of this magnitude which is "
1593 << epsilon
1594 << ", thus making this EXPECT_NEAR check equivalent to "
1595 "EXPECT_EQUAL. Consider using EXPECT_DOUBLE_EQ instead.";
1596 }
1597 return AssertionFailure()
1598 << "The difference between " << expr1 << " and " << expr2
1599 << " is " << diff << ", which exceeds " << abs_error_expr << ", where\n"
1600 << expr1 << " evaluates to " << val1 << ",\n"
1601 << expr2 << " evaluates to " << val2 << ", and\n"
1602 << abs_error_expr << " evaluates to " << abs_error << ".";
1603}

◆ DownCast_()

template<typename To , typename From >
To testing::internal::DownCast_ ( From *  f)
inline

Definition at line 1091 of file gtest-port.h.

1091 { // so we only accept pointers
1092 // Ensures that To is a sub-type of From *. This test is here only
1093 // for compile-time type checking, and has no overhead in an
1094 // optimized build at run-time, as it will be optimized away
1095 // completely.
1097 if (false) {
1099 const To to = nullptr;
1100 ::testing::internal::ImplicitCast_<From*>(to);
1101 }
1102
1103#if GTEST_HAS_RTTI
1104 // RTTI: debug mode only!
1105 GTEST_CHECK_(f == nullptr || dynamic_cast<To>(f) != nullptr);
1106#endif
1107 return static_cast<To>(f);
1108}
#define GTEST_INTENTIONAL_CONST_COND_PUSH_()
Definition: gtest-port.h:731
#define GTEST_INTENTIONAL_CONST_COND_POP_()
Definition: gtest-port.h:733
To ImplicitCast_(To x)
Definition: gtest-port.h:1067
const
Definition: upload.py:413

◆ EqFailure()

AssertionResult testing::internal::EqFailure ( const char *  expected_expression,
const char *  actual_expression,
const std::string &  expected_value,
const std::string &  actual_value,
bool  ignoring_case 
)

Definition at line 1512 of file gtest.cc.

1516 {
1517 Message msg;
1518 msg << "Expected equality of these values:";
1519 msg << "\n " << lhs_expression;
1520 if (lhs_value != lhs_expression) {
1521 msg << "\n Which is: " << lhs_value;
1522 }
1523 msg << "\n " << rhs_expression;
1524 if (rhs_value != rhs_expression) {
1525 msg << "\n Which is: " << rhs_value;
1526 }
1527
1528 if (ignoring_case) {
1529 msg << "\nIgnoring case";
1530 }
1531
1532 if (!lhs_value.empty() && !rhs_value.empty()) {
1533 const std::vector<std::string> lhs_lines =
1534 SplitEscapedString(lhs_value);
1535 const std::vector<std::string> rhs_lines =
1536 SplitEscapedString(rhs_value);
1537 if (lhs_lines.size() > 1 || rhs_lines.size() > 1) {
1538 msg << "\nWith diff:\n"
1539 << edit_distance::CreateUnifiedDiff(lhs_lines, rhs_lines);
1540 }
1541 }
1542
1543 return AssertionFailure() << msg;
1544}
GTEST_API_ std::string CreateUnifiedDiff(const std::vector< std::string > &left, const std::vector< std::string > &right, size_t context=2)
Definition: gtest.cc:1402

◆ Expect() [1/2]

void testing::internal::Expect ( bool  condition,
const char *  file,
int  line 
)
inline

Definition at line 235 of file gmock-internal-utils.h.

235 {
236 Expect(condition, file, line, "Expectation failed.");
237}
void Expect(bool condition, const char *file, int line)

◆ Expect() [2/2]

void testing::internal::Expect ( bool  condition,
const char *  file,
int  line,
const std::string &  msg 
)
inline

Definition at line 228 of file gmock-internal-utils.h.

229 {
230 if (!condition) {
231 GetFailureReporter()->ReportFailure(FailureReporterInterface::kNonfatal,
232 file, line, msg);
233 }
234}

◆ FindMaxBipartiteMatching()

GTEST_API_ ElementMatcherPairs testing::internal::FindMaxBipartiteMatching ( const MatchMatrix &  g)

◆ FloatingPointLE()

template<typename RawType >
AssertionResult testing::internal::FloatingPointLE ( const char *  expr1,
const char *  expr2,
RawType  val1,
RawType  val2 
)

Definition at line 1608 of file gtest.cc.

1611 {
1612 // Returns success if val1 is less than val2,
1613 if (val1 < val2) {
1614 return AssertionSuccess();
1615 }
1616
1617 // or if val1 is almost equal to val2.
1618 const FloatingPoint<RawType> lhs(val1), rhs(val2);
1619 if (lhs.AlmostEquals(rhs)) {
1620 return AssertionSuccess();
1621 }
1622
1623 // Note that the above two checks will both fail if either val1 or
1624 // val2 is NaN, as the IEEE floating-point standard requires that
1625 // any predicate involving a NaN must return false.
1626
1627 ::std::stringstream val1_ss;
1628 val1_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
1629 << val1;
1630
1631 ::std::stringstream val2_ss;
1632 val2_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
1633 << val2;
1634
1635 return AssertionFailure()
1636 << "Expected: (" << expr1 << ") <= (" << expr2 << ")\n"
1637 << " Actual: " << StringStreamToString(&val1_ss) << " vs "
1638 << StringStreamToString(&val2_ss);
1639}

◆ FlushInfoLog()

void testing::internal::FlushInfoLog ( )
inline

Definition at line 989 of file gtest-port.h.

989{ fflush(nullptr); }

◆ FormatCompilerIndependentFileLocation()

GTEST_API_::std::string testing::internal::FormatCompilerIndependentFileLocation ( const char *  file,
int  line 
)

Definition at line 1041 of file gtest-port.cc.

1042 {
1043 const std::string file_name(file == nullptr ? kUnknownFile : file);
1044
1045 if (line < 0)
1046 return file_name;
1047 else
1048 return file_name + ":" + StreamableToString(line);
1049}
std::string StreamableToString(const T &streamable)
const char kUnknownFile[]
Definition: gtest-port.cc:1019

◆ FormatEpochTimeInMillisAsIso8601()

std::string testing::internal::FormatEpochTimeInMillisAsIso8601 ( TimeInMillis  ms)

Definition at line 4110 of file gtest.cc.

4110 {
4111 struct tm time_struct;
4112 if (!PortableLocaltime(static_cast<time_t>(ms / 1000), &time_struct))
4113 return "";
4114 // YYYY-MM-DDThh:mm:ss.sss
4115 return StreamableToString(time_struct.tm_year + 1900) + "-" +
4116 String::FormatIntWidth2(time_struct.tm_mon + 1) + "-" +
4117 String::FormatIntWidth2(time_struct.tm_mday) + "T" +
4118 String::FormatIntWidth2(time_struct.tm_hour) + ":" +
4119 String::FormatIntWidth2(time_struct.tm_min) + ":" +
4120 String::FormatIntWidth2(time_struct.tm_sec) + "." +
4121 String::FormatIntWidthN(static_cast<int>(ms % 1000), 3);
4122}

◆ FormatFileLocation()

GTEST_API_::std::string testing::internal::FormatFileLocation ( const char *  file,
int  line 
)

Definition at line 1023 of file gtest-port.cc.

1023 {
1024 const std::string file_name(file == nullptr ? kUnknownFile : file);
1025
1026 if (line < 0) {
1027 return file_name + ":";
1028 }
1029#ifdef _MSC_VER
1030 return file_name + "(" + StreamableToString(line) + "):";
1031#else
1032 return file_name + ":" + StreamableToString(line) + ":";
1033#endif // _MSC_VER
1034}

◆ FormatForComparisonFailureMessage()

template<typename T1 , typename T2 >
std::string testing::internal::FormatForComparisonFailureMessage ( const T1 value,
const T2  
)

◆ FormatMatcherDescription()

GTEST_API_ std::string testing::internal::FormatMatcherDescription ( bool  negation,
const char *  matcher_name,
const Strings param_values 
)

Definition at line 51 of file gmock-matchers.cc.

53 {
54 std::string result = ConvertIdentifierNameToWords(matcher_name);
55 if (param_values.size() >= 1) result += " " + JoinAsTuple(param_values);
56 return negation ? "not (" + result + ")" : result;
57}
GTEST_API_ std::string ConvertIdentifierNameToWords(const char *id_name)
GTEST_API_ std::string JoinAsTuple(const Strings &fields)

◆ FormatTimeInMillisAsSeconds()

std::string testing::internal::FormatTimeInMillisAsSeconds ( TimeInMillis  ms)

Definition at line 4083 of file gtest.cc.

4083 {
4084 ::std::stringstream ss;
4085 ss << (static_cast<double>(ms) * 1e-3);
4086 return ss.str();
4087}

◆ GenerateNames()

template<typename NameGenerator , typename Types >
std::vector< std::string > testing::internal::GenerateNames ( )

Definition at line 698 of file gtest-internal.h.

698 {
699 std::vector<std::string> result;
700 GenerateNamesRecursively<NameGenerator>(Types(), &result, 0);
701 return result;
702}
internal::ProxyTypeList< Ts... > Types

◆ GenerateNamesRecursively() [1/2]

template<typename NameGenerator >
void testing::internal::GenerateNamesRecursively ( internal::None  ,
std::vector< std::string > *  ,
int   
)

Definition at line 688 of file gtest-internal.h.

688{}

◆ GenerateNamesRecursively() [2/2]

template<typename NameGenerator , typename Types >
void testing::internal::GenerateNamesRecursively ( Types  ,
std::vector< std::string > *  result,
int  i 
)

Definition at line 691 of file gtest-internal.h.

691 {
692 result->push_back(NameGenerator::template GetName<typename Types::Head>(i));
693 GenerateNamesRecursively<NameGenerator>(typename Types::Tail(), result,
694 i + 1);
695}

◆ GetArgvs()

std::vector< std::string > testing::internal::GetArgvs ( )

Definition at line 580 of file gtest.cc.

580 {
581#if defined(GTEST_CUSTOM_GET_ARGVS_)
582 // GTEST_CUSTOM_GET_ARGVS_() may return a container of std::string or
583 // ::string. This code converts it to the appropriate type.
584 const auto& custom = GTEST_CUSTOM_GET_ARGVS_();
585 return ::std::vector<std::string>(custom.begin(), custom.end());
586#else // defined(GTEST_CUSTOM_GET_ARGVS_)
587 return g_argvs;
588#endif // defined(GTEST_CUSTOM_GET_ARGVS_)
589}
static ::std::vector< std::string > g_argvs
Definition: gtest.cc:578

◆ GetBoolAssertionFailureMessage()

std::string testing::internal::GetBoolAssertionFailureMessage ( const AssertionResult &  assertion_result,
const char *  expression_text,
const char *  actual_predicate_value,
const char *  expected_predicate_value 
)

Definition at line 1547 of file gtest.cc.

1551 {
1552 const char* actual_message = assertion_result.message();
1553 Message msg;
1554 msg << "Value of: " << expression_text
1555 << "\n Actual: " << actual_predicate_value;
1556 if (actual_message[0] != '\0')
1557 msg << " (" << actual_message << ")";
1558 msg << "\nExpected: " << expected_predicate_value;
1559 return msg.GetString();
1560}

◆ GetCapturedStderr()

GTEST_API_ std::string testing::internal::GetCapturedStderr ( )

◆ GetCapturedStdout()

GTEST_API_ std::string testing::internal::GetCapturedStdout ( )

◆ GetCurrentExecutableName()

FilePath testing::internal::GetCurrentExecutableName ( )

Definition at line 593 of file gtest.cc.

593 {
594 FilePath result;
595
596#if GTEST_OS_WINDOWS || GTEST_OS_OS2
597 result.Set(FilePath(GetArgvs()[0]).RemoveExtension("exe"));
598#else
599 result.Set(FilePath(GetArgvs()[0]));
600#endif // GTEST_OS_WINDOWS
601
602 return result.RemoveDirectoryName();
603}
GTEST_API_ std::vector< std::string > GetArgvs()
Definition: gtest.cc:580

◆ GetCurrentOsStackTraceExceptTop()

std::string testing::internal::GetCurrentOsStackTraceExceptTop ( UnitTest unit_test,
int  skip_count 
)

Definition at line 6225 of file gtest.cc.

6226 {
6227 // We pass skip_count + 1 to skip this wrapper function in addition
6228 // to what the user really wants to skip.
6229 return GetUnitTestImpl()->CurrentOsStackTraceExceptTop(skip_count + 1);
6230}

◆ GetFailureReporter()

GTEST_API_ FailureReporterInterface * testing::internal::GetFailureReporter ( )

Definition at line 112 of file gmock-internal-utils.cc.

112 {
113 // Points to the global failure reporter used by Google Mock. gcc
114 // guarantees that the following use of failure_reporter is
115 // thread-safe. We may need to add additional synchronization to
116 // protect failure_reporter if we port Google Mock to other
117 // compilers.
118 static FailureReporterInterface* const failure_reporter =
120 return failure_reporter;
121}

◆ GetFileSize()

size_t testing::internal::GetFileSize ( FILE *  file)

Definition at line 1242 of file gtest-port.cc.

1242 {
1243 fseek(file, 0, SEEK_END);
1244 return static_cast<size_t>(ftell(file));
1245}

◆ GetIgnoredParameterizedTestSuites()

std::set< std::string > * testing::internal::GetIgnoredParameterizedTestSuites ( )

Definition at line 458 of file gtest.cc.

458 {
459 return UnitTest::GetInstance()->impl()->ignored_parameterized_test_suites();
460}

◆ GetNotDefaultOrNull()

SetUpTearDownSuiteFuncType testing::internal::GetNotDefaultOrNull ( SetUpTearDownSuiteFuncType  a,
SetUpTearDownSuiteFuncType  def 
)
inline

Definition at line 506 of file gtest-internal.h.

507 {
508 return a == def ? nullptr : a;
509}

◆ GetPrefixUntilComma()

std::string testing::internal::GetPrefixUntilComma ( const char *  str)
inline

Definition at line 663 of file gtest-internal.h.

663 {
664 const char* comma = strchr(str, ',');
665 return comma == nullptr ? str : std::string(str, comma);
666}

◆ GetRawPointer() [1/2]

template<typename Pointer >
const Pointer::element_type * testing::internal::GetRawPointer ( const Pointer &  p)
inline

Definition at line 78 of file gmock-internal-utils.h.

78 {
79 return p.get();
80}

◆ GetRawPointer() [2/2]

template<typename Element >
Element * testing::internal::GetRawPointer ( Element *  p)
inline

Definition at line 83 of file gmock-internal-utils.h.

83{ return p; }

◆ GetTestTypeId()

TypeId testing::internal::GetTestTypeId ( )

Definition at line 847 of file gtest.cc.

847 {
848 return GetTypeId<Test>();
849}

◆ GetThreadCount()

size_t testing::internal::GetThreadCount ( )

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

273 {
274 // There's no portable way to detect the number of threads, so we just
275 // return 0 to indicate that we cannot detect it.
276 return 0;
277}

◆ GetTimeInMillis()

TimeInMillis testing::internal::GetTimeInMillis ( )

Definition at line 1053 of file gtest.cc.

1053 {
1054 return std::chrono::duration_cast<std::chrono::milliseconds>(
1055 std::chrono::system_clock::now() -
1056 std::chrono::system_clock::from_time_t(0))
1057 .count();
1058}

◆ GetTypeId()

template<typename T >
TypeId testing::internal::GetTypeId ( )

Definition at line 435 of file gtest-internal.h.

435 {
436 // The compiler is required to allocate a different
437 // TypeIdHelper<T>::dummy_ variable for each T used to instantiate
438 // the template. Therefore, the address of dummy_ is guaranteed to
439 // be unique.
440 return &(TypeIdHelper<T>::dummy_);
441}

◆ GetTypeName()

template<typename T >
std::string testing::internal::GetTypeName ( )

Definition at line 93 of file gtest-type-util.h.

93 {
94#if GTEST_HAS_RTTI
95 return GetTypeName(typeid(T));
96#else
97 return "<type>";
98#endif // GTEST_HAS_RTTI
99}
std::string GetTypeName()

◆ GetWithoutMatchers()

GTEST_API_ WithoutMatchers testing::internal::GetWithoutMatchers ( )

◆ GMOCK_DECLARE_KIND_() [1/16]

testing::internal::GMOCK_DECLARE_KIND_ ( bool  ,
kBool   
)

◆ GMOCK_DECLARE_KIND_() [2/16]

testing::internal::GMOCK_DECLARE_KIND_ ( char  ,
kInteger   
)

◆ GMOCK_DECLARE_KIND_() [3/16]

testing::internal::GMOCK_DECLARE_KIND_ ( double  ,
kFloatingPoint   
)

◆ GMOCK_DECLARE_KIND_() [4/16]

testing::internal::GMOCK_DECLARE_KIND_ ( float  ,
kFloatingPoint   
)

◆ GMOCK_DECLARE_KIND_() [5/16]

testing::internal::GMOCK_DECLARE_KIND_ ( int  ,
kInteger   
)

◆ GMOCK_DECLARE_KIND_() [6/16]

testing::internal::GMOCK_DECLARE_KIND_ ( long double  ,
kFloatingPoint   
)

◆ GMOCK_DECLARE_KIND_() [7/16]

testing::internal::GMOCK_DECLARE_KIND_ ( long long  ,
kInteger   
)

◆ GMOCK_DECLARE_KIND_() [8/16]

testing::internal::GMOCK_DECLARE_KIND_ ( long  ,
kInteger   
)

◆ GMOCK_DECLARE_KIND_() [9/16]

testing::internal::GMOCK_DECLARE_KIND_ ( short  ,
kInteger   
)

◆ GMOCK_DECLARE_KIND_() [10/16]

testing::internal::GMOCK_DECLARE_KIND_ ( signed char  ,
kInteger   
)

◆ GMOCK_DECLARE_KIND_() [11/16]

testing::internal::GMOCK_DECLARE_KIND_ ( unsigned char  ,
kInteger   
)

◆ GMOCK_DECLARE_KIND_() [12/16]

testing::internal::GMOCK_DECLARE_KIND_ ( unsigned int  ,
kInteger   
)

◆ GMOCK_DECLARE_KIND_() [13/16]

testing::internal::GMOCK_DECLARE_KIND_ ( unsigned long long  ,
kInteger   
)

◆ GMOCK_DECLARE_KIND_() [14/16]

testing::internal::GMOCK_DECLARE_KIND_ ( unsigned long  ,
kInteger   
)

◆ GMOCK_DECLARE_KIND_() [15/16]

testing::internal::GMOCK_DECLARE_KIND_ ( unsigned short  ,
kInteger   
)

◆ GMOCK_DECLARE_KIND_() [16/16]

testing::internal::GMOCK_DECLARE_KIND_ ( wchar_t  ,
kInteger   
)

◆ GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_() [1/16]

testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ ( ::std::string  ,
""   
)

◆ GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_() [2/16]

testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ ( bool  ,
false   
)

◆ GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_() [3/16]

testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ ( char  ,
'\0'   
)

◆ GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_() [4/16]

testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ ( double  ,
 
)

◆ GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_() [5/16]

testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ ( float  ,
 
)

◆ GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_() [6/16]

testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ ( signed char  ,
'\0'   
)

◆ GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_() [7/16]

testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ ( signed int  ,
 
)

◆ GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_() [8/16]

testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ ( signed long long  ,
 
)

◆ GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_() [9/16]

testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ ( signed long  ,
0L   
)

◆ GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_() [10/16]

testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ ( signed short  ,
 
)

◆ GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_() [11/16]

testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ ( unsigned char  ,
'\0'   
)

◆ GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_() [12/16]

testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ ( unsigned int  ,
0U   
)

◆ GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_() [13/16]

testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ ( unsigned long long  ,
 
)

◆ GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_() [14/16]

testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ ( unsigned long  ,
0UL   
)

◆ GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_() [15/16]

testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ ( unsigned short  ,
0U   
)

◆ GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_() [16/16]

testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ ( void  )

◆ GTEST_DECLARE_string_()

testing::internal::GTEST_DECLARE_string_ ( internal_run_death_test  )

◆ GTEST_DEFINE_STATIC_MUTEX_()

GTEST_API_ testing::internal::GTEST_DEFINE_STATIC_MUTEX_ ( g_gmock_mutex  )

◆ GTEST_DEFINE_string_()

testing::internal::GTEST_DEFINE_string_ ( internal_run_death_test  ,
""  ,
"Indicates the  file,
line  number,
temporal index of " "the single death test to  run,
and a file descriptor to " "which a success code may be  sent,
all separated by " "the '|' characters. This flag is specified if and only if the " "current process is a sub-process launched for running a thread-safe " "death test. FOR INTERNAL USE ONLY."   
)

◆ GTEST_DISABLE_MSC_WARNINGS_POP_()

testing::internal::GTEST_DISABLE_MSC_WARNINGS_POP_ ( ) const

Definition at line 648 of file gtest-internal.h.

652 {
653 const char* comma = strchr(str, ',');
654 if (comma == nullptr) {
655 return nullptr;
656 }
657 while (IsSpace(*(++comma))) {}
658 return comma;
659}
bool IsSpace(char ch)
Definition: gtest-port.h:1934

◆ GTEST_DISABLE_MSC_WARNINGS_PUSH_()

testing::internal::GTEST_DISABLE_MSC_WARNINGS_PUSH_ ( 4251  )

Definition at line 593 of file gtest-internal.h.

597 {
598 public:
599 TypedTestSuitePState() : registered_(false) {}
600
601 // Adds the given test name to defined_test_names_ and return true
602 // if the test suite hasn't been registered; otherwise aborts the
603 // program.
604 bool AddTestName(const char* file, int line, const char* case_name,
605 const char* test_name) {
606 if (registered_) {
607 fprintf(stderr,
608 "%s Test %s must be defined before "
609 "REGISTER_TYPED_TEST_SUITE_P(%s, ...).\n",
610 FormatFileLocation(file, line).c_str(), test_name, case_name);
611 fflush(stderr);
612 posix::Abort();
613 }
614 registered_tests_.insert(
615 ::std::make_pair(test_name, CodeLocation(file, line)));
616 return true;
617 }
618
619 bool TestExists(const std::string& test_name) const {
620 return registered_tests_.count(test_name) > 0;
621 }
622
623 const CodeLocation& GetCodeLocation(const std::string& test_name) const {
624 RegisteredTestsMap::const_iterator it = registered_tests_.find(test_name);
625 GTEST_CHECK_(it != registered_tests_.end());
626 return it->second;
627 }
628
629 // Verifies that registered_tests match the test names in
630 // defined_test_names_; returns registered_tests if successful, or
631 // aborts the program otherwise.
632 const char* VerifyRegisteredTestNames(const char* test_suite_name,
633 const char* file, int line,
634 const char* registered_tests);
635
636 private:
637 typedef ::std::map<std::string, CodeLocation> RegisteredTestsMap;
638
639 bool registered_;
640 RegisteredTestsMap registered_tests_;
641};
GTEST_API_::std::string FormatFileLocation(const char *file, int line)
Definition: gtest-port.cc:1023

◆ GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_() [1/4]

testing::internal::GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_ ( char  )

◆ GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_() [2/4]

testing::internal::GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_ ( char16_t  )

◆ GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_() [3/4]

testing::internal::GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_ ( char32_t  )

◆ GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_() [4/4]

testing::internal::GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_ ( wchar_t  )

◆ GTEST_IMPL_FORMAT_C_STRING_AS_STRING_() [1/3]

testing::internal::GTEST_IMPL_FORMAT_C_STRING_AS_STRING_ ( char  ,
::std::string   
)

◆ GTEST_IMPL_FORMAT_C_STRING_AS_STRING_() [2/3]

testing::internal::GTEST_IMPL_FORMAT_C_STRING_AS_STRING_ ( char16_t  ,
::std::u16string   
)

◆ GTEST_IMPL_FORMAT_C_STRING_AS_STRING_() [3/3]

testing::internal::GTEST_IMPL_FORMAT_C_STRING_AS_STRING_ ( char32_t  ,
::std::u32string   
)

◆ GTEST_INTERNAL_DEPRECATED() [1/5]

testing::internal::GTEST_INTERNAL_DEPRECATED ( "INSTANTIATE_TEST_CASE_P is  deprecated,
please use " "INSTANTIATE_TEST_SUITE_P  
) const

Definition at line 1294 of file gtest-internal.h.

1297 { return true; }

◆ GTEST_INTERNAL_DEPRECATED() [2/5]

testing::internal::GTEST_INTERNAL_DEPRECATED ( "INSTANTIATE_TYPED_TEST_CASE_P is  deprecated,
please use " "INSTANTIATE_TYPED_TEST_SUITE_P  
) const

Definition at line 1314 of file gtest-internal.h.

1317 { return true; }

◆ GTEST_INTERNAL_DEPRECATED() [3/5]

testing::internal::GTEST_INTERNAL_DEPRECATED ( "REGISTER_TYPED_TEST_CASE_P is  deprecated,
please use " "REGISTER_TYPED_TEST_SUITE_P  
) const

Definition at line 1309 of file gtest-internal.h.

1312 { return true; }

◆ GTEST_INTERNAL_DEPRECATED() [4/5]

testing::internal::GTEST_INTERNAL_DEPRECATED ( "TYPED_TEST_CASE is  deprecated,
please use " "TYPED_TEST_SUITE  
) const

Definition at line 1304 of file gtest-internal.h.

1307 { return true; }

◆ GTEST_INTERNAL_DEPRECATED() [5/5]

testing::internal::GTEST_INTERNAL_DEPRECATED ( "TYPED_TEST_CASE_P is  deprecated,
please use " "TYPED_TEST_SUITE_P  
) const

Definition at line 1299 of file gtest-internal.h.

1302 { return true; }

◆ HandleExceptionsInMethodIfSupported()

template<class T , typename Result >
Result testing::internal::HandleExceptionsInMethodIfSupported ( T *  object,
Result(T::*)()  method,
const char *  location 
)

Definition at line 2615 of file gtest.cc.

2616 {
2617 // NOTE: The user code can affect the way in which Google Test handles
2618 // exceptions by setting GTEST_FLAG(catch_exceptions), but only before
2619 // RUN_ALL_TESTS() starts. It is technically possible to check the flag
2620 // after the exception is caught and either report or re-throw the
2621 // exception based on the flag's value:
2622 //
2623 // try {
2624 // // Perform the test method.
2625 // } catch (...) {
2626 // if (GTEST_FLAG(catch_exceptions))
2627 // // Report the exception as failure.
2628 // else
2629 // throw; // Re-throws the original exception.
2630 // }
2631 //
2632 // However, the purpose of this flag is to allow the program to drop into
2633 // the debugger when the exception is thrown. On most platforms, once the
2634 // control enters the catch block, the exception origin information is
2635 // lost and the debugger will stop the program at the point of the
2636 // re-throw in this function -- instead of at the point of the original
2637 // throw statement in the code under test. For this reason, we perform
2638 // the check early, sacrificing the ability to affect Google Test's
2639 // exception handling in the method where the exception is thrown.
2640 if (internal::GetUnitTestImpl()->catch_exceptions()) {
2641#if GTEST_HAS_EXCEPTIONS
2642 try {
2643 return HandleSehExceptionsInMethodIfSupported(object, method, location);
2644 } catch (const AssertionException&) { // NOLINT
2645 // This failure was reported already.
2646 } catch (const internal::GoogleTestFailureException&) { // NOLINT
2647 // This exception type can only be thrown by a failed Google
2648 // Test assertion with the intention of letting another testing
2649 // framework catch it. Therefore we just re-throw it.
2650 throw;
2651 } catch (const std::exception& e) { // NOLINT
2653 TestPartResult::kFatalFailure,
2654 FormatCxxExceptionMessage(e.what(), location));
2655 } catch (...) { // NOLINT
2657 TestPartResult::kFatalFailure,
2658 FormatCxxExceptionMessage(nullptr, location));
2659 }
2660 return static_cast<Result>(0);
2661#else
2662 return HandleSehExceptionsInMethodIfSupported(object, method, location);
2663#endif // GTEST_HAS_EXCEPTIONS
2664 } else {
2665 return (object->*method)();
2666 }
2667}
void ReportFailureInUnknownLocation(TestPartResult::Type result_type, const std::string &message)
Definition: gtest.cc:2455
Result HandleSehExceptionsInMethodIfSupported(T *object, Result(T::*method)(), const char *location)
Definition: gtest.cc:2588

◆ HandleSehExceptionsInMethodIfSupported()

template<class T , typename Result >
Result testing::internal::HandleSehExceptionsInMethodIfSupported ( T *  object,
Result(T::*)()  method,
const char *  location 
)

Definition at line 2588 of file gtest.cc.

2589 {
2590#if GTEST_HAS_SEH
2591 __try {
2592 return (object->*method)();
2593 } __except (internal::UnitTestOptions::GTestShouldProcessSEH( // NOLINT
2594 GetExceptionCode())) {
2595 // We create the exception message on the heap because VC++ prohibits
2596 // creation of objects with destructors on stack in functions using __try
2597 // (see error C2712).
2598 std::string* exception_message = FormatSehExceptionMessage(
2599 GetExceptionCode(), location);
2600 internal::ReportFailureInUnknownLocation(TestPartResult::kFatalFailure,
2601 *exception_message);
2602 delete exception_message;
2603 return static_cast<Result>(0);
2604 }
2605#else
2606 (void)location;
2607 return (object->*method)();
2608#endif // GTEST_HAS_SEH
2609}

◆ HasStrictnessModifier()

template<typename T >
constexpr bool testing::internal::HasStrictnessModifier ( )
constexpr

Definition at line 89 of file gmock-nice-strict.h.

89 {
90 return decltype(StrictnessModifierProbe(std::declval<const T&>()))::value;
91}
std::false_type StrictnessModifierProbe(...)

◆ IllegalDoDefault()

GTEST_API_ void testing::internal::IllegalDoDefault ( const char *  file,
int  line 
)

Definition at line 189 of file gmock-internal-utils.cc.

189 {
191 false, file, line,
192 "You are using DoDefault() inside a composite action like "
193 "DoAll() or WithArgs(). This is not supported for technical "
194 "reasons. Please instead spell out the default action, or "
195 "assign the default action to an Action variable and use "
196 "the variable in various places.");
197}
void Assert(bool condition, const char *file, int line, const std::string &msg)

◆ ImplicitCast_()

template<typename To >
To testing::internal::ImplicitCast_ ( To  x)
inline

Definition at line 1067 of file gtest-port.h.

1067{ return x; }

◆ InitGoogleMockImpl()

template<typename CharType >
void testing::internal::InitGoogleMockImpl ( int *  argc,
CharType **  argv 
)

Definition at line 144 of file gmock.cc.

144 {
145 // Makes sure Google Test is initialized. InitGoogleTest() is
146 // idempotent, so it's fine if the user has already called it.
147 InitGoogleTest(argc, argv);
148 if (*argc <= 0) return;
149
150 for (int i = 1; i != *argc; i++) {
151 const std::string arg_string = StreamableToString(argv[i]);
152 const char* const arg = arg_string.c_str();
153
154 // Do we see a Google Mock flag?
155 if (ParseGoogleMockBoolFlag(arg, "catch_leaked_mocks",
156 &GMOCK_FLAG(catch_leaked_mocks)) ||
157 ParseGoogleMockStringFlag(arg, "verbose", &GMOCK_FLAG(verbose)) ||
158 ParseGoogleMockIntFlag(arg, "default_mock_behavior",
159 &GMOCK_FLAG(default_mock_behavior))) {
160 // Yes. Shift the remainder of the argv list left by one. Note
161 // that argv has (*argc + 1) elements, the last one always being
162 // NULL. The following loop moves the trailing NULL element as
163 // well.
164 for (int j = i; j != *argc; j++) {
165 argv[j] = argv[j + 1];
166 }
167
168 // Decrements the argument count.
169 (*argc)--;
170
171 // We also need to decrement the iterator as we just removed
172 // an element.
173 i--;
174 }
175 }
176}
#define GMOCK_FLAG(name)
Definition: gmock-port.h:67
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
Definition: gtest.cc:6660

◆ InitGoogleTestImpl()

template<typename CharType >
void testing::internal::InitGoogleTestImpl ( int *  argc,
CharType **  argv 
)

Definition at line 6630 of file gtest.cc.

6630 {
6631 // We don't want to run the initialization code twice.
6632 if (GTestIsInitialized()) return;
6633
6634 if (*argc <= 0) return;
6635
6636 g_argvs.clear();
6637 for (int i = 0; i != *argc; i++) {
6638 g_argvs.push_back(StreamableToString(argv[i]));
6639 }
6640
6641#if GTEST_HAS_ABSL
6642 absl::InitializeSymbolizer(g_argvs[0].c_str());
6643#endif // GTEST_HAS_ABSL
6644
6645 ParseGoogleTestFlagsOnly(argc, argv);
6646 GetUnitTestImpl()->PostFlagParsingInit();
6647}
void ParseGoogleTestFlagsOnly(int *argc, wchar_t **argv)
Definition: gtest.cc:6621

◆ InsertSyntheticTestCase()

void testing::internal::InsertSyntheticTestCase ( const std::string &  name,
CodeLocation  location,
bool  has_test_p 
)

Definition at line 469 of file gtest.cc.

470 {
471 const auto& ignored = *GetIgnoredParameterizedTestSuites();
472 if (ignored.find(name) != ignored.end()) return;
473
474 const char kMissingInstantiation[] = //
475 " is defined via TEST_P, but never instantiated. None of the test cases "
476 "will run. Either no INSTANTIATE_TEST_SUITE_P is provided or the only "
477 "ones provided expand to nothing."
478 "\n\n"
479 "Ideally, TEST_P definitions should only ever be included as part of "
480 "binaries that intend to use them. (As opposed to, for example, being "
481 "placed in a library that may be linked in to get other utilities.)";
482
483 const char kMissingTestCase[] = //
484 " is instantiated via INSTANTIATE_TEST_SUITE_P, but no tests are "
485 "defined via TEST_P . No test cases will run."
486 "\n\n"
487 "Ideally, INSTANTIATE_TEST_SUITE_P should only ever be invoked from "
488 "code that always depend on code that provides TEST_P. Failing to do "
489 "so is often an indication of dead code, e.g. the last TEST_P was "
490 "removed but the rest got left behind.";
491
492 std::string message =
493 "Parameterized test suite " + name +
494 (has_test_p ? kMissingInstantiation : kMissingTestCase) +
495 "\n\n"
496 "To suppress this error for this test suite, insert the following line "
497 "(in a non-header) in the namespace it is defined in:"
498 "\n\n"
499 "GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(" + name + ");";
500
501 std::string full_name = "UninstantiatedParameterizedTestSuite<" + name + ">";
502 RegisterTest( //
503 "GoogleTestVerification", full_name.c_str(),
504 nullptr, // No type parameter.
505 nullptr, // No value parameter.
506 location.file.c_str(), location.line, [message, location] {
507 return new FailureTest(location, message,
508 kErrorOnUninstantiatedParameterizedTest);
509 });
510}
TestInfo * RegisterTest(const char *test_suite_name, const char *test_name, const char *type_param, const char *value_param, const char *file, int line, Factory factory)
Definition: gtest.h:2455
std::set< std::string > * GetIgnoredParameterizedTestSuites()
Definition: gtest.cc:458

◆ Int32FromEnvOrDie()

int32_t testing::internal::Int32FromEnvOrDie ( const char *  var,
int32_t  default_val 
)

Definition at line 5995 of file gtest.cc.

5995 {
5996 const char* str_val = posix::GetEnv(var);
5997 if (str_val == nullptr) {
5998 return default_val;
5999 }
6000
6001 int32_t result;
6002 if (!ParseInt32(Message() << "The value of environment variable " << var,
6003 str_val, &result)) {
6004 exit(EXIT_FAILURE);
6005 }
6006 return result;
6007}
GTEST_API_ bool ParseInt32(const Message &src_text, const char *str, int32_t *value)
Definition: gtest-port.cc:1323

◆ Int32FromGTestEnv()

int32_t testing::internal::Int32FromGTestEnv ( const char *  flag,
int32_t  default_val 
)

Definition at line 1379 of file gtest-port.cc.

1379 {
1380#if defined(GTEST_GET_INT32_FROM_ENV_)
1381 return GTEST_GET_INT32_FROM_ENV_(flag, default_value);
1382#else
1383 const std::string env_var = FlagToEnvVar(flag);
1384 const char* const string_value = posix::GetEnv(env_var.c_str());
1385 if (string_value == nullptr) {
1386 // The environment variable is not set.
1387 return default_value;
1388 }
1389
1390 int32_t result = default_value;
1391 if (!ParseInt32(Message() << "Environment variable " << env_var,
1392 string_value, &result)) {
1393 printf("The default value %s is used.\n",
1394 (Message() << default_value).GetString().c_str());
1395 fflush(stdout);
1396 return default_value;
1397 }
1398
1399 return result;
1400#endif // defined(GTEST_GET_INT32_FROM_ENV_)
1401}

◆ intToCallReaction()

CallReaction testing::internal::intToCallReaction ( int  mock_behavior)

Definition at line 570 of file gmock-spec-builders.cc.

570 {
571 if (mock_behavior >= kAllow && mock_behavior <= kFail) {
572 return static_cast<internal::CallReaction>(mock_behavior);
573 }
574 return kWarn;
575}

◆ Invalid()

template<typename T >
T testing::internal::Invalid ( )
inline

Definition at line 296 of file gmock-internal-utils.h.

296 {
297 Assert(false, "", -1, "Internal error: attempt to return invalid value");
298 // This statement is unreachable, and would never terminate even if it
299 // could be reached. It is provided only to placate compiler warnings
300 // about missing return statements.
301 return Invalid<T>();
302}

◆ InvokeArgument()

template<typename F , typename... Args>
auto testing::internal::InvokeArgument ( f,
Args...  args 
) -> decltype(f(args...))

Definition at line 509 of file gmock-more-actions.h.

509 {
510 return f(args...);
511}

◆ IsAlNum()

bool testing::internal::IsAlNum ( char  ch)
inline

Definition at line 1925 of file gtest-port.h.

1925 {
1926 return isalnum(static_cast<unsigned char>(ch)) != 0;
1927}

◆ IsAlpha()

bool testing::internal::IsAlpha ( char  ch)
inline

Definition at line 1922 of file gtest-port.h.

1922 {
1923 return isalpha(static_cast<unsigned char>(ch)) != 0;
1924}

◆ IsContainerTest() [1/2]

template<class C , class Iterator = decltype(::std::declval<const C&>().begin()), class = decltype(::std::declval<const C&>().end()), class = decltype(++::std::declval<Iterator&>()), class = decltype(*::std::declval<Iterator>()), class = typename C::const_iterator>
IsContainer testing::internal::IsContainerTest ( int  )

Definition at line 951 of file gtest-internal.h.

951 {
952 return 0;
953}

◆ IsContainerTest() [2/2]

template<class C >
IsNotContainer testing::internal::IsContainerTest ( long  )

Definition at line 957 of file gtest-internal.h.

957{ return '\0'; }

◆ IsDigit()

bool testing::internal::IsDigit ( char  ch)
inline

Definition at line 1928 of file gtest-port.h.

1928 {
1929 return isdigit(static_cast<unsigned char>(ch)) != 0;
1930}

◆ IsLower()

bool testing::internal::IsLower ( char  ch)
inline

Definition at line 1931 of file gtest-port.h.

1931 {
1932 return islower(static_cast<unsigned char>(ch)) != 0;
1933}

◆ IsNull()

AssertionResult testing::internal::IsNull ( const char *  str)

Definition at line 132 of file gtest-unittest-api_test.cc.

132 {
133 if (str != nullptr) {
134 return testing::AssertionFailure() << "argument is " << str;
135 }
136 return AssertionSuccess();
137}

◆ IsPrintableAscii()

bool testing::internal::IsPrintableAscii ( char32_t  c)
inline

Definition at line 148 of file gtest-printers.cc.

148{ return 0x20 <= c && c <= 0x7E; }

◆ IsSpace()

bool testing::internal::IsSpace ( char  ch)
inline

Definition at line 1934 of file gtest-port.h.

1934 {
1935 return isspace(static_cast<unsigned char>(ch)) != 0;
1936}

◆ IsTrue()

bool testing::internal::IsTrue ( bool  condition)

Definition at line 6238 of file gtest.cc.

6238{ return condition; }

◆ IsUpper()

bool testing::internal::IsUpper ( char  ch)
inline

Definition at line 1937 of file gtest-port.h.

1937 {
1938 return isupper(static_cast<unsigned char>(ch)) != 0;
1939}

◆ IsUtf16SurrogatePair()

bool testing::internal::IsUtf16SurrogatePair ( wchar_t  first,
wchar_t  second 
)
inline

Definition at line 1965 of file gtest.cc.

1965 {
1966 return sizeof(wchar_t) == 2 &&
1967 (first & 0xFC00) == 0xD800 && (second & 0xFC00) == 0xDC00;
1968}

◆ IsXDigit() [1/4]

bool testing::internal::IsXDigit ( char  ch)
inline

Definition at line 1940 of file gtest-port.h.

1940 {
1941 return isxdigit(static_cast<unsigned char>(ch)) != 0;
1942}

◆ IsXDigit() [2/4]

bool testing::internal::IsXDigit ( char16_t  ch)
inline

Definition at line 1948 of file gtest-port.h.

1948 {
1949 const unsigned char low_byte = static_cast<unsigned char>(ch);
1950 return ch == low_byte && isxdigit(low_byte) != 0;
1951}

◆ IsXDigit() [3/4]

bool testing::internal::IsXDigit ( char32_t  ch)
inline

Definition at line 1952 of file gtest-port.h.

1952 {
1953 const unsigned char low_byte = static_cast<unsigned char>(ch);
1954 return ch == low_byte && isxdigit(low_byte) != 0;
1955}

◆ IsXDigit() [4/4]

bool testing::internal::IsXDigit ( wchar_t  ch)
inline

Definition at line 1956 of file gtest-port.h.

1956 {
1957 const unsigned char low_byte = static_cast<unsigned char>(ch);
1958 return ch == low_byte && isxdigit(low_byte) != 0;
1959}

◆ JoinAsTuple()

GTEST_API_ std::string testing::internal::JoinAsTuple ( const Strings fields)

Definition at line 51 of file gmock-internal-utils.cc.

51 {
52 switch (fields.size()) {
53 case 0:
54 return "";
55 case 1:
56 return fields[0];
57 default:
58 std::string result = "(" + fields[0];
59 for (size_t i = 1; i < fields.size(); i++) {
60 result += ", ";
61 result += fields[i];
62 }
63 result += ")";
64 return result;
65 }
66}

◆ Log()

GTEST_API_ void testing::internal::Log ( LogSeverity  severity,
const std::string &  message,
int  stack_frames_to_skip 
)

Definition at line 149 of file gmock-internal-utils.cc.

150 {
151 if (!LogIsVisible(severity))
152 return;
153
154 // Ensures that logs from different threads don't interleave.
155 MutexLock l(&g_log_mutex);
156
157 if (severity == kWarning) {
158 // Prints a GMOCK WARNING marker to make the warnings easily searchable.
159 std::cout << "\nGMOCK WARNING:";
160 }
161 // Pre-pends a new-line to message if it doesn't start with one.
162 if (message.empty() || message[0] != '\n') {
163 std::cout << "\n";
164 }
165 std::cout << message;
166 if (stack_frames_to_skip >= 0) {
167#ifdef NDEBUG
168 // In opt mode, we have to be conservative and skip no stack frame.
169 const int actual_to_skip = 0;
170#else
171 // In dbg mode, we can do what the caller tell us to do (plus one
172 // for skipping this function's stack frame).
173 const int actual_to_skip = stack_frames_to_skip + 1;
174#endif // NDEBUG
175
176 // Appends a new-line to message if it doesn't end with one.
177 if (!message.empty() && *message.rbegin() != '\n') {
178 std::cout << "\n";
179 }
180 std::cout << "Stack trace:\n"
182 ::testing::UnitTest::GetInstance(), actual_to_skip);
183 }
184 std::cout << ::std::flush;
185}
GTEST_API_ bool LogIsVisible(LogSeverity severity)
GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(UnitTest *unit_test, int skip_count)
Definition: gtest.cc:6225
static UnitTest * GetInstance()
Definition: gtest.cc:5123

◆ LogIsVisible()

GTEST_API_ bool testing::internal::LogIsVisible ( LogSeverity  severity)

Definition at line 128 of file gmock-internal-utils.cc.

128 {
129 if (GMOCK_FLAG(verbose) == kInfoVerbosity) {
130 // Always show the log if --gmock_verbose=info.
131 return true;
132 } else if (GMOCK_FLAG(verbose) == kErrorVerbosity) {
133 // Always hide it if --gmock_verbose=error.
134 return false;
135 } else {
136 // If --gmock_verbose is neither "info" nor "error", we treat it
137 // as "warning" (its default value).
138 return severity == kWarning;
139 }
140}
const char kErrorVerbosity[]

◆ LogToStderr()

void testing::internal::LogToStderr ( )
inline

Definition at line 988 of file gtest-port.h.

988{}

◆ LogWithLocation()

GTEST_API_ void testing::internal::LogWithLocation ( testing::internal::LogSeverity  severity,
const char *  file,
int  line,
const std::string &  message 
)

Definition at line 72 of file gmock-spec-builders.cc.

74 {
75 ::std::ostringstream s;
76 s << internal::FormatFileLocation(file, line) << " " << message
77 << ::std::endl;
78 Log(severity, s.str(), 0);
79}
GTEST_API_ void Log(LogSeverity severity, const std::string &message, int stack_frames_to_skip)

◆ MakeAction() [1/2]

template<typename F , typename Impl >
::testing::Action< F > testing::internal::MakeAction ( )

Definition at line 1536 of file gmock-actions.h.

1536 {
1537 return ::testing::Action<F>(ActionImpl<F, Impl>());
1538}

◆ MakeAction() [2/2]

template<typename F , typename Impl >
::testing::Action< F > testing::internal::MakeAction ( std::shared_ptr< Impl >  impl)

Definition at line 1542 of file gmock-actions.h.

1542 {
1543 return ::testing::Action<F>(ActionImpl<F, Impl>(std::move(impl)));
1544}

◆ MakeAndRegisterTestInfo()

TestInfo * testing::internal::MakeAndRegisterTestInfo ( const char *  test_suite_name,
const char *  name,
const char *  type_param,
const char *  value_param,
CodeLocation  code_location,
TypeId  fixture_class_id,
SetUpTestSuiteFunc  set_up_tc,
TearDownTestSuiteFunc  tear_down_tc,
TestFactoryBase factory 
)

Definition at line 2756 of file gtest.cc.

2760 {
2761 TestInfo* const test_info =
2762 new TestInfo(test_suite_name, name, type_param, value_param,
2763 code_location, fixture_class_id, factory);
2764 GetUnitTestImpl()->AddTestInfo(set_up_tc, tear_down_tc, test_info);
2765 return test_info;
2766}

◆ operator!=()

bool testing::internal::operator!= ( faketype  ,
faketype   
)
inline

Definition at line 1537 of file gtest.h.

1537{ return false; }

◆ operator==()

bool testing::internal::operator== ( faketype  ,
faketype   
)
inline

Definition at line 1536 of file gtest.h.

1536{ return true; }

◆ OutputFlagAlsoCheckEnvVar()

std::string testing::internal::OutputFlagAlsoCheckEnvVar ( )

Definition at line 1411 of file gtest-port.cc.

1411 {
1412 std::string default_value_for_output_flag = "";
1413 const char* xml_output_file_env = posix::GetEnv("XML_OUTPUT_FILE");
1414 if (nullptr != xml_output_file_env) {
1415 default_value_for_output_flag = std::string("xml:") + xml_output_file_env;
1416 }
1417 return default_value_for_output_flag;
1418}

◆ ParseGoogleTestFlagsOnly() [1/2]

void testing::internal::ParseGoogleTestFlagsOnly ( int *  argc,
char **  argv 
)

Definition at line 6607 of file gtest.cc.

6607 {
6608 ParseGoogleTestFlagsOnlyImpl(argc, argv);
6609
6610 // Fix the value of *_NSGetArgc() on macOS, but if and only if
6611 // *_NSGetArgv() == argv
6612 // Only applicable to char** version of argv
6613#if GTEST_OS_MAC
6614#ifndef GTEST_OS_IOS
6615 if (*_NSGetArgv() == argv) {
6616 *_NSGetArgc() = *argc;
6617 }
6618#endif
6619#endif
6620}
void ParseGoogleTestFlagsOnlyImpl(int *argc, CharType **argv)
Definition: gtest.cc:6554

◆ ParseGoogleTestFlagsOnly() [2/2]

void testing::internal::ParseGoogleTestFlagsOnly ( int *  argc,
wchar_t **  argv 
)

Definition at line 6621 of file gtest.cc.

6621 {
6622 ParseGoogleTestFlagsOnlyImpl(argc, argv);
6623}

◆ ParseGoogleTestFlagsOnlyImpl()

template<typename CharType >
void testing::internal::ParseGoogleTestFlagsOnlyImpl ( int *  argc,
CharType **  argv 
)

Definition at line 6554 of file gtest.cc.

6554 {
6555 for (int i = 1; i < *argc; i++) {
6556 const std::string arg_string = StreamableToString(argv[i]);
6557 const char* const arg = arg_string.c_str();
6558
6559 using internal::ParseBoolFlag;
6561 using internal::ParseStringFlag;
6562
6563 bool remove_flag = false;
6564 if (ParseGoogleTestFlag(arg)) {
6565 remove_flag = true;
6566#if GTEST_USE_OWN_FLAGFILE_FLAG_
6567 } else if (ParseStringFlag(arg, kFlagfileFlag, &GTEST_FLAG(flagfile))) {
6568 LoadFlagsFromFile(GTEST_FLAG(flagfile));
6569 remove_flag = true;
6570#endif // GTEST_USE_OWN_FLAGFILE_FLAG_
6571 } else if (arg_string == "--help" || arg_string == "-h" ||
6572 arg_string == "-?" || arg_string == "/?" ||
6573 HasGoogleTestFlagPrefix(arg)) {
6574 // Both help flag and unrecognized Google Test flags (excluding
6575 // internal ones) trigger help display.
6576 g_help_flag = true;
6577 }
6578
6579 if (remove_flag) {
6580 // Shift the remainder of the argv list left by one. Note
6581 // that argv has (*argc + 1) elements, the last one always being
6582 // NULL. The following loop moves the trailing NULL element as
6583 // well.
6584 for (int j = i; j != *argc; j++) {
6585 argv[j] = argv[j + 1];
6586 }
6587
6588 // Decrements the argument count.
6589 (*argc)--;
6590
6591 // We also need to decrement the iterator as we just removed
6592 // an element.
6593 i--;
6594 }
6595 }
6596
6597 if (g_help_flag) {
6598 // We print the help here instead of in RUN_ALL_TESTS(), as the
6599 // latter may not be called at all if the user is using Google
6600 // Test with another testing framework.
6601 PrintColorEncoded(kColorEncodedHelpMessage);
6602 }
6603}
#define GTEST_FLAG(name)
Definition: gtest-port.h:2205
bool ParseInt32Flag(const char *str, const char *flag, int32_t *value)
Definition: gtest.cc:6320
bool g_help_flag
Definition: gtest.cc:178

◆ ParseInt32()

bool testing::internal::ParseInt32 ( const Message src_text,
const char *  str,
int32_t *  value 
)

Definition at line 1323 of file gtest-port.cc.

1323 {
1324 // Parses the environment variable as a decimal integer.
1325 char* end = nullptr;
1326 const long long_value = strtol(str, &end, 10); // NOLINT
1327
1328 // Has strtol() consumed all characters in the string?
1329 if (*end != '\0') {
1330 // No - an invalid character was encountered.
1331 Message msg;
1332 msg << "WARNING: " << src_text
1333 << " is expected to be a 32-bit integer, but actually"
1334 << " has value \"" << str << "\".\n";
1335 printf("%s", msg.GetString().c_str());
1336 fflush(stdout);
1337 return false;
1338 }
1339
1340 // Is the parsed value in the range of an int32_t?
1341 const auto result = static_cast<int32_t>(long_value);
1342 if (long_value == LONG_MAX || long_value == LONG_MIN ||
1343 // The parsed value overflows as a long. (strtol() returns
1344 // LONG_MAX or LONG_MIN when the input overflows.)
1345 result != long_value
1346 // The parsed value overflows as an int32_t.
1347 ) {
1348 Message msg;
1349 msg << "WARNING: " << src_text
1350 << " is expected to be a 32-bit integer, but actually"
1351 << " has value " << str << ", which overflows.\n";
1352 printf("%s", msg.GetString().c_str());
1353 fflush(stdout);
1354 return false;
1355 }
1356
1357 *value = result;
1358 return true;
1359}

◆ ParseInt32Flag()

bool testing::internal::ParseInt32Flag ( const char *  str,
const char *  flag,
int32_t *  value 
)

Definition at line 6320 of file gtest.cc.

6320 {
6321 // Gets the value of the flag as a string.
6322 const char* const value_str = ParseFlagValue(str, flag, false);
6323
6324 // Aborts if the parsing failed.
6325 if (value_str == nullptr) return false;
6326
6327 // Sets *value to the value of the flag.
6328 return ParseInt32(Message() << "The value of flag --" << flag,
6329 value_str, value);
6330}

◆ PrintBytesInObjectTo() [1/2]

GTEST_API_ void testing::internal::PrintBytesInObjectTo ( const unsigned char *  obj_bytes,
size_t  count,
::std::ostream *  os 
)

◆ PrintBytesInObjectTo() [2/2]

void testing::internal::PrintBytesInObjectTo ( const unsigned char *  obj_bytes,
size_t  count,
ostream *  os 
)

Definition at line 129 of file gtest-printers.cc.

130 {
131 PrintBytesInObjectToImpl(obj_bytes, count, os);
132}
int * count

◆ PrintCharAndCodeTo()

template<typename Char >
void testing::internal::PrintCharAndCodeTo ( Char  c,
ostream *  os 
)

Definition at line 270 of file gtest-printers.cc.

270 {
271 // First, print c as a literal in the most readable form we can find.
272 *os << GetCharWidthPrefix(c) << "'";
273 const CharFormat format = PrintAsCharLiteralTo(c, os);
274 *os << "'";
275
276 // To aid user debugging, we also print c's code in decimal, unless
277 // it's 0 (in which case c was printed as '\\0', making the code
278 // obvious).
279 if (c == 0)
280 return;
281 *os << " (" << static_cast<int>(c);
282
283 // For more convenience, we print c's code again in hexadecimal,
284 // unless c was already printed in the form '\x##' or the code is in
285 // [1, 9].
286 if (format == kHexEscape || (1 <= c && c <= 9)) {
287 // Do nothing.
288 } else {
289 *os << ", 0x" << String::FormatHexInt(static_cast<int>(c));
290 }
291 *os << ")";
292}

◆ PrintRawArrayTo()

template<typename T >
void testing::internal::PrintRawArrayTo ( const T  a[],
size_t  count,
::std::ostream *  os 
)

Definition at line 539 of file gtest-printers.h.

539 {
540 UniversalPrint(a[0], os);
541 for (size_t i = 1; i != count; i++) {
542 *os << ", ";
543 UniversalPrint(a[i], os);
544 }
545}
void UniversalPrint(const T &value, ::std::ostream *os)

◆ PrintSmartPointer() [1/2]

template<typename T , typename Ptr >
void testing::internal::PrintSmartPointer ( const Ptr &  ptr,
std::ostream *  os,
char   
)

Definition at line 601 of file gtest-printers.h.

601 {
602 if (ptr == nullptr) {
603 *os << "(nullptr)";
604 } else {
605 // We can't print the value. Just print the pointer..
606 *os << "(" << (VoidifyPointer)(ptr.get()) << ")";
607 }
608}
const void * VoidifyPointer(volatile const void *p)

◆ PrintSmartPointer() [2/2]

template<typename T , typename Ptr , typename = typename std::enable_if<!std::is_void<T>::value && !std::is_array<T>::value>::type>
void testing::internal::PrintSmartPointer ( const Ptr &  ptr,
std::ostream *  os,
int   
)

Definition at line 612 of file gtest-printers.h.

612 {
613 if (ptr == nullptr) {
614 *os << "(nullptr)";
615 } else {
616 *os << "(ptr = " << (VoidifyPointer)(ptr.get()) << ", value = ";
618 *os << ")";
619 }
620}
std::string Print(const T &value)

◆ PrintStringTo() [1/2]

GTEST_API_ void testing::internal::PrintStringTo ( const ::std::string &  s,
::std::ostream *  os 
)

◆ PrintStringTo() [2/2]

void testing::internal::PrintStringTo ( const ::std::string &  s,
ostream *  os 
)

Definition at line 503 of file gtest-printers.cc.

503 {
504 if (PrintCharsAsStringTo(s.data(), s.size(), os) == kHexEscape) {
505 if (GTEST_FLAG(print_utf8)) {
506 ConditionalPrintAsText(s.data(), s.size(), os);
507 }
508 }
509}

◆ PrintTo() [1/34]

void testing::internal::PrintTo ( bool  x,
::std::ostream *  os 
)
inline

Definition at line 459 of file gtest-printers.h.

459 {
460 *os << (x ? "true" : "false");
461}

◆ PrintTo() [2/34]

void testing::internal::PrintTo ( char *  s,
::std::ostream *  os 
)
inline

Definition at line 484 of file gtest-printers.h.

484 {
485 PrintTo(ImplicitCast_<const char*>(s), os);
486}
void PrintTo(const ::std::pair< T1, T2 > &value, ::std::ostream *os)

◆ PrintTo() [3/34]

void testing::internal::PrintTo ( char  c,
::std::ostream *  os 
)
inline

Definition at line 451 of file gtest-printers.h.

451 {
452 // When printing a plain char, we always treat it as unsigned. This
453 // way, the output won't be affected by whether the compiler thinks
454 // char is signed or not.
455 PrintTo(static_cast<unsigned char>(c), os);
456}

◆ PrintTo() [4/34]

void testing::internal::PrintTo ( char16_t *  s,
::std::ostream *  os 
)
inline

Definition at line 511 of file gtest-printers.h.

511 {
512 PrintTo(ImplicitCast_<const char16_t*>(s), os);
513}

◆ PrintTo() [5/34]

void testing::internal::PrintTo ( char16_t  c,
::std::ostream *  os 
)
inline

Definition at line 473 of file gtest-printers.h.

473 {
474 PrintTo(ImplicitCast_<char32_t>(c), os);
475}

◆ PrintTo() [6/34]

void testing::internal::PrintTo ( char32_t *  s,
::std::ostream *  os 
)
inline

Definition at line 516 of file gtest-printers.h.

516 {
517 PrintTo(ImplicitCast_<const char32_t*>(s), os);
518}

◆ PrintTo() [7/34]

void testing::internal::PrintTo ( char32_t  c,
::std::ostream *  os 
)

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

302 {
303 *os << std::hex << "U+" << std::uppercase << std::setfill('0') << std::setw(4)
304 << static_cast<uint32_t>(c);
305}

◆ PrintTo() [8/34]

template<typename T1 , typename T2 >
void testing::internal::PrintTo ( const ::std::pair< T1, T2 > &  value,
::std::ostream *  os 
)

Definition at line 660 of file gtest-printers.h.

660 {
661 *os << '(';
662 // We cannot use UniversalPrint(value.first, os) here, as T1 may be
663 // a reference type. The same for printing value.second.
665 *os << ", ";
667 *os << ')';
668}

◆ PrintTo() [9/34]

void testing::internal::PrintTo ( const ::std::string &  s,
::std::ostream *  os 
)
inline

Definition at line 549 of file gtest-printers.h.

549 {
550 PrintStringTo(s, os);
551}
GTEST_API_ void PrintStringTo(const ::std::string &s, ::std::ostream *os)

◆ PrintTo() [10/34]

template<typename... Types>
void testing::internal::PrintTo ( const ::std::tuple< Types... > &  t,
::std::ostream *  os 
)

Definition at line 652 of file gtest-printers.h.

652 {
653 *os << "(";
654 PrintTupleTo(t, std::integral_constant<size_t, sizeof...(Types)>(), os);
655 *os << ")";
656}
void PrintTupleTo(const T &t, std::integral_constant< size_t, I >, ::std::ostream *os)

◆ PrintTo() [11/34]

void testing::internal::PrintTo ( const ::std::u16string &  s,
::std::ostream *  os 
)
inline

Definition at line 563 of file gtest-printers.h.

563 {
564 PrintU16StringTo(s, os);
565}
GTEST_API_ void PrintU16StringTo(const ::std::u16string &s, ::std::ostream *os)

◆ PrintTo() [12/34]

void testing::internal::PrintTo ( const ::std::u32string &  s,
::std::ostream *  os 
)
inline

Definition at line 569 of file gtest-printers.h.

569 {
570 PrintU32StringTo(s, os);
571}
GTEST_API_ void PrintU32StringTo(const ::std::u32string &s, ::std::ostream *os)

◆ PrintTo() [13/34]

GTEST_API_ void testing::internal::PrintTo ( const char *  s,
::std::ostream *  os 
)

◆ PrintTo() [14/34]

void testing::internal::PrintTo ( const char *  s,
ostream *  os 
)

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

415{ PrintCStringTo(s, os); }

◆ PrintTo() [15/34]

GTEST_API_ void testing::internal::PrintTo ( const char16_t *  s,
::std::ostream *  os 
)

◆ PrintTo() [16/34]

void testing::internal::PrintTo ( const char16_t *  s,
ostream *  os 
)

Definition at line 421 of file gtest-printers.cc.

421{ PrintCStringTo(s, os); }

◆ PrintTo() [17/34]

GTEST_API_ void testing::internal::PrintTo ( const char32_t *  s,
::std::ostream *  os 
)

◆ PrintTo() [18/34]

void testing::internal::PrintTo ( const char32_t *  s,
ostream *  os 
)

Definition at line 423 of file gtest-printers.cc.

423{ PrintCStringTo(s, os); }

◆ PrintTo() [19/34]

void testing::internal::PrintTo ( const signed char *  s,
::std::ostream *  os 
)
inline

Definition at line 490 of file gtest-printers.h.

490 {
491 PrintTo(ImplicitCast_<const void*>(s), os);
492}

◆ PrintTo() [20/34]

template<typename T >
void testing::internal::PrintTo ( const std::shared_ptr< T > &  ptr,
std::ostream *  os 
)

Definition at line 628 of file gtest-printers.h.

628 {
629 (PrintSmartPointer<T>)(ptr, os, 0);
630}

◆ PrintTo() [21/34]

template<typename T , typename D >
void testing::internal::PrintTo ( const std::unique_ptr< T, D > &  ptr,
std::ostream *  os 
)

Definition at line 623 of file gtest-printers.h.

623 {
624 (PrintSmartPointer<T>)(ptr, os, 0);
625}

◆ PrintTo() [22/34]

template<typename T >
void testing::internal::PrintTo ( const T &  value,
::std::ostream *  os 
)

Definition at line 440 of file gtest-printers.h.

440 {
442}
void PrintWithFallback(const T &value, ::std::ostream *os)

◆ PrintTo() [23/34]

void testing::internal::PrintTo ( const unsigned char *  s,
::std::ostream *  os 
)
inline

Definition at line 496 of file gtest-printers.h.

496 {
497 PrintTo(ImplicitCast_<const void*>(s), os);
498}

◆ PrintTo() [24/34]

GTEST_API_ void testing::internal::PrintTo ( const wchar_t *  s,
::std::ostream *  os 
)

◆ PrintTo() [25/34]

void testing::internal::PrintTo ( const wchar_t *  s,
ostream *  os 
)

Definition at line 433 of file gtest-printers.cc.

433{ PrintCStringTo(s, os); }

◆ PrintTo() [26/34]

void testing::internal::PrintTo ( signed char *  s,
::std::ostream *  os 
)
inline

Definition at line 493 of file gtest-printers.h.

493 {
494 PrintTo(ImplicitCast_<const void*>(s), os);
495}

◆ PrintTo() [27/34]

void testing::internal::PrintTo ( signed char  c,
::std::ostream *  os 
)

Definition at line 295 of file gtest-printers.cc.

295{ PrintCharAndCodeTo(c, os); }
void PrintCharAndCodeTo(Char c, ostream *os)

◆ PrintTo() [28/34]

void testing::internal::PrintTo ( std::nullptr_t  ,
::std::ostream *  os 
)
inline

Definition at line 588 of file gtest-printers.h.

588{ *os << "(nullptr)"; }

◆ PrintTo() [29/34]

template<typename T >
void testing::internal::PrintTo ( std::reference_wrapper< T >  ref,
::std::ostream *  os 
)

Definition at line 591 of file gtest-printers.h.

591 {
592 UniversalPrinter<T&>::Print(ref.get(), os);
593}

◆ PrintTo() [30/34]

void testing::internal::PrintTo ( unsigned char *  s,
::std::ostream *  os 
)
inline

Definition at line 499 of file gtest-printers.h.

499 {
500 PrintTo(ImplicitCast_<const void*>(s), os);
501}

◆ PrintTo() [31/34]

void testing::internal::PrintTo ( unsigned char  c,
::std::ostream *  os 
)

Definition at line 294 of file gtest-printers.cc.

294{ PrintCharAndCodeTo(c, os); }

◆ PrintTo() [32/34]

void testing::internal::PrintTo ( wchar_t *  s,
::std::ostream *  os 
)
inline

Definition at line 528 of file gtest-printers.h.

528 {
529 PrintTo(ImplicitCast_<const wchar_t*>(s), os);
530}

◆ PrintTo() [33/34]

GTEST_API_ void testing::internal::PrintTo ( wchar_t  wc,
::std::ostream *  os 
)

◆ PrintTo() [34/34]

void testing::internal::PrintTo ( wchar_t  wc,
ostream *  os 
)

Definition at line 299 of file gtest-printers.cc.

299{ PrintCharAndCodeTo(wc, os); }

◆ PrintTupleTo() [1/2]

template<typename T >
void testing::internal::PrintTupleTo ( const T &  ,
std::integral_constant< size_t, 0 >  ,
::std::ostream *   
)

Definition at line 635 of file gtest-printers.h.

636 {}

◆ PrintTupleTo() [2/2]

template<typename T , size_t I>
void testing::internal::PrintTupleTo ( const T &  t,
std::integral_constant< size_t, I >  ,
::std::ostream *  os 
)

Definition at line 639 of file gtest-printers.h.

640 {
641 PrintTupleTo(t, std::integral_constant<size_t, I - 1>(), os);
643 if (I > 1) {
645 *os << ", ";
646 }
647 UniversalPrinter<typename std::tuple_element<I - 1, T>::type>::Print(
648 std::get<I - 1>(t), os);
649}

◆ PrintU16StringTo() [1/2]

GTEST_API_ void testing::internal::PrintU16StringTo ( const ::std::u16string &  s,
::std::ostream *  os 
)

◆ PrintU16StringTo() [2/2]

void testing::internal::PrintU16StringTo ( const ::std::u16string &  s,
ostream *  os 
)

Definition at line 517 of file gtest-printers.cc.

517 {
518 PrintCharsAsStringTo(s.data(), s.size(), os);
519}

◆ PrintU32StringTo() [1/2]

GTEST_API_ void testing::internal::PrintU32StringTo ( const ::std::u32string &  s,
::std::ostream *  os 
)

◆ PrintU32StringTo() [2/2]

void testing::internal::PrintU32StringTo ( const ::std::u32string &  s,
ostream *  os 
)

Definition at line 521 of file gtest-printers.cc.

521 {
522 PrintCharsAsStringTo(s.data(), s.size(), os);
523}

◆ PrintWithFallback()

◆ ReadEntireFile()

std::string testing::internal::ReadEntireFile ( FILE *  file)

Definition at line 1247 of file gtest-port.cc.

1247 {
1248 const size_t file_size = GetFileSize(file);
1249 char* const buffer = new char[file_size];
1250
1251 size_t bytes_last_read = 0; // # of bytes read in the last fread()
1252 size_t bytes_read = 0; // # of bytes read so far
1253
1254 fseek(file, 0, SEEK_SET);
1255
1256 // Keeps reading the file until we cannot read further or the
1257 // pre-determined file size is reached.
1258 do {
1259 bytes_last_read = fread(buffer+bytes_read, 1, file_size-bytes_read, file);
1260 bytes_read += bytes_last_read;
1261 } while (bytes_last_read > 0 && bytes_read < file_size);
1262
1263 const std::string content(buffer, bytes_read);
1264 delete[] buffer;
1265
1266 return content;
1267}
GTEST_API_ size_t GetFileSize(FILE *file)
Definition: gtest-port.cc:1242

◆ RegisterTypeParameterizedTestSuite()

void testing::internal::RegisterTypeParameterizedTestSuite ( const char *  test_suite_name,
CodeLocation  code_location 
)

Definition at line 512 of file gtest.cc.

513 {
514 GetUnitTestImpl()->type_parameterized_test_registry().RegisterTestSuite(
515 test_suite_name, code_location);
516}

◆ RegisterTypeParameterizedTestSuiteInstantiation()

void testing::internal::RegisterTypeParameterizedTestSuiteInstantiation ( const char *  case_name)

Definition at line 518 of file gtest.cc.

518 {
519 GetUnitTestImpl()
520 ->type_parameterized_test_registry()
521 .RegisterInstantiation(case_name);
522}

◆ ReportFailureInUnknownLocation()

void testing::internal::ReportFailureInUnknownLocation ( TestPartResult::Type  result_type,
const std::string &  message 
)

Definition at line 2455 of file gtest.cc.

2456 {
2457 // This function is a friend of UnitTest and as such has access to
2458 // AddTestPartResult.
2459 UnitTest::GetInstance()->AddTestPartResult(
2460 result_type,
2461 nullptr, // No info about the source file where the exception occurred.
2462 -1, // We have no info on which line caused the exception.
2463 message,
2464 ""); // No stack trace, either.
2465}

◆ ReportInvalidTestSuiteType()

void testing::internal::ReportInvalidTestSuiteType ( const char *  test_suite_name,
CodeLocation  code_location 
)

Definition at line 2768 of file gtest.cc.

2769 {
2770 Message errors;
2771 errors
2772 << "Attempted redefinition of test suite " << test_suite_name << ".\n"
2773 << "All tests in the same test suite must use the same test fixture\n"
2774 << "class. However, in test suite " << test_suite_name << ", you tried\n"
2775 << "to define a test using a fixture class different from the one\n"
2776 << "used earlier. This can happen if the two fixture classes are\n"
2777 << "from different namespaces and have the same name. You should\n"
2778 << "probably rename one of the classes to put the tests into different\n"
2779 << "test suites.";
2780
2781 GTEST_LOG_(ERROR) << FormatFileLocation(code_location.file.c_str(),
2782 code_location.line)
2783 << " " << errors.GetString();
2784}
@ ERROR
Definition: log.h:28
#define GTEST_LOG_(severity)
Definition: gtest-port.h:984

◆ ReportUninterestingCall()

void testing::internal::ReportUninterestingCall ( CallReaction  reaction,
const std::string &  msg 
)

Definition at line 283 of file gmock-spec-builders.cc.

283 {
284 // Include a stack trace only if --gmock_verbose=info is specified.
285 const int stack_frames_to_skip =
286 GMOCK_FLAG(verbose) == kInfoVerbosity ? 3 : -1;
287 switch (reaction) {
288 case kAllow:
289 Log(kInfo, msg, stack_frames_to_skip);
290 break;
291 case kWarn:
293 msg +
294 "\nNOTE: You can safely ignore the above warning unless this "
295 "call should not happen. Do not suppress it by blindly adding "
296 "an EXPECT_CALL() if you don't mean to enforce the call. "
297 "See "
298 "https://github.com/google/googletest/blob/master/docs/"
299 "gmock_cook_book.md#"
300 "knowing-when-to-expect for details.\n",
301 stack_frames_to_skip);
302 break;
303 default: // FAIL
304 Expect(false, nullptr, -1, msg);
305 }
306}
void Expect(bool condition, const char *file, int line, const std::string &msg)

◆ ShouldRunTestOnShard()

bool testing::internal::ShouldRunTestOnShard ( int  total_shards,
int  shard_index,
int  test_id 
)

Definition at line 6013 of file gtest.cc.

6013 {
6014 return (test_id % total_shards) == shard_index;
6015}

◆ ShouldShard()

bool testing::internal::ShouldShard ( const char *  total_shards_env,
const char *  shard_index_env,
bool  in_subprocess_for_death_test 
)

Definition at line 5950 of file gtest.cc.

5952 {
5953 if (in_subprocess_for_death_test) {
5954 return false;
5955 }
5956
5957 const int32_t total_shards = Int32FromEnvOrDie(total_shards_env, -1);
5958 const int32_t shard_index = Int32FromEnvOrDie(shard_index_env, -1);
5959
5960 if (total_shards == -1 && shard_index == -1) {
5961 return false;
5962 } else if (total_shards == -1 && shard_index != -1) {
5963 const Message msg = Message()
5964 << "Invalid environment variables: you have "
5965 << kTestShardIndex << " = " << shard_index
5966 << ", but have left " << kTestTotalShards << " unset.\n";
5967 ColoredPrintf(GTestColor::kRed, "%s", msg.GetString().c_str());
5968 fflush(stdout);
5969 exit(EXIT_FAILURE);
5970 } else if (total_shards != -1 && shard_index == -1) {
5971 const Message msg = Message()
5972 << "Invalid environment variables: you have "
5973 << kTestTotalShards << " = " << total_shards
5974 << ", but have left " << kTestShardIndex << " unset.\n";
5975 ColoredPrintf(GTestColor::kRed, "%s", msg.GetString().c_str());
5976 fflush(stdout);
5977 exit(EXIT_FAILURE);
5978 } else if (shard_index < 0 || shard_index >= total_shards) {
5979 const Message msg = Message()
5980 << "Invalid environment variables: we require 0 <= "
5981 << kTestShardIndex << " < " << kTestTotalShards
5982 << ", but you have " << kTestShardIndex << "=" << shard_index
5983 << ", " << kTestTotalShards << "=" << total_shards << ".\n";
5984 ColoredPrintf(GTestColor::kRed, "%s", msg.GetString().c_str());
5985 fflush(stdout);
5986 exit(EXIT_FAILURE);
5987 }
5988
5989 return total_shards > 1;
5990}
int32_t Int32FromEnvOrDie(const char *var, int32_t default_val)
Definition: gtest.cc:5995

◆ ShouldUseColor()

bool testing::internal::ShouldUseColor ( bool  stdout_is_tty)

Definition at line 3234 of file gtest.cc.

3234 {
3235 const char* const gtest_color = GTEST_FLAG(color).c_str();
3236
3237 if (String::CaseInsensitiveCStringEquals(gtest_color, "auto")) {
3238#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW
3239 // On Windows the TERM variable is usually not set, but the
3240 // console there does support colors.
3241 return stdout_is_tty;
3242#else
3243 // On non-Windows platforms, we rely on the TERM variable.
3244 const char* const term = posix::GetEnv("TERM");
3245 const bool term_supports_color =
3246 String::CStringEquals(term, "xterm") ||
3247 String::CStringEquals(term, "xterm-color") ||
3248 String::CStringEquals(term, "xterm-256color") ||
3249 String::CStringEquals(term, "screen") ||
3250 String::CStringEquals(term, "screen-256color") ||
3251 String::CStringEquals(term, "tmux") ||
3252 String::CStringEquals(term, "tmux-256color") ||
3253 String::CStringEquals(term, "rxvt-unicode") ||
3254 String::CStringEquals(term, "rxvt-unicode-256color") ||
3255 String::CStringEquals(term, "linux") ||
3256 String::CStringEquals(term, "cygwin");
3257 return stdout_is_tty && term_supports_color;
3258#endif // GTEST_OS_WINDOWS
3259 }
3260
3261 return String::CaseInsensitiveCStringEquals(gtest_color, "yes") ||
3262 String::CaseInsensitiveCStringEquals(gtest_color, "true") ||
3263 String::CaseInsensitiveCStringEquals(gtest_color, "t") ||
3264 String::CStringEquals(gtest_color, "1");
3265 // We take "yes", "true", "t", and "1" as meaning "yes". If the
3266 // value is neither one of these nor "auto", we treat it as "no" to
3267 // be conservative.
3268}

◆ SkipPrefix()

bool testing::internal::SkipPrefix ( const char *  prefix,
const char **  pstr 
)

Definition at line 6253 of file gtest.cc.

6253 {
6254 const size_t prefix_len = strlen(prefix);
6255 if (strncmp(*pstr, prefix, prefix_len) == 0) {
6256 *pstr += prefix_len;
6257 return true;
6258 }
6259 return false;
6260}

◆ SplitString()

void testing::internal::SplitString ( const ::std::string &  str,
char  delimiter,
::std::vector< ::std::string > *  dest 
)

Definition at line 1132 of file gtest.cc.

1133 {
1134 ::std::vector< ::std::string> parsed;
1135 ::std::string::size_type pos = 0;
1137 const ::std::string::size_type colon = str.find(delimiter, pos);
1138 if (colon == ::std::string::npos) {
1139 parsed.push_back(str.substr(pos));
1140 break;
1141 } else {
1142 parsed.push_back(str.substr(pos, colon - pos));
1143 pos = colon + 1;
1144 }
1145 }
1146 dest->swap(parsed);
1147}
dest
Definition: upload.py:409

◆ StreamableToString()

template<typename T >
std::string testing::internal::StreamableToString ( const T &  streamable)

Definition at line 210 of file gtest-message.h.

210 {
211 return (Message() << streamable).GetString();
212}

◆ StrictnessModifierProbe() [1/4]

std::false_type testing::internal::StrictnessModifierProbe (   ...)

◆ StrictnessModifierProbe() [2/4]

template<typename T >
std::true_type testing::internal::StrictnessModifierProbe ( const NaggyMock< T > &  )

◆ StrictnessModifierProbe() [3/4]

template<typename T >
std::true_type testing::internal::StrictnessModifierProbe ( const NiceMock< T > &  )

◆ StrictnessModifierProbe() [4/4]

template<typename T >
std::true_type testing::internal::StrictnessModifierProbe ( const StrictMock< T > &  )

◆ StringFromGTestEnv()

const char * testing::internal::StringFromGTestEnv ( const char *  flag,
const char *  default_val 
)

Definition at line 1422 of file gtest-port.cc.

1422 {
1423#if defined(GTEST_GET_STRING_FROM_ENV_)
1424 return GTEST_GET_STRING_FROM_ENV_(flag, default_value);
1425#else
1426 const std::string env_var = FlagToEnvVar(flag);
1427 const char* const value = posix::GetEnv(env_var.c_str());
1428 return value == nullptr ? default_value : value;
1429#endif // defined(GTEST_GET_STRING_FROM_ENV_)
1430}

◆ StringStreamToString()

std::string testing::internal::StringStreamToString ( ::std::stringstream *  stream)

Definition at line 2164 of file gtest.cc.

2164 {
2165 const ::std::string& str = ss->str();
2166 const char* const start = str.c_str();
2167 const char* const end = start + str.length();
2168
2169 std::string result;
2170 result.reserve(static_cast<size_t>(2 * (end - start)));
2171 for (const char* ch = start; ch != end; ++ch) {
2172 if (*ch == '\0') {
2173 result += "\\0"; // Replaces NUL with "\\0";
2174 } else {
2175 result += *ch;
2176 }
2177 }
2178
2179 return result;
2180}

◆ StripTrailingSpaces()

std::string testing::internal::StripTrailingSpaces ( std::string  str)
inline

Definition at line 1968 of file gtest-port.h.

1968 {
1969 std::string::iterator it = str.end();
1970 while (it != str.begin() && IsSpace(*--it))
1971 it = str.erase(it);
1972 return str;
1973}

◆ TersePrintPrefixToStrings() [1/2]

template<typename Tuple >
void testing::internal::TersePrintPrefixToStrings ( const Tuple &  ,
std::integral_constant< size_t, 0 >  ,
Strings  
)

Definition at line 988 of file gtest-printers.h.

989 {}

◆ TersePrintPrefixToStrings() [2/2]

template<typename Tuple , size_t I>
void testing::internal::TersePrintPrefixToStrings ( const Tuple &  t,
std::integral_constant< size_t, I >  ,
Strings strings 
)

Definition at line 991 of file gtest-printers.h.

993 {
994 TersePrintPrefixToStrings(t, std::integral_constant<size_t, I - 1>(),
995 strings);
996 ::std::stringstream ss;
997 UniversalTersePrint(std::get<I - 1>(t), &ss);
998 strings->push_back(ss.str());
999}
void TersePrintPrefixToStrings(const Tuple &t, std::integral_constant< size_t, I >, Strings *strings)
void UniversalTersePrint(const T &value, ::std::ostream *os)

◆ TEST() [1/37]

testing::internal::TEST ( ApiTest  ,
DISABLED_Dummy1   
)

Definition at line 221 of file gtest-unittest-api_test.cc.

221{}

◆ TEST() [2/37]

testing::internal::TEST ( ApiTest  ,
TestSuiteDisabledAccessorsWork   
)

Definition at line 200 of file gtest-unittest-api_test.cc.

200 {
201 const TestSuite* test_suite = UnitTestHelper::FindTestSuite("DISABLED_Test");
202 ASSERT_TRUE(test_suite != nullptr);
203
204 EXPECT_STREQ("DISABLED_Test", test_suite->name());
205 EXPECT_TRUE(IsNull(test_suite->type_param()));
206 EXPECT_FALSE(test_suite->should_run());
207 EXPECT_EQ(1, test_suite->disabled_test_count());
208 EXPECT_EQ(0, test_suite->test_to_run_count());
209 ASSERT_EQ(1, test_suite->total_test_count());
210
211 const TestInfo* const test_info = test_suite->GetTestInfo(0);
212 EXPECT_STREQ("Dummy2", test_info->name());
213 EXPECT_STREQ("DISABLED_Test", test_info->test_suite_name());
214 EXPECT_TRUE(IsNull(test_info->value_param()));
215 EXPECT_TRUE(IsNull(test_info->type_param()));
216 EXPECT_FALSE(test_info->should_run());
217}
#define ASSERT_EQ(val1, val2)
Definition: gtest.h:2073
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:2043
#define EXPECT_TRUE(condition)
Definition: gtest.h:1982
#define EXPECT_STREQ(s1, s2)
Definition: gtest.h:2112
#define ASSERT_TRUE(condition)
Definition: gtest.h:1990
#define EXPECT_FALSE(condition)
Definition: gtest.h:1986
AssertionResult IsNull(const char *str)
const char * value_param() const
Definition: gtest.h:730
bool should_run() const
Definition: gtest.h:760
const char * type_param() const
Definition: gtest.h:723
const char * name() const
Definition: gtest.h:719
const char * test_suite_name() const
Definition: gtest.h:711
int test_to_run_count() const
Definition: gtest.cc:2936
const char * name() const
Definition: gtest.h:864
int total_test_count() const
Definition: gtest.cc:2941
const char * type_param() const
Definition: gtest.h:868
const TestInfo * GetTestInfo(int i) const
Definition: gtest.cc:2973
bool should_run() const
Definition: gtest.h:874
int disabled_test_count() const
Definition: gtest.cc:2926

◆ TEST() [3/37]

testing::internal::TEST ( ApiTest  ,
TestSuiteImmutableAccessorsWork   
)

Definition at line 139 of file gtest-unittest-api_test.cc.

139 {
140 const TestSuite* test_suite = UnitTestHelper::FindTestSuite("ApiTest");
141 ASSERT_TRUE(test_suite != nullptr);
142
143 EXPECT_STREQ("ApiTest", test_suite->name());
144 EXPECT_TRUE(IsNull(test_suite->type_param()));
145 EXPECT_TRUE(test_suite->should_run());
146 EXPECT_EQ(1, test_suite->disabled_test_count());
147 EXPECT_EQ(3, test_suite->test_to_run_count());
148 ASSERT_EQ(4, test_suite->total_test_count());
149
150 const TestInfo** tests = UnitTestHelper::GetSortedTests(test_suite);
151
152 EXPECT_STREQ("DISABLED_Dummy1", tests[0]->name());
153 EXPECT_STREQ("ApiTest", tests[0]->test_suite_name());
154 EXPECT_TRUE(IsNull(tests[0]->value_param()));
155 EXPECT_TRUE(IsNull(tests[0]->type_param()));
156 EXPECT_FALSE(tests[0]->should_run());
157
158 EXPECT_STREQ("TestSuiteDisabledAccessorsWork", tests[1]->name());
159 EXPECT_STREQ("ApiTest", tests[1]->test_suite_name());
160 EXPECT_TRUE(IsNull(tests[1]->value_param()));
161 EXPECT_TRUE(IsNull(tests[1]->type_param()));
162 EXPECT_TRUE(tests[1]->should_run());
163
164 EXPECT_STREQ("TestSuiteImmutableAccessorsWork", tests[2]->name());
165 EXPECT_STREQ("ApiTest", tests[2]->test_suite_name());
166 EXPECT_TRUE(IsNull(tests[2]->value_param()));
167 EXPECT_TRUE(IsNull(tests[2]->type_param()));
168 EXPECT_TRUE(tests[2]->should_run());
169
170 EXPECT_STREQ("UnitTestImmutableAccessorsWork", tests[3]->name());
171 EXPECT_STREQ("ApiTest", tests[3]->test_suite_name());
172 EXPECT_TRUE(IsNull(tests[3]->value_param()));
173 EXPECT_TRUE(IsNull(tests[3]->type_param()));
174 EXPECT_TRUE(tests[3]->should_run());
175
176 delete[] tests;
177 tests = nullptr;
178
179 test_suite = UnitTestHelper::FindTestSuite("TestSuiteWithCommentTest/0");
180 ASSERT_TRUE(test_suite != nullptr);
181
182 EXPECT_STREQ("TestSuiteWithCommentTest/0", test_suite->name());
183 EXPECT_STREQ(GetTypeName<Types<int>>().c_str(), test_suite->type_param());
184 EXPECT_TRUE(test_suite->should_run());
185 EXPECT_EQ(0, test_suite->disabled_test_count());
186 EXPECT_EQ(1, test_suite->test_to_run_count());
187 ASSERT_EQ(1, test_suite->total_test_count());
188
189 tests = UnitTestHelper::GetSortedTests(test_suite);
190
191 EXPECT_STREQ("Dummy", tests[0]->name());
192 EXPECT_STREQ("TestSuiteWithCommentTest/0", tests[0]->test_suite_name());
193 EXPECT_TRUE(IsNull(tests[0]->value_param()));
194 EXPECT_STREQ(GetTypeName<Types<int>>().c_str(), tests[0]->type_param());
195 EXPECT_TRUE(tests[0]->should_run());
196
197 delete[] tests;
198}

◆ TEST() [4/37]

testing::internal::TEST ( ApiTest  ,
UnitTestImmutableAccessorsWork   
)

Definition at line 108 of file gtest-unittest-api_test.cc.

108 {
109 UnitTest* unit_test = UnitTest::GetInstance();
110
113 EXPECT_EQ(2, unit_test->disabled_test_count());
114 EXPECT_EQ(5 + kTypedTests, unit_test->total_test_count());
115 EXPECT_EQ(3 + kTypedTests, unit_test->test_to_run_count());
116
117 const TestSuite** const test_suites = UnitTestHelper::GetSortedTestSuites();
118
119 EXPECT_STREQ("ApiTest", test_suites[0]->name());
120 EXPECT_STREQ("DISABLED_Test", test_suites[1]->name());
121 EXPECT_STREQ("TestSuiteWithCommentTest/0", test_suites[2]->name());
122
123 delete[] test_suites;
124
125 // The following lines initiate actions to verify certain methods in
126 // FinalSuccessChecker::TearDown.
127
128 // Records a test property to verify TestResult::GetTestProperty().
129 RecordProperty("key", "value");
130}
int test_to_run_count() const
Definition: gtest.cc:5206
int disabled_test_count() const
Definition: gtest.cc:5193
int test_suite_to_run_count() const
Definition: gtest.cc:5154
int total_test_count() const
Definition: gtest.cc:5203
int total_test_suite_count() const
Definition: gtest.cc:5148

◆ TEST() [5/37]

testing::internal::TEST ( CaptureDeathTest  ,
CannotReenterStdoutCapture   
)

Definition at line 929 of file googletest-port-test.cc.

929 {
932 "Only one stdout capturer can exist at a time");
934
935 // We cannot test stderr capturing using death tests as they use it
936 // themselves.
937}
#define EXPECT_DEATH_IF_SUPPORTED(statement, regex)
GTEST_API_ void CaptureStdout()
GTEST_API_ std::string GetCapturedStdout()

◆ TEST() [6/37]

testing::internal::TEST ( CaptureTest  ,
CapturesStderr   
)

Definition at line 909 of file googletest-port-test.cc.

909 {
911 fprintf(stderr, "jkl");
912 EXPECT_STREQ("jkl", GetCapturedStderr().c_str());
913
915 fprintf(stderr, "jkl%cmno", '\0');
916 EXPECT_EQ(::std::string("jkl\0mno", 7), ::std::string(GetCapturedStderr()));
917}
GTEST_API_ std::string GetCapturedStderr()
GTEST_API_ void CaptureStderr()

◆ TEST() [7/37]

testing::internal::TEST ( CaptureTest  ,
CapturesStdout   
)

Definition at line 899 of file googletest-port-test.cc.

899 {
901 fprintf(stdout, "abc");
902 EXPECT_STREQ("abc", GetCapturedStdout().c_str());
903
905 fprintf(stdout, "def%cghi", '\0');
906 EXPECT_EQ(::std::string("def\0ghi", 7), ::std::string(GetCapturedStdout()));
907}

◆ TEST() [8/37]

testing::internal::TEST ( CaptureTest  ,
CapturesStdoutAndStderr   
)

Definition at line 920 of file googletest-port-test.cc.

920 {
923 fprintf(stdout, "pqr");
924 fprintf(stderr, "stu");
925 EXPECT_STREQ("pqr", GetCapturedStdout().c_str());
926 EXPECT_STREQ("stu", GetCapturedStderr().c_str());
927}

◆ TEST() [9/37]

testing::internal::TEST ( DISABLED_Test  ,
Dummy2   
)

Definition at line 222 of file gtest-unittest-api_test.cc.

222{}

◆ TEST() [10/37]

testing::internal::TEST ( FormatCompilerIndependentFileLocationTest  ,
FormatsFileLocation   
)

Definition at line 264 of file googletest-port-test.cc.

264 {
265 EXPECT_EQ("foo.cc:42", FormatCompilerIndependentFileLocation("foo.cc", 42));
266}
GTEST_API_::std::string FormatCompilerIndependentFileLocation(const char *file, int line)
Definition: gtest-port.cc:1041

◆ TEST() [11/37]

testing::internal::TEST ( FormatCompilerIndependentFileLocationTest  ,
FormatsUknownFile   
)

Definition at line 268 of file googletest-port-test.cc.

268 {
269 EXPECT_EQ("unknown file:42",
271}

◆ TEST() [12/37]

testing::internal::TEST ( FormatCompilerIndependentFileLocationTest  ,
FormatsUknownFileAndLine   
)

Definition at line 277 of file googletest-port-test.cc.

277 {
278 EXPECT_EQ("unknown file", FormatCompilerIndependentFileLocation(nullptr, -1));
279}

◆ TEST() [13/37]

testing::internal::TEST ( FormatCompilerIndependentFileLocationTest  ,
FormatsUknownLine   
)

Definition at line 273 of file googletest-port-test.cc.

273 {
274 EXPECT_EQ("foo.cc", FormatCompilerIndependentFileLocation("foo.cc", -1));
275}

◆ TEST() [14/37]

testing::internal::TEST ( FormatFileLocationTest  ,
FormatsFileLocation   
)

Definition at line 244 of file googletest-port-test.cc.

244 {
245 EXPECT_PRED_FORMAT2(IsSubstring, "foo.cc", FormatFileLocation("foo.cc", 42));
247}
#define EXPECT_PRED_FORMAT2(pred_format, v1, v2)
GTEST_API_ AssertionResult IsSubstring(const char *needle_expr, const char *haystack_expr, const char *needle, const char *haystack)
Definition: gtest.cc:1777

◆ TEST() [15/37]

testing::internal::TEST ( FormatFileLocationTest  ,
FormatsUknownFileAndLine   
)

Definition at line 259 of file googletest-port-test.cc.

259 {
260 EXPECT_EQ("unknown file:", FormatFileLocation(nullptr, -1));
261}

◆ TEST() [16/37]

testing::internal::TEST ( FormatFileLocationTest  ,
FormatsUknownLine   
)

Definition at line 255 of file googletest-port-test.cc.

255 {
256 EXPECT_EQ("foo.cc:", FormatFileLocation("foo.cc", -1));
257}

◆ TEST() [17/37]

testing::internal::TEST ( FormatFileLocationTest  ,
FormatsUnknownFile   
)

Definition at line 249 of file googletest-port-test.cc.

249 {
250 EXPECT_PRED_FORMAT2(IsSubstring, "unknown file",
251 FormatFileLocation(nullptr, 42));
253}

◆ TEST() [18/37]

testing::internal::TEST ( GetThreadCountTest  ,
ReturnsZeroWhenUnableToCountThreads   
)

Definition at line 324 of file googletest-port-test.cc.

324 {
326}
GTEST_API_ size_t GetThreadCount()
Definition: gtest-port.cc:273

◆ TEST() [19/37]

testing::internal::TEST ( GtestCheckDeathTest  ,
DiesWithCorrectOutputOnFailure   
)

Definition at line 329 of file googletest-port-test.cc.

329 {
330 const bool a_false_condition = false;
331 const char regex[] =
332#ifdef _MSC_VER
333 "googletest-port-test\\.cc\\(\\d+\\):"
334#elif GTEST_USES_POSIX_RE
335 "googletest-port-test\\.cc:[0-9]+"
336#else
337 "googletest-port-test\\.cc:\\d+"
338#endif // _MSC_VER
339 ".*a_false_condition.*Extra info.*";
340
341 EXPECT_DEATH_IF_SUPPORTED(GTEST_CHECK_(a_false_condition) << "Extra info",
342 regex);
343}

◆ TEST() [20/37]

testing::internal::TEST ( GtestCheckSyntaxTest  ,
BehavesLikeASingleStatement   
)

Definition at line 211 of file googletest-port-test.cc.

211 {
212 if (AlwaysFalse())
213 GTEST_CHECK_(false) << "This should never be executed; "
214 "It's a compilation test only.";
215
216 if (AlwaysTrue())
217 GTEST_CHECK_(true);
218 else
219 ; // NOLINT
220
221 if (AlwaysFalse())
222 ; // NOLINT
223 else
224 GTEST_CHECK_(true) << "";
225}

◆ TEST() [21/37]

testing::internal::TEST ( GtestCheckSyntaxTest  ,
WorksWithSwitch   
)

Definition at line 230 of file googletest-port-test.cc.

230 {
231 switch (0) {
232 case 1:
233 break;
234 default:
235 GTEST_CHECK_(true);
236 }
237
238 switch (0)
239 case 0:
240 GTEST_CHECK_(true) << "Check failed in switch case";
241}

◆ TEST() [22/37]

testing::internal::TEST ( ImplicitCastTest  ,
CanSelectBetweenConstAndNonConstCasrAppropriately   
)

Definition at line 176 of file googletest-port-test.cc.

176 {
177 bool converted = false;
178 bool const_converted = false;
179 ConstAndNonConstCastable castable(&converted, &const_converted);
180 Base base = ::testing::internal::ImplicitCast_<Base>(castable);
181 EXPECT_TRUE(converted);
182 EXPECT_FALSE(const_converted);
183
184 converted = false;
185 const_converted = false;
186 const ConstAndNonConstCastable const_castable(&converted, &const_converted);
187 base = ::testing::internal::ImplicitCast_<Base>(const_castable);
188 EXPECT_FALSE(converted);
189 EXPECT_TRUE(const_converted);
190}

◆ TEST() [23/37]

testing::internal::TEST ( ImplicitCastTest  ,
CanUseConstCastOperatorOnConstValues   
)

Definition at line 151 of file googletest-port-test.cc.

151 {
152 bool converted = false;
153 const ConstCastable const_castable(&converted);
154 Base base = ::testing::internal::ImplicitCast_<Base>(const_castable);
155 EXPECT_TRUE(converted);
156}

◆ TEST() [24/37]

testing::internal::TEST ( ImplicitCastTest  ,
CanUseImplicitConstructor   
)

Definition at line 197 of file googletest-port-test.cc.

197 {
198 bool converted = false;
199 To to = ::testing::internal::ImplicitCast_<To>(&converted);
200 (void)to;
201 EXPECT_TRUE(converted);
202}

◆ TEST() [25/37]

testing::internal::TEST ( ImplicitCastTest  ,
CanUseInheritance   
)

Definition at line 114 of file googletest-port-test.cc.

114 {
115 Derived derived(1);
116 Base base = ::testing::internal::ImplicitCast_<Base>(derived);
117 EXPECT_EQ(derived.member(), base.member());
118}

◆ TEST() [26/37]

testing::internal::TEST ( ImplicitCastTest  ,
CanUseNonConstCastOperator   
)

Definition at line 132 of file googletest-port-test.cc.

132 {
133 bool converted = false;
134 Castable castable(&converted);
135 Base base = ::testing::internal::ImplicitCast_<Base>(castable);
136 EXPECT_TRUE(converted);
137}

◆ TEST() [27/37]

testing::internal::TEST ( ImplicitCastTest  ,
ConvertsPointers   
)

Definition at line 109 of file googletest-port-test.cc.

109 {
110 Derived derived(0);
111 EXPECT_TRUE(&derived == ::testing::internal::ImplicitCast_<Base*>(&derived));
112}

◆ TEST() [28/37]

testing::internal::TEST ( IsXDigitTest  ,
ReturnsFalseForNarrowNonAscii   
)

Definition at line 67 of file googletest-port-test.cc.

67 {
68 EXPECT_FALSE(IsXDigit(static_cast<char>('\x80')));
69 EXPECT_FALSE(IsXDigit(static_cast<char>('0' | '\x80')));
70}
bool IsXDigit(char ch)
Definition: gtest-port.h:1940

◆ TEST() [29/37]

testing::internal::TEST ( IsXDigitTest  ,
ReturnsFalseForWideNonAscii   
)

Definition at line 85 of file googletest-port-test.cc.

85 {
86 EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(0x80)));
87 EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(L'0' | 0x80)));
88 EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(L'0' | 0x100)));
89}

◆ TEST() [30/37]

testing::internal::TEST ( IsXDigitTest  ,
WorksForNarrowAscii   
)

Definition at line 54 of file googletest-port-test.cc.

54 {
61
65}

◆ TEST() [31/37]

testing::internal::TEST ( IsXDigitTest  ,
WorksForWideAscii   
)

Definition at line 72 of file googletest-port-test.cc.

72 {
73 EXPECT_TRUE(IsXDigit(L'0'));
74 EXPECT_TRUE(IsXDigit(L'9'));
75 EXPECT_TRUE(IsXDigit(L'A'));
76 EXPECT_TRUE(IsXDigit(L'F'));
77 EXPECT_TRUE(IsXDigit(L'a'));
78 EXPECT_TRUE(IsXDigit(L'f'));
79
83}

◆ TEST() [32/37]

testing::internal::TEST ( RegexEngineSelectionTest  ,
SelectsCorrectRegexEngine   
)

Definition at line 360 of file googletest-port-test.cc.

360 {
361#if !GTEST_USES_PCRE
362# if GTEST_HAS_POSIX_RE
363
365
366# else
367
368 EXPECT_TRUE(GTEST_USES_SIMPLE_RE);
369
370# endif
371#endif // !GTEST_USES_PCRE
372}
#define GTEST_USES_POSIX_RE
Definition: gtest-port.h:401

◆ TEST() [33/37]

testing::internal::TEST ( ThreadLocalTest  ,
DefaultConstructorInitializesToDefaultValues   
)

Definition at line 941 of file googletest-port-test.cc.

941 {
943 EXPECT_EQ(0, t1.get());
944
946 EXPECT_TRUE(t2.get() == nullptr);
947}

◆ TEST() [34/37]

testing::internal::TEST ( ThreadLocalTest  ,
GetAndPointerReturnSameValue   
)

Definition at line 969 of file googletest-port-test.cc.

969 {
970 ThreadLocal<std::string> thread_local_string;
971
972 EXPECT_EQ(thread_local_string.pointer(), &(thread_local_string.get()));
973
974 // Verifies the condition still holds after calling set.
975 thread_local_string.set("foo");
976 EXPECT_EQ(thread_local_string.pointer(), &(thread_local_string.get()));
977}
void set(const T &value)
Definition: gtest-port.h:1896

◆ TEST() [35/37]

testing::internal::TEST ( ThreadLocalTest  ,
PointerAndConstPointerReturnSameValue   
)

Definition at line 979 of file googletest-port-test.cc.

979 {
980 ThreadLocal<std::string> thread_local_string;
981 const ThreadLocal<std::string>& const_thread_local_string =
982 thread_local_string;
983
984 EXPECT_EQ(thread_local_string.pointer(), const_thread_local_string.pointer());
985
986 thread_local_string.set("foo");
987 EXPECT_EQ(thread_local_string.pointer(), const_thread_local_string.pointer());
988}

◆ TEST() [36/37]

testing::internal::TEST ( ThreadLocalTest  ,
SingleParamConstructorInitializesToParam   
)

Definition at line 949 of file googletest-port-test.cc.

949 {
950 ThreadLocal<int> t1(123);
951 EXPECT_EQ(123, t1.get());
952
953 int i = 0;
954 ThreadLocal<int*> t2(&i);
955 EXPECT_EQ(&i, t2.get());
956}

◆ TEST() [37/37]

testing::internal::TEST ( ThreadLocalTest  ,
ValueDefaultContructorIsNotRequiredForParamVersion   
)

◆ TEST_F() [1/2]

testing::internal::TEST_F ( ListenerTest  ,
DoesBar   
)

Definition at line 233 of file googletest-listener-test.cc.

233 {
234 g_events->push_back("ListenerTest::* Test Body");
235 SUCCEED(); // Triggers OnTestPartResult.
236}
#define SUCCEED()
Definition: gtest.h:1937
std::vector< std::string > * g_events

◆ TEST_F() [2/2]

testing::internal::TEST_F ( ListenerTest  ,
DoesFoo   
)

Definition at line 226 of file googletest-listener-test.cc.

226 {
227 // Test execution order within a test case is not guaranteed so we are not
228 // recording the test name.
229 g_events->push_back("ListenerTest::* Test Body");
230 SUCCEED(); // Triggers OnTestPartResult.
231}

◆ TestNotEmpty() [1/2]

template<typename T = int>
void testing::internal::TestNotEmpty ( )

Definition at line 383 of file gtest-param-util.h.

383 {
384 static_assert(sizeof(T) == 0, "Empty arguments are not allowed.");
385}

◆ TestNotEmpty() [2/2]

template<typename T = int>
void testing::internal::TestNotEmpty ( const T &  )

Definition at line 387 of file gtest-param-util.h.

387{}

◆ ToLower()

char testing::internal::ToLower ( char  ch)
inline

Definition at line 1961 of file gtest-port.h.

1961 {
1962 return static_cast<char>(tolower(static_cast<unsigned char>(ch)));
1963}

◆ ToUpper()

char testing::internal::ToUpper ( char  ch)
inline

Definition at line 1964 of file gtest-port.h.

1964 {
1965 return static_cast<char>(toupper(static_cast<unsigned char>(ch)));
1966}

◆ TYPED_TEST()

testing::internal::TYPED_TEST ( TestSuiteWithCommentTest  ,
Dummy   
)

Definition at line 100 of file gtest-unittest-api_test.cc.

100{}

◆ TYPED_TEST_SUITE()

testing::internal::TYPED_TEST_SUITE ( TestSuiteWithCommentTest  ,
Types< int >   
)

◆ UniversalPrint()

template<typename T >
void testing::internal::UniversalPrint ( const T &  value,
::std::ostream *  os 
)

Definition at line 976 of file gtest-printers.h.

976 {
977 // A workarond for the bug in VC++ 7.1 that prevents us from instantiating
978 // UniversalPrinter with T directly.
979 typedef T T1;
981}
@ T1
Definition: rune.c:27

◆ UniversalPrintArray() [1/9]

GTEST_API_ void testing::internal::UniversalPrintArray ( const char *  begin,
size_t  len,
::std::ostream *  os 
)

◆ UniversalPrintArray() [2/9]

void testing::internal::UniversalPrintArray ( const char *  begin,
size_t  len,
ostream *  os 
)

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

370 {
371 UniversalPrintCharArray(begin, len, os);
372}

◆ UniversalPrintArray() [3/9]

GTEST_API_ void testing::internal::UniversalPrintArray ( const char16_t *  begin,
size_t  len,
::std::ostream *  os 
)

◆ UniversalPrintArray() [4/9]

void testing::internal::UniversalPrintArray ( const char16_t *  begin,
size_t  len,
ostream *  os 
)

Definition at line 384 of file gtest-printers.cc.

384 {
385 UniversalPrintCharArray(begin, len, os);
386}

◆ UniversalPrintArray() [5/9]

GTEST_API_ void testing::internal::UniversalPrintArray ( const char32_t *  begin,
size_t  len,
::std::ostream *  os 
)

◆ UniversalPrintArray() [6/9]

void testing::internal::UniversalPrintArray ( const char32_t *  begin,
size_t  len,
ostream *  os 
)

Definition at line 390 of file gtest-printers.cc.

390 {
391 UniversalPrintCharArray(begin, len, os);
392}

◆ UniversalPrintArray() [7/9]

template<typename T >
void testing::internal::UniversalPrintArray ( const T *  begin,
size_t  len,
::std::ostream *  os 
)

Definition at line 784 of file gtest-printers.h.

784 {
785 if (len == 0) {
786 *os << "{}";
787 } else {
788 *os << "{ ";
789 const size_t kThreshold = 18;
790 const size_t kChunkSize = 8;
791 // If the array has more than kThreshold elements, we'll have to
792 // omit some details by printing only the first and the last
793 // kChunkSize elements.
794 if (len <= kThreshold) {
795 PrintRawArrayTo(begin, len, os);
796 } else {
797 PrintRawArrayTo(begin, kChunkSize, os);
798 *os << ", ..., ";
799 PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os);
800 }
801 *os << " }";
802 }
803}
void PrintRawArrayTo(const T a[], size_t count, ::std::ostream *os)

◆ UniversalPrintArray() [8/9]

GTEST_API_ void testing::internal::UniversalPrintArray ( const wchar_t *  begin,
size_t  len,
::std::ostream *  os 
)

◆ UniversalPrintArray() [9/9]

void testing::internal::UniversalPrintArray ( const wchar_t *  begin,
size_t  len,
ostream *  os 
)

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

396 {
397 UniversalPrintCharArray(begin, len, os);
398}

◆ UniversalTersePrint()

template<typename T >
void testing::internal::UniversalTersePrint ( const T &  value,
::std::ostream *  os 
)

Definition at line 967 of file gtest-printers.h.

967 {
969}

◆ UniversalTersePrintTupleFieldsToStrings()

template<typename Tuple >
Strings testing::internal::UniversalTersePrintTupleFieldsToStrings ( const Tuple &  value)

Definition at line 1005 of file gtest-printers.h.

1005 {
1006 Strings result;
1008 value, std::integral_constant<size_t, std::tuple_size<Tuple>::value>(),
1009 &result);
1010 return result;
1011}
::std::vector< ::std::string > Strings

◆ VoidifyPointer() [1/2]

const void * testing::internal::VoidifyPointer ( const void *  p)
inline

Definition at line 595 of file gtest-printers.h.

595{ return p; }

◆ VoidifyPointer() [2/2]

const void * testing::internal::VoidifyPointer ( volatile const void *  p)
inline

Definition at line 596 of file gtest-printers.h.

596 {
597 return const_cast<const void*>(p);
598}

◆ WideStringToUtf8()

std::string testing::internal::WideStringToUtf8 ( const wchar_t *  str,
int  num_chars 
)

Definition at line 1997 of file gtest.cc.

1997 {
1998 if (num_chars == -1)
1999 num_chars = static_cast<int>(wcslen(str));
2000
2001 ::std::stringstream stream;
2002 for (int i = 0; i < num_chars; ++i) {
2003 uint32_t unicode_code_point;
2004
2005 if (str[i] == L'\0') {
2006 break;
2007 } else if (i + 1 < num_chars && IsUtf16SurrogatePair(str[i], str[i + 1])) {
2008 unicode_code_point = CreateCodePointFromUtf16SurrogatePair(str[i],
2009 str[i + 1]);
2010 i++;
2011 } else {
2012 unicode_code_point = static_cast<uint32_t>(str[i]);
2013 }
2014
2015 stream << CodePointToUtf8(unicode_code_point);
2016 }
2017 return StringStreamToString(&stream);
2018}
uint32_t CreateCodePointFromUtf16SurrogatePair(wchar_t first, wchar_t second)
Definition: gtest.cc:1971
bool IsUtf16SurrogatePair(wchar_t first, wchar_t second)
Definition: gtest.cc:1965
std::string CodePointToUtf8(uint32_t code_point)
Definition: gtest.cc:1930

◆ WriteToShardStatusFileIfNeeded()

void testing::internal::WriteToShardStatusFileIfNeeded ( )

Definition at line 5928 of file gtest.cc.

5928 {
5929 const char* const test_shard_file = posix::GetEnv(kTestShardStatusFile);
5930 if (test_shard_file != nullptr) {
5931 FILE* const file = posix::FOpen(test_shard_file, "w");
5932 if (file == nullptr) {
5933 ColoredPrintf(GTestColor::kRed,
5934 "Could not write to the test shard status file \"%s\" "
5935 "specified by the %s environment variable.\n",
5936 test_shard_file, kTestShardStatusFile);
5937 fflush(stdout);
5938 exit(EXIT_FAILURE);
5939 }
5940 fclose(file);
5941 }
5942}
FILE * FOpen(const char *path, const char *mode)
Definition: gtest-port.h:2075

Variable Documentation

◆ g_argvs

::std::vector<std::string> testing::internal::g_argvs

Definition at line 578 of file gtest.cc.

◆ g_gmock_implicit_sequence

GTEST_API_ ThreadLocal<Sequence*> testing::internal::g_gmock_implicit_sequence

Definition at line 279 of file gmock-spec-builders.cc.

◆ g_help_flag

bool testing::internal::g_help_flag = false

Definition at line 178 of file gtest.cc.

◆ kCurrentDirectoryString

const char testing::internal::kCurrentDirectoryString[] = "./"

Definition at line 81 of file gtest-filepath.cc.

◆ kDeathTestStyleFlag

const char testing::internal::kDeathTestStyleFlag[] = "death_test_style"

Definition at line 51 of file gtest-death-test-internal.h.

◆ kDeathTestUseFork

const char testing::internal::kDeathTestUseFork[] = "death_test_use_fork"

Definition at line 52 of file gtest-death-test-internal.h.

◆ kErrorVerbosity

const char testing::internal::kErrorVerbosity[] = "error"

Definition at line 252 of file gmock-internal-utils.h.

◆ kInfoVerbosity

const char testing::internal::kInfoVerbosity[] = "info"

Definition at line 248 of file gmock-internal-utils.h.

◆ kInternalRunDeathTestFlag

const char testing::internal::kInternalRunDeathTestFlag[] = "internal_run_death_test"

Definition at line 53 of file gtest-death-test-internal.h.

◆ kMaxBiggestInt

constexpr BiggestInt testing::internal::kMaxBiggestInt = (std::numeric_limits<BiggestInt>::max)()
constexpr

Definition at line 2154 of file gtest-port.h.

◆ kMaxCodePoint1

constexpr uint32_t testing::internal::kMaxCodePoint1 = (static_cast<uint32_t>(1) << 7) - 1
constexpr

Definition at line 1904 of file gtest.cc.

◆ kMaxCodePoint2

constexpr uint32_t testing::internal::kMaxCodePoint2 = (static_cast<uint32_t>(1) << (5 + 6)) - 1
constexpr

Definition at line 1907 of file gtest.cc.

◆ kMaxCodePoint3

constexpr uint32_t testing::internal::kMaxCodePoint3 = (static_cast<uint32_t>(1) << (4 + 2*6)) - 1
constexpr

Definition at line 1910 of file gtest.cc.

◆ kMaxCodePoint4

constexpr uint32_t testing::internal::kMaxCodePoint4 = (static_cast<uint32_t>(1) << (3 + 3*6)) - 1
constexpr

Definition at line 1913 of file gtest.cc.

◆ kPathSeparator

const char testing::internal::kPathSeparator = '/'

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

◆ kStackTraceMarker

const char testing::internal::kStackTraceMarker = "\nStack trace:\n"

Definition at line 174 of file gtest.cc.

◆ kStdErrFileno

const int testing::internal::kStdErrFileno = STDERR_FILENO

Definition at line 98 of file gtest-port.cc.

◆ kStdOutFileno

const int testing::internal::kStdOutFileno = STDOUT_FILENO

Definition at line 97 of file gtest-port.cc.

◆ kTestTypeIdInGoogleTest

const TypeId testing::internal::kTestTypeIdInGoogleTest = GetTestTypeId()
extern

◆ kTypedTests

const int testing::internal::kTypedTests = 1

Definition at line 103 of file gtest-unittest-api_test.cc.

◆ kTypedTestSuites

const int testing::internal::kTypedTestSuites = 1

Definition at line 102 of file gtest-unittest-api_test.cc.

◆ kUnknownFile

const char testing::internal::kUnknownFile[] = "unknown file"

Definition at line 1019 of file gtest-port.cc.

◆ kWarningVerbosity

const char testing::internal::kWarningVerbosity[] = "warning"

Definition at line 250 of file gmock-internal-utils.h.