webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Classes | Namespaces | Macros | Typedefs | Functions | Variables
gtest-internal.h File Reference
#include <gtest/internal/gtest-port.h>
#include <ctype.h>
#include <string.h>
#include <iomanip>
#include <limits>
#include <set>
#include <gtest/internal/gtest-string.h>
#include <gtest/internal/gtest-filepath.h>
#include <gtest/internal/gtest-type-util.h>

Go to the source code of this file.

Classes

class  testing::internal::ScopedTrace
 
class  testing::internal::FloatingPoint< RawType >
 
class  testing::internal::TypeIdHelper< T >
 
class  testing::internal::TestFactoryBase
 
class  testing::internal::TestFactoryImpl< TestClass >
 
class  testing::internal::Random
 

Namespaces

 testing
 
 testing::internal
 

Macros

#define GTEST_CONCAT_TOKEN_(foo, bar)   GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
 
#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar)   foo ## bar
 
#define GTEST_IS_NULL_LITERAL_(x)   (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
 
#define GTEST_FORMAT_IMPL_(operand2_type, operand1_printer)
 
#define GTEST_MESSAGE_(message, result_type)
 
#define GTEST_FATAL_FAILURE_(message)   return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure)
 
#define GTEST_NONFATAL_FAILURE_(message)   GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure)
 
#define GTEST_SUCCESS_(message)   GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)
 
#define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)   if (::testing::internal::AlwaysTrue()) { statement; }
 
#define GTEST_TEST_THROW_(statement, expected_exception, fail)
 
#define GTEST_TEST_NO_THROW_(statement, fail)
 
#define GTEST_TEST_ANY_THROW_(statement, fail)
 
#define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail)
 
#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail)
 
#define GTEST_TEST_CLASS_NAME_(test_case_name, test_name)   test_case_name##_##test_name##_Test
 
#define GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)
 

Typedefs

typedef FloatingPoint< float > testing::internal::Float
 
typedef FloatingPoint< double > testing::internal::Double
 
typedef const voidtesting::internal::TypeId
 
typedef void(* testing::internal::SetUpTestCaseFunc) ()
 
typedef void(* testing::internal::TearDownTestCaseFunc) ()
 

Functions

template<typename T >
void GTestStreamToHelper (std::ostream *os, const T &val)
 
char testing::internal::IsNullLiteralHelper (Secret *p)
 
char(& testing::internal::IsNullLiteralHelper (...))[2]
 
GTEST_API_ String testing::internal::AppendUserMessage (const String &gtest_msg, const Message &user_msg)
 
template<typename T >
String testing::internal::StreamableToString (const T &streamable)
 
template<typename T >
String testing::internal::FormatForFailureMessage (const T &value)
 
template<typename T >
String testing::internal::FormatForFailureMessage (T *pointer)
 
GTEST_API_ String testing::internal::FormatForFailureMessage (char ch)
 
GTEST_API_ String testing::internal::FormatForFailureMessage (wchar_t wchar)
 
GTEST_API_ AssertionResult testing::internal::EqFailure (const char *expected_expression, const char *actual_expression, const String &expected_value, const String &actual_value, bool ignoring_case)
 
GTEST_API_ String testing::internal::GetBoolAssertionFailureMessage (const AssertionResult &assertion_result, const char *expression_text, const char *actual_predicate_value, const char *expected_predicate_value)
 
template<typename T >
TypeId testing::internal::GetTypeId ()
 
GTEST_API_ TypeId testing::internal::GetTestTypeId ()
 
String testing::internal::FormatFileLocation (const char *file, int line)
 
GTEST_API_ TestInfo * testing::internal::MakeAndRegisterTestInfo (const char *test_case_name, const char *name, const char *test_case_comment, const char *comment, TypeId fixture_class_id, SetUpTestCaseFunc set_up_tc, TearDownTestCaseFunc tear_down_tc, TestFactoryBase *factory)
 
