51 #ifndef GTEST_INCLUDE_GTEST_GTEST_H_ 52 #define GTEST_INCLUDE_GTEST_GTEST_H_ 58 #include "gtest/internal/gtest-internal.h" 59 #include "gtest/internal/gtest-string.h" 60 #include "gtest/gtest-death-test.h" 61 #include "gtest/gtest-message.h" 62 #include "gtest/gtest-param-test.h" 63 #include "gtest/gtest-printers.h" 64 #include "gtest/gtest_prod.h" 65 #include "gtest/gtest-test-part.h" 66 #include "gtest/gtest-typed-test.h" 154 class DefaultGlobalTestPartResultReporter;
156 class NoExecDeathTest;
157 class FinalSuccessChecker;
158 class GTestFlagSaver;
159 class StreamingListenerTest;
160 class TestResultAccessor;
161 class TestEventListenersAccessor;
162 class TestEventRepeater;
163 class UnitTestRecordPropertyTestHelper;
164 class WindowsDeathTest;
263 AssertionResult(
const AssertionResult & other);
268 operator bool()
const {
return success_; }
279 return message_.get() != NULL ? message_->c_str() :
"";
288 AppendMessage(
Message() << value);
295 ::std::ostream & (*basic_manipulator)(::std::ostream & stream))
297 AppendMessage(
Message() << basic_manipulator);
305 if (message_.get() == NULL)
308 message_->append(a_message.
GetString().c_str());
385 static bool HasFatalFailure();
388 static bool HasNonfatalFailure();
392 static bool HasFailure() {
return HasFatalFailure() || HasNonfatalFailure(); }
408 static void RecordProperty(
const std::string & key,
int value);
415 virtual void SetUp();
418 virtual void TearDown();
423 static bool HasSameFixtureClass();
431 virtual void TestBody() = 0;
479 key_(a_key), value_(a_value)
492 return value_.c_str();
525 int total_part_count()
const;
528 int test_property_count()
const;
531 bool Passed()
const {
return !Failed(); }
537 bool HasFatalFailure()
const;
540 bool HasNonfatalFailure()
const;
560 friend class internal::ExecDeathTest;
563 friend class internal::WindowsDeathTest;
568 return test_part_results_;
574 return test_properties_;
586 void RecordProperty(
const std::string & xml_element,
592 static bool ValidateTestProperty(
const std::string & xml_element,
605 void ClearTestPartResults();
615 std::vector<TestPartResult> test_part_results_;
617 std::vector<TestProperty> test_properties_;
619 int death_test_count_;
621 TimeInMillis elapsed_time_;
655 if (type_param_.get() != NULL)
656 {
return type_param_->c_str(); }
665 if (value_param_.get() != NULL)
666 {
return value_param_->c_str(); }
695 return matches_filter_;
699 const TestResult *
result()
const {
return &result_; }
702 #if GTEST_HAS_DEATH_TEST 703 friend class internal::DefaultDeathTestFactory;
704 #endif // GTEST_HAS_DEATH_TEST 708 friend class internal::StreamingListenerTest;
710 const char * test_case_name,
712 const char * type_param,
713 const char * value_param,
723 const char * a_type_param,
724 const char * a_value_param,
732 return result_.increment_death_test_count();
756 bool matches_filter_;
800 if (type_param_.get() != NULL)
801 {
return type_param_->c_str(); }
810 int successful_test_count()
const;
813 int failed_test_count()
const;
816 int reportable_disabled_test_count()
const;
819 int disabled_test_count()
const;
822 int reportable_test_count()
const;
825 int test_to_run_count()
const;
828 int total_test_count()
const;
831 bool Passed()
const {
return !Failed(); }
834 bool Failed()
const {
return failed_test_count() > 0; }
841 const TestInfo * GetTestInfo(
int i)
const;
857 return test_info_list_;
862 TestInfo * GetMutableTestInfo(
int i);
869 void AddTestInfo(TestInfo * test_info);
932 void UnshuffleTests();
941 std::vector<TestInfo *> test_info_list_;
945 std::vector<int> test_indices_;
953 TimeInMillis elapsed_time_;
956 TestResult ad_hoc_test_result_;
1002 virtual void OnTestProgramStart(
const UnitTest & unit_test) = 0;
1007 virtual void OnTestIterationStart(
const UnitTest & unit_test,
1011 virtual void OnEnvironmentsSetUpStart(
const UnitTest & unit_test) = 0;
1014 virtual void OnEnvironmentsSetUpEnd(
const UnitTest & unit_test) = 0;
1017 virtual void OnTestCaseStart(
const TestCase & test_case) = 0;
1020 virtual void OnTestStart(
const TestInfo & test_info) = 0;
1023 virtual void OnTestPartResult(
const TestPartResult & test_part_result) = 0;
1026 virtual void OnTestEnd(
const TestInfo & test_info) = 0;
1029 virtual void OnTestCaseEnd(
const TestCase & test_case) = 0;
1032 virtual void OnEnvironmentsTearDownStart(
const UnitTest & unit_test) = 0;
1035 virtual void OnEnvironmentsTearDownEnd(
const UnitTest & unit_test) = 0;
1038 virtual void OnTestIterationEnd(
const UnitTest & unit_test,
1042 virtual void OnTestProgramEnd(
const UnitTest & unit_test) = 0;
1074 TestEventListeners();
1075 ~TestEventListeners();
1094 return default_result_printer_;
1106 return default_xml_generator_;
1110 friend class TestCase;
1111 friend class TestInfo;
1113 friend class internal::NoExecDeathTest;
1137 bool EventForwardingEnabled()
const;
1138 void SuppressEventForwarding();
1167 static UnitTest * GetInstance();
1179 const char * original_working_dir()
const;
1183 const TestCase * current_test_case()
const 1188 const TestInfo * current_test_info()
const 1192 int random_seed()
const;
1194 #if GTEST_HAS_PARAM_TEST 1201 #endif // GTEST_HAS_PARAM_TEST 1204 int successful_test_case_count()
const;
1207 int failed_test_case_count()
const;
1210 int total_test_case_count()
const;
1214 int test_case_to_run_count()
const;
1217 int successful_test_count()
const;
1220 int failed_test_count()
const;
1223 int reportable_disabled_test_count()
const;
1226 int disabled_test_count()
const;
1229 int reportable_test_count()
const;
1232 int total_test_count()
const;
1235 int test_to_run_count()
const;
1239 TimeInMillis start_timestamp()
const;
1242 TimeInMillis elapsed_time()
const;
1245 bool Passed()
const;
1249 bool Failed()
const;
1253 const TestCase * GetTestCase(
int i)
const;
1257 const TestResult & ad_hoc_test_result()
const;
1261 TestEventListeners & listeners();
1280 const char * file_name,
1295 TestCase * GetMutableTestCase(
int i);
1306 friend class internal::StreamingListenerTest;
1318 virtual ~UnitTest();
1326 void PopGTestTrace()
1399 template <
typename ToPr
int,
typename OtherOperand>
1400 class FormatForComparison
1410 template <
typename ToPr
int,
size_t N,
typename OtherOperand>
1423 #define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType) \ 1424 template <typename OtherOperand> \ 1425 class FormatForComparison<CharType*, OtherOperand> { \ 1427 static ::std::string Format(CharType* value) { \ 1428 return ::testing::PrintToString(static_cast<const void*>(value)); \ 1437 #undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_ 1442 #define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \ 1444 class FormatForComparison<CharType*, OtherStringType> { \ 1446 static ::std::string Format(CharType* value) { \ 1447 return ::testing::PrintToString(value); \ 1454 #if GTEST_HAS_GLOBAL_STRING 1459 #if GTEST_HAS_GLOBAL_WSTRING 1464 #if GTEST_HAS_STD_WSTRING 1469 #undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_ 1479 template <
typename T1,
typename T2>
1481 const T1 & value,
const T2 & )
1487 template <
typename T1,
typename T2>
1488 AssertionResult
CmpHelperEQ(
const char * expected_expression,
1489 const char * actual_expression,
1490 const T1 & expected,
1494 # pragma warning(push) // Saves the current warning state. 1495 # pragma warning(disable:4389) // Temporarily disables warning on 1499 if (expected == actual)
1505 # pragma warning(pop) // Restores the warning state. 1519 const char * actual_expression,
1527 template <
bool lhs_is_null_literal>
1532 template <
typename T1,
typename T2>
1534 const char * actual_expression,
1535 const T1 & expected,
1538 return CmpHelperEQ(expected_expression, actual_expression, expected,
1549 const char * actual_expression,
1553 return CmpHelperEQ(expected_expression, actual_expression, expected,
1568 template <
typename T1,
typename T2>
1570 const char * expected_expression,
1571 const char * actual_expression,
1572 const T1 & expected,
1581 return CmpHelperEQ(expected_expression, actual_expression, expected,
1587 template <
typename T>
1589 const char * expected_expression,
1590 const char * actual_expression,
1601 return CmpHelperEQ(expected_expression, actual_expression,
1602 static_cast<T *>(NULL), actual);
1616 #define GTEST_IMPL_CMP_HELPER_(op_name, op)\ 1617 template <typename T1, typename T2>\ 1618 AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \ 1619 const T1& val1, const T2& val2) {\ 1620 if (val1 op val2) {\ 1621 return AssertionSuccess();\ 1623 return AssertionFailure() \ 1624 << "Expected: (" << expr1 << ") " #op " (" << expr2\ 1625 << "), actual: " << FormatForComparisonFailureMessage(val1, val2)\ 1626 << " vs " << FormatForComparisonFailureMessage(val2, val1);\ 1629 GTEST_API_ AssertionResult CmpHelper##op_name(\ 1630 const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2) 1645 #undef GTEST_IMPL_CMP_HELPER_ 1651 const char * actual_expression,
1652 const char * expected,
1653 const char * actual);
1659 const char * actual_expression,
1660 const char * expected,
1661 const char * actual);
1667 const char * s2_expression,
1675 const char * s2_expression,
1684 const char * actual_expression,
1685 const wchar_t * expected,
1686 const wchar_t * actual);
1692 const char * s2_expression,
1694 const wchar_t * s2);
1707 const char * needle_expr,
const char * haystack_expr,
1708 const char * needle,
const char * haystack);
1710 const char * needle_expr,
const char * haystack_expr,
1711 const wchar_t * needle,
const wchar_t * haystack);
1713 const char * needle_expr,
const char * haystack_expr,
1714 const char * needle,
const char * haystack);
1716 const char * needle_expr,
const char * haystack_expr,
1717 const wchar_t * needle,
const wchar_t * haystack);
1719 const char * needle_expr,
const char * haystack_expr,
1722 const char * needle_expr,
const char * haystack_expr,
1725 #if GTEST_HAS_STD_WSTRING 1727 const char * needle_expr,
const char * haystack_expr,
1730 const char * needle_expr,
const char * haystack_expr,
1732 #endif // GTEST_HAS_STD_WSTRING 1744 template <
typename RawType>
1746 const char * actual_expression,
1750 const FloatingPoint<RawType> lhs(expected), rhs(actual);
1752 if (lhs.AlmostEquals(rhs))
1757 ::std::stringstream expected_ss;
1758 expected_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
1761 ::std::stringstream actual_ss;
1762 actual_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
1777 const char * abs_error_expr,
1803 struct AssertHelperData
1806 const char * srcfile,
1809 : type(t), file(srcfile), line(line_num),
message(msg) { }
1812 const char *
const file;
1827 #if GTEST_HAS_PARAM_TEST 1862 template <
typename T>
1866 typedef T ParamType;
1874 const ParamType & GetParam()
const 1877 <<
"GetParam() can only be called inside a value-parameterized test " 1878 <<
"-- did you intend to write TEST_P instead of TEST_F?";
1885 static void SetParam(
const ParamType * parameter)
1887 parameter_ = parameter;
1891 static const ParamType * parameter_;
1897 template <
typename T>
1903 template <
typename T>
1908 #endif // GTEST_HAS_PARAM_TEST 1930 #define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed") 1934 #define ADD_FAILURE_AT(file, line) \ 1935 GTEST_MESSAGE_AT_(file, line, "Failed", \ 1936 ::testing::TestPartResult::kNonFatalFailure) 1939 #define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed") 1943 #if !GTEST_DONT_DEFINE_FAIL 1944 # define FAIL() GTEST_FAIL() 1948 #define GTEST_SUCCEED() GTEST_SUCCESS_("Succeeded") 1952 #if !GTEST_DONT_DEFINE_SUCCEED 1953 # define SUCCEED() GTEST_SUCCEED() 1965 #define EXPECT_THROW(statement, expected_exception) \ 1966 GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_) 1967 #define EXPECT_NO_THROW(statement) \ 1968 GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_) 1969 #define EXPECT_ANY_THROW(statement) \ 1970 GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_) 1971 #define ASSERT_THROW(statement, expected_exception) \ 1972 GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_) 1973 #define ASSERT_NO_THROW(statement) \ 1974 GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_) 1975 #define ASSERT_ANY_THROW(statement) \ 1976 GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_) 1981 #define EXPECT_TRUE(condition) \ 1982 GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \ 1983 GTEST_NONFATAL_FAILURE_) 1984 #define EXPECT_FALSE(condition) \ 1985 GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \ 1986 GTEST_NONFATAL_FAILURE_) 1987 #define ASSERT_TRUE(condition) \ 1988 GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \ 1989 GTEST_FATAL_FAILURE_) 1990 #define ASSERT_FALSE(condition) \ 1991 GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \ 1992 GTEST_FATAL_FAILURE_) 1996 #include "gtest/gtest_pred_impl.h" 2044 #define EXPECT_EQ(expected, actual) \ 2045 EXPECT_PRED_FORMAT2(::testing::internal:: \ 2046 EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \ 2048 #define EXPECT_NE(expected, actual) \ 2049 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, expected, actual) 2050 #define EXPECT_LE(val1, val2) \ 2051 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2) 2052 #define EXPECT_LT(val1, val2) \ 2053 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2) 2054 #define EXPECT_GE(val1, val2) \ 2055 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2) 2056 #define EXPECT_GT(val1, val2) \ 2057 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2) 2059 #define GTEST_ASSERT_EQ(expected, actual) \ 2060 ASSERT_PRED_FORMAT2(::testing::internal:: \ 2061 EqHelper<GTEST_IS_NULL_LITERAL_(expected)>::Compare, \ 2063 #define GTEST_ASSERT_NE(val1, val2) \ 2064 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2) 2065 #define GTEST_ASSERT_LE(val1, val2) \ 2066 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2) 2067 #define GTEST_ASSERT_LT(val1, val2) \ 2068 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2) 2069 #define GTEST_ASSERT_GE(val1, val2) \ 2070 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2) 2071 #define GTEST_ASSERT_GT(val1, val2) \ 2072 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2) 2077 #if !GTEST_DONT_DEFINE_ASSERT_EQ 2078 # define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2) 2081 #if !GTEST_DONT_DEFINE_ASSERT_NE 2082 # define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2) 2085 #if !GTEST_DONT_DEFINE_ASSERT_LE 2086 # define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2) 2089 #if !GTEST_DONT_DEFINE_ASSERT_LT 2090 # define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2) 2093 #if !GTEST_DONT_DEFINE_ASSERT_GE 2094 # define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2) 2097 #if !GTEST_DONT_DEFINE_ASSERT_GT 2098 # define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2) 2117 #define EXPECT_STREQ(expected, actual) \ 2118 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual) 2119 #define EXPECT_STRNE(s1, s2) \ 2120 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2) 2121 #define EXPECT_STRCASEEQ(expected, actual) \ 2122 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual) 2123 #define EXPECT_STRCASENE(s1, s2)\ 2124 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2) 2126 #define ASSERT_STREQ(expected, actual) \ 2127 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual) 2128 #define ASSERT_STRNE(s1, s2) \ 2129 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2) 2130 #define ASSERT_STRCASEEQ(expected, actual) \ 2131 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual) 2132 #define ASSERT_STRCASENE(s1, s2)\ 2133 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2) 2149 #define EXPECT_FLOAT_EQ(expected, actual)\ 2150 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \ 2153 #define EXPECT_DOUBLE_EQ(expected, actual)\ 2154 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \ 2157 #define ASSERT_FLOAT_EQ(expected, actual)\ 2158 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \ 2161 #define ASSERT_DOUBLE_EQ(expected, actual)\ 2162 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \ 2165 #define EXPECT_NEAR(val1, val2, abs_error)\ 2166 EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \ 2167 val1, val2, abs_error) 2169 #define ASSERT_NEAR(val1, val2, abs_error)\ 2170 ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \ 2171 val1, val2, abs_error) 2181 float val1,
float val2);
2183 double val1,
double val2);
2186 #if GTEST_OS_WINDOWS 2197 # define EXPECT_HRESULT_SUCCEEDED(expr) \ 2198 EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr)) 2200 # define ASSERT_HRESULT_SUCCEEDED(expr) \ 2201 ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr)) 2203 # define EXPECT_HRESULT_FAILED(expr) \ 2204 EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr)) 2206 # define ASSERT_HRESULT_FAILED(expr) \ 2207 ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr)) 2209 #endif // GTEST_OS_WINDOWS 2221 #define ASSERT_NO_FATAL_FAILURE(statement) \ 2222 GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_) 2223 #define EXPECT_NO_FATAL_FAILURE(statement) \ 2224 GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_) 2237 #define SCOPED_TRACE(message) \ 2238 ::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\ 2239 __FILE__, __LINE__, ::testing::Message() << (message)) 2271 template <
typename T1,
typename T2>
2274 (void)internal::StaticAssertTypeEqHelper<T1, T2>();
2303 #define GTEST_TEST(test_case_name, test_name)\ 2304 GTEST_TEST_(test_case_name, test_name, \ 2305 ::testing::Test, ::testing::internal::GetTestTypeId()) 2309 #if !GTEST_DONT_DEFINE_TEST 2310 # define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name) 2339 #define TEST_F(test_fixture, test_name)\ 2340 GTEST_TEST_(test_fixture, test_name, test_fixture, \ 2341 ::testing::internal::GetTypeId<test_fixture>()) 2357 return ::testing::UnitTest::GetInstance()->Run();
2360 #endif // GTEST_INCLUDE_GTEST_GTEST_H_
UnitTestImpl * GetUnitTestImpl()
internal::SetUpTestCaseFunc SetUpTestCaseFunc
const char * type_param() const
void ReportFailureInUnknownLocation(TestPartResult::Type result_type, const std::string &message)
virtual void OnTestProgramStart(const UnitTest &)
virtual void OnEnvironmentsSetUpEnd(const UnitTest &)
int death_test_count() const
static AssertionResult Compare(const char *expected_expression, const char *actual_expression, Secret *, T *actual)
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)
void(* TearDownTestCaseFunc)()
static void SetUpTestCase()
AssertionResult AssertionFailure()
const std::vector< TestProperty > & test_properties() const
GTEST_DECLARE_int32_(random_seed)
Environment * AddGlobalTestEnvironment(Environment *env)
virtual ~TestEventListener()
static AssertionResult Compare(const char *expected_expression, const char *actual_expression, BiggestInt expected, BiggestInt actual)
const std::vector< TestInfo * > & test_info_list() const
static bool TestFailed(const TestInfo *test_info)
::std::string PrintToString(const T &value)
AssertionResult CmpHelperFloatingPointEQ(const char *expected_expression, const char *actual_expression, RawType expected, RawType actual)
static bool TestReportableDisabled(const TestInfo *test_info)
const internal::UnitTestImpl * impl() const
static void ClearTestResult(TestInfo *test_info)
virtual void OnTestCaseEnd(const TestCase &)
const std::vector< TestPartResult > & test_part_results() const
int increment_death_test_count()
AssertionResult CmpHelperSTRCASENE(const char *s1_expression, const char *s2_expression, const char *s1, const char *s2)
static AssertionResult Compare(const char *expected_expression, const char *actual_expression, const T1 &expected, const T2 &actual, typename EnableIf< !is_pointer< T2 >::value >::type *=0)
void(* SetUpTestCaseFunc)()
std::vector< TestInfo * > & test_info_list()
std::string StringStreamToString(::std::stringstream *ss)
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
void set_elapsed_time(TimeInMillis elapsed)
TestEventListener * default_xml_generator() const
AssertionResult DoubleNearPredFormat(const char *expr1, const char *expr2, const char *abs_error_expr, double val1, double val2, double abs_error)
virtual void OnTestPartResult(const TestPartResult &)
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char,::std::string)
internal::TearDownTestCaseFunc TearDownTestCaseFunc
TestInfo * MakeAndRegisterTestInfo(const char *test_case_name, const char *name, const char *type_param, const char *value_param, TypeId fixture_class_id, SetUpTestCaseFunc set_up_tc, TearDownTestCaseFunc tear_down_tc, TestFactoryBase *factory)
std::string FormatForComparisonFailureMessage(const T1 &value, const T2 &)
virtual void OnEnvironmentsTearDownEnd(const UnitTest &)
const char * failure_message() const
void AppendMessage(const Message &a_message)
void SetValue(const std::string &new_value)
int increment_death_test_count()
AssertionResult CmpHelperEQ(const char *expected_expression, const char *actual_expression, BiggestInt expected, BiggestInt actual)
virtual Setup_should_be_spelled_SetUp * Setup()
GTEST_DECLARE_bool_(death_test_use_fork)
GTEST_IMPL_CMP_HELPER_(NE,!=)
bool is_reportable() const
const char * name() const
const char * message() const
AssertionResult AssertionSuccess()
AssertionResult & operator<<(const T &value)
const int kMaxStackTraceDepth
static bool TestPassed(const TestInfo *test_info)
GTEST_DECLARE_string_(death_test_style)
#define GTEST_DISALLOW_ASSIGN_(type)
virtual Setup_should_be_spelled_SetUp * Setup()
virtual void OnTestIterationStart(const UnitTest &, int)
const char * value_param() const
std::string GetString() const
AssertionResult IsSubstring(const char *needle_expr, const char *haystack_expr, const char *needle, const char *haystack)
AssertionResult CmpHelperSTRCASEEQ(const char *expected_expression, const char *actual_expression, const char *expected, const char *actual)
AssertHelperData(TestPartResult::Type t, const char *srcfile, int line_num, const char *msg)
const char * test_case_name() const
AssertionResult CmpHelperSTRNE(const char *s1_expression, const char *s2_expression, const char *s1, const char *s2)
const TestResult & ad_hoc_test_result() const
virtual void OnEnvironmentsTearDownStart(const UnitTest &)
Environment * AddEnvironment(Environment *env)
AssertionResult & operator<<(::std::ostream &(*basic_manipulator)(::std::ostream &stream))
internal::UnitTestImpl * impl()
virtual void OnTestCaseStart(const TestCase &)
virtual void OnTestProgramEnd(const UnitTest &)
static void ClearTestCaseResult(TestCase *test_case)
static bool TestDisabled(const TestInfo *test_info)
AssertionResult EqFailure(const char *expected_expression, const char *actual_expression, const std::string &expected_value, const std::string &actual_value, bool ignoring_case)
TestProperty(const std::string &a_key, const std::string &a_value)
static bool TestReportable(const TestInfo *test_info)
virtual void OnTestIterationEnd(const UnitTest &, int)
void RunTearDownTestCase()
bool StaticAssertTypeEq()
virtual void OnEnvironmentsSetUpStart(const UnitTest &)
AssertionResult DoubleLE(const char *expr1, const char *expr2, double val1, double val2)
void set_should_run(bool should)
void InitGoogleTest(int *argc, char **argv)
const char * name() const
TimeInMillis elapsed_time() const
const TestResult * result() const
#define GTEST_MUST_USE_RESULT_
AssertionResult IsNotSubstring(const char *needle_expr, const char *haystack_expr, const char *needle, const char *haystack)
static UnitTest * GetInstance()
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char)
TestEventListener * default_result_printer() const
AssertionResult CmpHelperSTREQ(const char *expected_expression, const char *actual_expression, const char *expected, const char *actual)
const char * type_param() const
TypeWithSize< 8 >::Int TimeInMillis
virtual void OnTestStart(const TestInfo &)
#define GTEST_CHECK_(condition)
const char * value() const
AssertionResult(bool success)
static bool ShouldRunTest(const TestInfo *test_info)
static AssertionResult Compare(const char *expected_expression, const char *actual_expression, const T1 &expected, const T2 &actual)
virtual void OnTestEnd(const TestInfo &)
static void TearDownTestCase()
#define GTEST_LOCK_EXCLUDED_(locks)
AssertionResult FloatLE(const char *expr1, const char *expr2, float val1, float val2)
TimeInMillis elapsed_time() const