bool testing::internal::SkipPrefix (const char *prefix, const char **pstr)
 
GTEST_API_ String testing::internal::GetCurrentOsStackTraceExceptTop (UnitTest *unit_test, int skip_count)
 
GTEST_API_ bool testing::internal::AlwaysTrue ()
 
bool testing::internal::AlwaysFalse ()
 

Variables

int testing::internal::g_init_gtest_count = 0
 
GTEST_API_ const char testing::internal::kStackTraceMarker [] = "\nStack trace:\n"
 
class GTEST_API_ testing::internal::ScopedTrace testing::internal::GTEST_ATTRIBUTE_UNUSED_
 

Macro Definition Documentation

◆ GTEST_CONCAT_TOKEN_

#define GTEST_CONCAT_TOKEN_ (   foo,
  bar 
)    GTEST_CONCAT_TOKEN_IMPL_(foo, bar)

◆ GTEST_CONCAT_TOKEN_IMPL_

#define GTEST_CONCAT_TOKEN_IMPL_ (   foo,
  bar 
)    foo ## bar

◆ GTEST_FATAL_FAILURE_

#define GTEST_FATAL_FAILURE_ (   message)    return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure)

◆ GTEST_FORMAT_IMPL_

#define GTEST_FORMAT_IMPL_ (   operand2_type,
  operand1_printer 
)
Value:
operand2_type::value_type* str, const operand2_type& /*operand2*/) {\
return operand1_printer(str);\
}\
const operand2_type::value_type* str, const operand2_type& /*operand2*/) {\
return operand1_printer(str);\
}
String FormatForComparisonFailureMessage(const T1 &value, const T2 &)
Definition: gtest.h:1246
str
Definition: make-dist.py:305

◆ GTEST_IS_NULL_LITERAL_

#define GTEST_IS_NULL_LITERAL_ (   x)    (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)

◆ GTEST_MESSAGE_

#define GTEST_MESSAGE_ (   message,
  result_type 
)
Value:
::testing::internal::AssertHelper(result_type, __FILE__, __LINE__, message) \
Message
Definition: peerconnection_unittest.cc:105
Definition: gtest.h:1525
GLuint GLsizei const GLchar * message
Definition: gl2ext.h:137

◆ GTEST_NONFATAL_FAILURE_

#define GTEST_NONFATAL_FAILURE_ (   message)    GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure)

◆ GTEST_SUCCESS_

#define GTEST_SUCCESS_ (   message)    GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)

◆ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_

#define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_ (   statement)    if (::testing::internal::AlwaysTrue()) { statement; }

◆ GTEST_TEST_

#define GTEST_TEST_ (   test_case_name,
  test_name,
  parent_class,
  parent_id 
)
Value:
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
public:\
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
private:\
virtual void TestBody();\
static ::testing::TestInfo* const test_info_;\
GTEST_DISALLOW_COPY_AND_ASSIGN_(\
GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
};\
\
::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\
::test_info_ =\
#test_case_name, #test_name, "", "", \
(parent_id), \
parent_class::SetUpTestCase, \
parent_class::TearDownTestCase, \
new ::testing::internal::TestFactoryImpl<\
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
#define GTEST_TEST_CLASS_NAME_(test_case_name, test_name)
Definition: gtest-internal.h:897
GTEST_API_ TestInfo * MakeAndRegisterTestInfo(const char *test_case_name, const char *name, const char *test_case_comment, const char *comment, TypeId fixture_class_id, SetUpTestCaseFunc set_up_tc, TearDownTestCaseFunc tear_down_tc, TestFactoryBase *factory)
Definition: gtest.cc:2157

◆ GTEST_TEST_ANY_THROW_

#define GTEST_TEST_ANY_THROW_ (   statement,
  fail 
)
Value:
if (const char* gtest_msg = "") { \
bool gtest_caught_any = false; \
try { \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
} \
catch (...) { \
gtest_caught_any = true; \
} \
if (!gtest_caught_any) { \
gtest_msg = "Expected: " #statement " throws an exception.\n" \
" Actual: it doesn't."; \
goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \
} \
GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \
fail(gtest_msg)
#define GTEST_CONCAT_TOKEN_(foo, bar)
Definition: gtest-internal.h:67
if(!isset( $GET[ 'random_id']))
Definition: cacheable-random-text.php:7
fail()
Definition: access-control-basic-preflight-cache-invalidation.php:6

◆ GTEST_TEST_BOOLEAN_

#define GTEST_TEST_BOOLEAN_ (   expression,
  text,
  actual,
  expected,
  fail 
)
Value:
if (const ::testing::AssertionResult gtest_ar_ = \
::testing::AssertionResult(expression)) \
; \
gtest_ar_, text, #actual, #expected).c_str())
Definition: XMLHttpRequest.idl:39
if(!isset( $GET[ 'random_id']))
Definition: cacheable-random-text.php:7
string expected
Definition: buildtests.py:33
Definition: gtest.h:254
fail()
Definition: access-control-basic-preflight-cache-invalidation.php:6
GTEST_API_ String GetBoolAssertionFailureMessage(const AssertionResult &assertion_result, const char *expression_text, const char *actual_predicate_value, const char *expected_predicate_value)
Definition: gtest.cc:1036

◆ GTEST_TEST_CLASS_NAME_

#define GTEST_TEST_CLASS_NAME_ (   test_case_name,
  test_name 
)    test_case_name##_##test_name##_Test

◆ GTEST_TEST_NO_FATAL_FAILURE_

#define GTEST_TEST_NO_FATAL_FAILURE_ (   statement,
  fail 
)
Value:
if (const char* gtest_msg = "") { \
::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
gtest_msg = "Expected: " #statement " doesn't generate new fatal " \
"failures in the current thread.\n" \
" Actual: it does."; \
goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
} \
GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \
fail(gtest_msg)
#define GTEST_CONCAT_TOKEN_(foo, bar)
Definition: gtest-internal.h:67
if(!isset( $GET[ 'random_id']))
Definition: cacheable-random-text.php:7
Definition: gtest-test-part.h:158
fail()
Definition: access-control-basic-preflight-cache-invalidation.php:6
bool has_new_fatal_failure() const
Definition: gtest-test-part.h:164

◆ GTEST_TEST_NO_THROW_

#define GTEST_TEST_NO_THROW_ (   statement,
  fail 
)
Value:
if (const char* gtest_msg = "") { \
try { \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
} \
catch (...) { \
gtest_msg = "Expected: " #statement " doesn't throw an exception.\n" \
" Actual: it throws."; \
goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
} \
GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
fail(gtest_msg)
#define GTEST_CONCAT_TOKEN_(foo, bar)
Definition: gtest-internal.h:67
if(!isset( $GET[ 'random_id']))
Definition: cacheable-random-text.php:7
fail()
Definition: access-control-basic-preflight-cache-invalidation.php:6

◆ GTEST_TEST_THROW_

#define GTEST_TEST_THROW_ (   statement,
  expected_exception,
  fail 
)
Value:
if (const char* gtest_msg = "") { \
bool gtest_caught_expected = false; \
try { \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
} \
catch (expected_exception const&) { \
gtest_caught_expected = true; \
} \
catch (...) { \
gtest_msg = "Expected: " #statement " throws an exception of type " \
#expected_exception ".\n Actual: it throws a different " \
"type."; \
goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
} \
if (!gtest_caught_expected) { \
gtest_msg = "Expected: " #statement " throws an exception of type " \
#expected_exception ".\n Actual: it throws nothing."; \
goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
} \
} else \
GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
fail(gtest_msg)
if(!isset( $GET[ 'random_id']))
Definition: cacheable-random-text.php:7

Function Documentation

◆ GTestStreamToHelper()

template<typename T >
void GTestStreamToHelper ( std::ostream *  os,
const T val 
)
inline