52 #ifndef GTEST_INCLUDE_GTEST_GTEST_H_
53 #define GTEST_INCLUDE_GTEST_GTEST_H_
59 #include <type_traits>
81 # pragma warning(push)
82 # pragma warning(disable:4805)
83 # pragma warning(disable:4100)
162 #if GTEST_USE_OWN_FLAGFILE_FLAG_
164 #endif // GTEST_USE_OWN_FLAGFILE_FLAG_
167 const int kMaxStackTraceDepth = 100;
172 class DefaultGlobalTestPartResultReporter;
174 class NoExecDeathTest;
175 class FinalSuccessChecker;
176 class GTestFlagSaver;
177 class StreamingListenerTest;
178 class TestResultAccessor;
179 class TestEventListenersAccessor;
180 class TestEventRepeater;
181 class UnitTestRecordPropertyTestHelper;
182 class WindowsDeathTest;
183 class FuchsiaDeathTest;
184 class UnitTestImpl* GetUnitTestImpl();
186 const std::string& message);
198 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
199 using TestCase = TestSuite;
287 AssertionResult(
const AssertionResult& other);
293 #if defined(_MSC_VER) && (_MSC_VER < 1910 || _MSC_VER >= 1920)
304 template <
typename T>
305 explicit AssertionResult(
307 typename std::enable_if<
311 : success_(success) {}
313 #if defined(_MSC_VER) && (_MSC_VER < 1910 || _MSC_VER >= 1920)
318 AssertionResult& operator=(AssertionResult other) {
324 operator bool()
const {
return success_; }
333 const char* message()
const {
334 return message_.get() !=
nullptr ? message_->c_str() :
"";
337 const char* failure_message()
const {
return message(); }
341 AppendMessage(Message() << value);
348 ::std::ostream& (*basic_manipulator)(::std::ostream& stream)) {
349 AppendMessage(Message() << basic_manipulator);
355 void AppendMessage(
const Message& a_message) {
356 if (message_.get() ==
nullptr) message_.reset(new ::std::string);
357 message_->append(a_message.GetString().c_str());
361 void swap(AssertionResult& other);
369 std::unique_ptr< ::std::string> message_;
438 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
441 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
444 static bool HasFatalFailure();
447 static bool HasNonfatalFailure();
450 static bool IsSkipped();
454 static bool HasFailure() {
return HasFatalFailure() || HasNonfatalFailure(); }
469 static void RecordProperty(
const std::string& key,
const std::string&
value);
470 static void RecordProperty(
const std::string& key,
int value);
477 virtual void SetUp();
480 virtual void TearDown();
485 static bool HasSameFixtureClass();
493 virtual void TestBody() = 0;
580 int total_part_count()
const;
583 int test_property_count()
const;
586 bool Passed()
const {
return !Skipped() && !Failed(); }
589 bool Skipped()
const;
595 bool HasFatalFailure()
const;
598 bool HasNonfatalFailure()
const;
609 const TestPartResult& GetTestPartResult(
int i)
const;
620 friend class internal::DefaultGlobalTestPartResultReporter;
621 friend class internal::ExecDeathTest;
622 friend class internal::TestResultAccessor;
623 friend class internal::UnitTestImpl;
624 friend class internal::WindowsDeathTest;
625 friend class internal::FuchsiaDeathTest;
629 return test_part_results_;
634 return test_properties_;
649 void RecordProperty(
const std::string& xml_element,
655 static bool ValidateTestProperty(
const std::string& xml_element,
659 void AddTestPartResult(
const TestPartResult& test_part_result);
668 void ClearTestPartResults();
713 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
715 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
723 if (type_param_.get() !=
nullptr)
return type_param_->c_str();
730 if (value_param_.get() !=
nullptr)
return value_param_->c_str();
735 const char*
file()
const {
return location_.file.c_str(); }
738 int line()
const {
return location_.line; }
765 return matches_filter_ && !is_in_another_shard_;
772 #if GTEST_HAS_DEATH_TEST
773 friend class internal::DefaultDeathTestFactory;
774 #endif // GTEST_HAS_DEATH_TEST
777 friend class internal::UnitTestImpl;
778 friend class internal::StreamingListenerTest;
780 const char* test_suite_name,
const char* name,
const char* type_param,
788 TestInfo(
const std::string& test_suite_name,
const std::string& name,
789 const char* a_type_param,
790 const char* a_value_param,
798 return result_.increment_death_test_count();
855 TestSuite(
const char* name,
const char* a_type_param,
868 if (type_param_.get() !=
nullptr)
return type_param_->c_str();
876 int successful_test_count()
const;
879 int skipped_test_count()
const;
882 int failed_test_count()
const;
885 int reportable_disabled_test_count()
const;
888 int disabled_test_count()
const;
891 int reportable_test_count()
const;
894 int test_to_run_count()
const;
897 int total_test_count()
const;
900 bool Passed()
const {
return !Failed(); }
904 return failed_test_count() > 0 || ad_hoc_test_result().Failed();
916 const TestInfo* GetTestInfo(
int i)
const;
924 friend class internal::UnitTestImpl;
931 return test_info_list_;
943 void AddTestInfo(
TestInfo * test_info);
962 if (set_up_tc_ !=
nullptr) {
970 if (tear_down_tc_ !=
nullptr) {
1015 void UnshuffleTests();
1078 #if GTEST_HAS_EXCEPTIONS
1082 :
public internal::GoogleTestFailureException {
1084 explicit AssertionException(
const TestPartResult& result)
1085 : GoogleTestFailureException(result) {}
1088 #endif // GTEST_HAS_EXCEPTIONS
1115 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1117 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1134 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1136 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1166 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1168 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1174 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1176 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1207 return default_result_printer_;
1218 return default_xml_generator_;
1224 friend class internal::DefaultGlobalTestPartResultReporter;
1225 friend class internal::NoExecDeathTest;
1227 friend class internal::UnitTestImpl;
1249 bool EventForwardingEnabled()
const;
1250 void SuppressEventForwarding();
1290 const char* original_working_dir()
const;
1297 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1303 const TestInfo* current_test_info()
const
1307 int random_seed()
const;
1317 int successful_test_suite_count()
const;
1320 int failed_test_suite_count()
const;
1323 int total_test_suite_count()
const;
1327 int test_suite_to_run_count()
const;
1330 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1331 int successful_test_case_count()
const;
1332 int failed_test_case_count()
const;
1333 int total_test_case_count()
const;
1334 int test_case_to_run_count()
const;
1335 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1338 int successful_test_count()
const;
1341 int skipped_test_count()
const;
1344 int failed_test_count()
const;
1347 int reportable_disabled_test_count()
const;
1350 int disabled_test_count()
const;
1353 int reportable_test_count()
const;
1356 int total_test_count()
const;
1359 int test_to_run_count()
const;
1370 bool Passed()
const;
1374 bool Failed()
const;
1381 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1382 const TestCase* GetTestCase(
int i)
const;
1383 #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1387 const TestResult& ad_hoc_test_result()
const;
1409 void AddTestPartResult(TestPartResult::Type result_type,
1410 const char* file_name,
1412 const std::string& message,
1413 const std::string& os_stack_trace)
1421 void RecordProperty(
const std::string& key,
const std::string&
value);
1428 internal::UnitTestImpl*
impl() {
return impl_; }
1429 const internal::UnitTestImpl*
impl()
const {
return impl_; }
1436 friend class internal::StreamingListenerTest;
1440 friend internal::UnitTestImpl* internal::GetUnitTestImpl();
1442 TestPartResult::Type result_type,
1443 const std::string& message);
1453 void PushGTestTrace(
const internal::TraceInfo& trace)
1457 void PopGTestTrace()
1458 GTEST_LOCK_EXCLUDED_(mutex_);
1462 mutable internal::Mutex mutex_;
1468 internal::UnitTestImpl* impl_;
1515 namespace internal {
1520 template <
typename T1,
typename T2>
1522 const char* rhs_expression,
1523 const T1& lhs,
const T2& rhs) {
1539 template <
typename T1,
typename T2>
1541 const char* rhs_expression,
1555 const char* rhs_expression,
1563 typename T1,
typename T2,
1568 static AssertionResult
Compare(
const char* lhs_expression,
1569 const char* rhs_expression,
const T1& lhs,
1571 return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
1580 static AssertionResult
Compare(
const char* lhs_expression,
1581 const char* rhs_expression,
1584 return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
1587 template <
typename T>
1589 const char* lhs_expression,
const char* rhs_expression,
1591 std::nullptr_t ,
T* rhs) {
1593 return CmpHelperEQ(lhs_expression, rhs_expression, static_cast<T*>(
nullptr),
1601 template <
typename T1,
typename T2>
1603 const T1& val1,
const T2& val2,
1606 <<
"Expected: (" << expr1 <<
") " << op <<
" (" << expr2
1622 #define GTEST_IMPL_CMP_HELPER_(op_name, op)\
1623 template <typename T1, typename T2>\
1624 AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
1625 const T1& val1, const T2& val2) {\
1626 if (val1 op val2) {\
1627 return AssertionSuccess();\
1629 return CmpHelperOpFailure(expr1, expr2, val1, val2, #op);\
1632 GTEST_API_ AssertionResult CmpHelper##op_name(\
1633 const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2)
1648 #undef GTEST_IMPL_CMP_HELPER_
1654 const char* s2_expression,
1662 const char* s2_expression,
1670 const char* s2_expression,
1678 const char* s2_expression,
1687 const char* s2_expression,
1695 const char* s2_expression,
1710 const char* needle_expr,
const char* haystack_expr,
1711 const char* needle,
const char* haystack);
1713 const char* needle_expr,
const char* haystack_expr,
1714 const wchar_t* needle,
const wchar_t* haystack);
1716 const char* needle_expr,
const char* haystack_expr,
1717 const char* needle,
const char* haystack);
1719 const char* needle_expr,
const char* haystack_expr,
1720 const wchar_t* needle,
const wchar_t* haystack);
1722 const char* needle_expr,
const char* haystack_expr,
1723 const ::std::string& needle, const ::std::string& haystack);
1725 const char* needle_expr,
const char* haystack_expr,
1726 const ::std::string& needle, const ::std::string& haystack);
1728 #if GTEST_HAS_STD_WSTRING
1730 const char* needle_expr,
const char* haystack_expr,
1731 const ::std::wstring& needle, const ::std::wstring& haystack);
1733 const char* needle_expr,
const char* haystack_expr,
1734 const ::std::wstring& needle, const ::std::wstring& haystack);
1735 #endif // GTEST_HAS_STD_WSTRING
1737 namespace internal {
1746 template <
typename RawType>
1748 const char* rhs_expression,
1750 RawType rhs_value) {
1753 if (lhs.AlmostEquals(rhs)) {
1757 ::std::stringstream lhs_ss;
1758 lhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
1761 ::std::stringstream rhs_ss;
1762 rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
1777 const char* abs_error_expr,
1790 const char* message);
1795 void operator=(
const Message& message)
const;
1804 const char* srcfile,
1807 : type(t), file(srcfile), line(line_num), message(msg) { }
1859 template <
typename T>
1869 <<
"GetParam() can only be called inside a value-parameterized test "
1870 <<
"-- did you intend to write TEST_P instead of TEST_F?";
1878 parameter_ = parameter;
1888 template <
typename T>
1894 template <
typename T>
1903 #define GTEST_SKIP() GTEST_SKIP_("")
1923 #define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
1927 #define ADD_FAILURE_AT(file, line) \
1928 GTEST_MESSAGE_AT_(file, line, "Failed", \
1929 ::testing::TestPartResult::kNonFatalFailure)
1932 #define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed")
1935 #define GTEST_FAIL_AT(file, line) \
1936 GTEST_MESSAGE_AT_(file, line, "Failed", \
1937 ::testing::TestPartResult::kFatalFailure)
1941 #if !GTEST_DONT_DEFINE_FAIL
1942 # define FAIL() GTEST_FAIL()
1946 #define GTEST_SUCCEED() GTEST_SUCCESS_("Succeeded")
1950 #if !GTEST_DONT_DEFINE_SUCCEED
1951 # define SUCCEED() GTEST_SUCCEED()
1963 #define EXPECT_THROW(statement, expected_exception) \
1964 GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)
1965 #define EXPECT_NO_THROW(statement) \
1966 GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
1967 #define EXPECT_ANY_THROW(statement) \
1968 GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)
1969 #define ASSERT_THROW(statement, expected_exception) \
1970 GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)
1971 #define ASSERT_NO_THROW(statement) \
1972 GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)
1973 #define ASSERT_ANY_THROW(statement) \
1974 GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)
1979 #define EXPECT_TRUE(condition) \
1980 GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
1981 GTEST_NONFATAL_FAILURE_)
1982 #define EXPECT_FALSE(condition) \
1983 GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
1984 GTEST_NONFATAL_FAILURE_)
1985 #define ASSERT_TRUE(condition) \
1986 GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
1987 GTEST_FATAL_FAILURE_)
1988 #define ASSERT_FALSE(condition) \
1989 GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
1990 GTEST_FATAL_FAILURE_)
2038 #define EXPECT_EQ(val1, val2) \
2039 EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
2040 #define EXPECT_NE(val1, val2) \
2041 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
2042 #define EXPECT_LE(val1, val2) \
2043 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
2044 #define EXPECT_LT(val1, val2) \
2045 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
2046 #define EXPECT_GE(val1, val2) \
2047 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
2048 #define EXPECT_GT(val1, val2) \
2049 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
2051 #define GTEST_ASSERT_EQ(val1, val2) \
2052 ASSERT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
2053 #define GTEST_ASSERT_NE(val1, val2) \
2054 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
2055 #define GTEST_ASSERT_LE(val1, val2) \
2056 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
2057 #define GTEST_ASSERT_LT(val1, val2) \
2058 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
2059 #define GTEST_ASSERT_GE(val1, val2) \
2060 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
2061 #define GTEST_ASSERT_GT(val1, val2) \
2062 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
2067 #if !GTEST_DONT_DEFINE_ASSERT_EQ
2068 # define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
2071 #if !GTEST_DONT_DEFINE_ASSERT_NE
2072 # define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
2075 #if !GTEST_DONT_DEFINE_ASSERT_LE
2076 # define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
2079 #if !GTEST_DONT_DEFINE_ASSERT_LT
2080 # define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
2083 #if !GTEST_DONT_DEFINE_ASSERT_GE
2084 # define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
2087 #if !GTEST_DONT_DEFINE_ASSERT_GT
2088 # define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
2107 #define EXPECT_STREQ(s1, s2) \
2108 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
2109 #define EXPECT_STRNE(s1, s2) \
2110 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
2111 #define EXPECT_STRCASEEQ(s1, s2) \
2112 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
2113 #define EXPECT_STRCASENE(s1, s2)\
2114 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
2116 #define ASSERT_STREQ(s1, s2) \
2117 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
2118 #define ASSERT_STRNE(s1, s2) \
2119 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
2120 #define ASSERT_STRCASEEQ(s1, s2) \
2121 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
2122 #define ASSERT_STRCASENE(s1, s2)\
2123 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
2139 #define EXPECT_FLOAT_EQ(val1, val2)\
2140 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
2143 #define EXPECT_DOUBLE_EQ(val1, val2)\
2144 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
2147 #define ASSERT_FLOAT_EQ(val1, val2)\
2148 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
2151 #define ASSERT_DOUBLE_EQ(val1, val2)\
2152 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
2155 #define EXPECT_NEAR(val1, val2, abs_error)\
2156 EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
2157 val1, val2, abs_error)
2159 #define ASSERT_NEAR(val1, val2, abs_error)\
2160 ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
2161 val1, val2, abs_error)
2171 float val1,
float val2);
2173 double val1,
double val2);
2176 #if GTEST_OS_WINDOWS
2187 # define EXPECT_HRESULT_SUCCEEDED(expr) \
2188 EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
2190 # define ASSERT_HRESULT_SUCCEEDED(expr) \
2191 ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
2193 # define EXPECT_HRESULT_FAILED(expr) \
2194 EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
2196 # define ASSERT_HRESULT_FAILED(expr) \
2197 ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
2199 #endif // GTEST_OS_WINDOWS
2211 #define ASSERT_NO_FATAL_FAILURE(statement) \
2212 GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
2213 #define EXPECT_NO_FATAL_FAILURE(statement) \
2214 GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
2233 template <
typename T>
2235 PushTrace(file, line, (
Message() << message).GetString());
2240 PushTrace(file, line, message ? message :
"(null)");
2244 PushTrace(file, line, message);
2254 void PushTrace(
const char* file,
int line, std::string message);
2276 #define SCOPED_TRACE(message) \
2277 ::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
2278 __FILE__, __LINE__, (message))
2310 template <
typename T1,
typename T2>
2341 #define GTEST_TEST(test_suite_name, test_name) \
2342 GTEST_TEST_(test_suite_name, test_name, ::testing::Test, \
2343 ::testing::internal::GetTestTypeId())
2347 #if !GTEST_DONT_DEFINE_TEST
2348 #define TEST(test_suite_name, test_name) GTEST_TEST(test_suite_name, test_name)
2378 #if !GTEST_DONT_DEFINE_TEST
2379 #define TEST_F(test_fixture, test_name)\
2380 GTEST_TEST_(test_fixture, test_name, test_fixture, \
2381 ::testing::internal::GetTypeId<test_fixture>())
2382 #endif // !GTEST_DONT_DEFINE_TEST
2389 # pragma warning(pop)
2449 template <
int&... ExplicitParameterBarrier,
typename Factory>
2451 const char* type_param,
const char* value_param,
2452 const char* file,
int line, Factory factory) {
2453 using TestT =
typename std::remove_pointer<decltype(factory())>::type;
2457 explicit FactoryImpl(Factory
f) : factory_(std::move(f)) {}
2458 Test* CreateTest()
override {
return factory_(); }
2465 test_suite_name, test_name, type_param, value_param,
2469 new FactoryImpl{std::move(factory)});
2485 return ::testing::UnitTest::GetInstance()->Run();
2490 #endif // GTEST_INCLUDE_GTEST_GTEST_H_
const char * file() const
void ReportFailureInUnknownLocation(TestPartResult::Type result_type, const std::string &message)
Environment * AddGlobalTestEnvironment(Environment *env)
int death_test_count() const
SACADO_INLINE_FUNCTION bool operator!(const Expr< ExprT > &expr)
static void SetUpTestCase()
virtual void OnTestCaseStart(const TestCase &)
AssertionResult AssertionFailure()
#define GTEST_DECLARE_bool_(name)
virtual void OnEnvironmentsTearDownStart(const UnitTest &unit_test)=0
const std::vector< TestProperty > & test_properties() const
virtual ~TestEventListener()
const std::string test_suite_name_
static const ParamType * parameter_
AssertionResult CmpHelperEQ(const char *lhs_expression, const char *rhs_expression, const T1 &lhs, const T2 &rhs)
std::vector< TestInfo * > test_info_list_
#define GTEST_DISABLE_MSC_WARNINGS_POP_()
internal::TestEventRepeater * repeater_
GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char *s1_expression, const char *s2_expression, const char *s1, const char *s2)
const internal::UnitTestImpl * impl() const
static void ClearTestResult(TestInfo *test_info)
GTEST_API_ AssertionResult CmpHelperSTREQ(const char *s1_expression, const char *s2_expression, const char *s1, const char *s2)
internal::Mutex test_properites_mutex_
internal::TearDownTestSuiteFunc tear_down_tc_
const std::vector< TestPartResult > & test_part_results() const
int increment_death_test_count()
GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char *s1_expression, const char *s2_expression, const char *s1, const char *s2)
void OnTestCaseStart(const TestCase &) override
TestPartResult::Type const type
virtual void OnTestIterationStart(const UnitTest &unit_test, int iteration)=0
static bool TestPassed(const TestInfo *test_info)
virtual void OnEnvironmentsSetUpStart(const UnitTest &unit_test)=0
void set_elapsed_time(TimeInMillis elapsed)
TestEventListener * default_xml_generator() const
GTEST_API_ AssertionResult DoubleNearPredFormat(const char *expr1, const char *expr2, const char *abs_error_expr, double val1, double val2, double abs_error)
static void SetParam(const ParamType *parameter)
virtual void OnTestStart(const TestInfo &test_info)=0
void OnEnvironmentsSetUpEnd(const UnitTest &) override
void OnTestEnd(const TestInfo &) override
const char * name() const
void OnTestIterationStart(const UnitTest &, int) override
std::string FormatForComparisonFailureMessage(const T1 &value, const T2 &)
TestResult ad_hoc_test_result_
#define GTEST_LOCK_EXCLUDED_(locks)
const std::unique_ptr< const ::std::string > type_param_
void(*)( TearDownTestSuiteFunc)
TimeInMillis start_timestamp_
const std::vector< TestInfo * > & test_info_list() const
AssertHelperData *const data_
void SetValue(const std::string &new_value)
void RunTearDownTestSuite()
internal::TimeInMillis TimeInMillis
void OnTestStart(const TestInfo &) override
bool operator!=(const Allocator< T > &a_t, const Allocator< U > &a_u)
std::ostream & operator<<(std::ostream &os, const Expr< T > &xx)
int increment_death_test_count()
internal::TestFactoryBase *const factory_
static AssertionResult Compare(const char *lhs_expression, const char *rhs_expression, BiggestInt lhs, BiggestInt rhs)
const std::unique_ptr< GTEST_FLAG_SAVER_ > gtest_flag_saver_
const internal::TypeId fixture_class_id_
static AssertionResult Compare(const char *lhs_expression, const char *rhs_expression, std::nullptr_t, T *rhs)
AssertionResult CmpHelperFloatingPointEQ(const char *lhs_expression, const char *rhs_expression, RawType lhs_value, RawType rhs_value)
void OnTestCaseEnd(const TestCase &) override
#define GTEST_IMPL_CMP_HELPER_(op_name, op)
void OnEnvironmentsSetUpStart(const UnitTest &) override
void OnTestSuiteStart(const TestSuite &) override
virtual Setup_should_be_spelled_SetUp * Setup()
bool is_reportable() const
const char * name() const
virtual void OnTestIterationEnd(const UnitTest &unit_test, int iteration)=0
virtual void OnTestProgramEnd(const UnitTest &unit_test)=0
const std::unique_ptr< const ::std::string > type_param_
AssertionResult AssertionSuccess()
void OnTestProgramStart(const UnitTest &) override
#define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings)
GTEST_API_ TestInfo * 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)
#define GTEST_CHECK_(condition)
std::string const message
std::vector< TestPartResult > test_part_results_
#define GTEST_DECLARE_int32_(name)
std::vector< TestProperty > test_properties_
static void TearDownTestSuite()
TimeInMillis start_timestamp() const
AssertionResult CmpHelperOpFailure(const char *expr1, const char *expr2, const T1 &val1, const T2 &val2, const char *op)
std::vector< int > test_indices_
const char * type_param() const
virtual void OnTestSuiteEnd(const TestSuite &)
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)
virtual Setup_should_be_spelled_SetUp * Setup()
TimeInMillis start_timestamp_
void OnTestPartResult(const TestPartResult &) override
virtual void OnTestSuiteStart(const TestSuite &)
const char * value_param() const
GTEST_API_ AssertionResult IsSubstring(const char *needle_expr, const char *haystack_expr, const char *needle, const char *haystack)
static bool ShouldRunTest(const TestInfo *test_info)
AssertHelperData(TestPartResult::Type t, const char *srcfile, int line_num, const char *msg)
virtual ~WithParamInterface()
const char * test_case_name() const
TimeInMillis start_timestamp() const
void set_start_timestamp(TimeInMillis start)
virtual void OnEnvironmentsTearDownEnd(const UnitTest &unit_test)=0
GTEST_API_ AssertionResult CmpHelperSTRNE(const char *s1_expression, const char *s2_expression, const char *s1, const char *s2)
#define GTEST_DECLARE_string_(name)
Environment * AddEnvironment(Environment *env)
const char * test_suite_name() const
static bool TestDisabled(const TestInfo *test_info)
internal::UnitTestImpl * impl()
TimeInMillis elapsed_time_
AssertionResult CmpHelperEQFailure(const char *lhs_expression, const char *rhs_expression, const T1 &lhs, const T2 &rhs)
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)
bool operator==(const Handle< T > &h1, const Handle< T > &h2)
Compare two handles.
TestProperty(const std::string &a_key, const std::string &a_value)
TestEventListener * default_xml_generator_
virtual void OnTestPartResult(const TestPartResult &test_part_result)=0
static bool TestSkipped(const TestInfo *test_info)
TimeInMillis elapsed_time_
TestEventListener * default_result_printer_
ScopedTrace(const char *file, int line, const T &message)
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)
void OnTestProgramEnd(const UnitTest &) override
virtual void OnEnvironmentsSetUpEnd(const UnitTest &unit_test)=0
GTEST_API_ std::string StringStreamToString(::std::stringstream *stream)
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
std::vector< TestInfo * > & test_info_list()
virtual void OnTestCaseEnd(const TestCase &)
virtual void OnTestEnd(const TestInfo &test_info)=0
virtual void OnTestProgramStart(const UnitTest &unit_test)=0
static bool TestFailed(const TestInfo *test_info)
GTEST_API_ AssertionResult DoubleLE(const char *expr1, const char *expr2, double val1, double val2)
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
void set_should_run(bool should)
static const ParamType & GetParam()
const TestResult * result() const
static AssertionResult Compare(const char *lhs_expression, const char *rhs_expression, const T1 &lhs, const T2 &rhs)
GTEST_API_ AssertionResult IsNotSubstring(const char *needle_expr, const char *haystack_expr, const char *needle, const char *haystack)
static UnitTest * GetInstance()
static void SetUpTestSuite()
class GTEST_API_ testing::ScopedTrace GTEST_ATTRIBUTE_UNUSED_
TestEventListener * default_result_printer() const
void(*)( SetUpTestSuiteFunc)
constexpr bool StaticAssertTypeEq() noexcept
const char * type_param() const
void OnTestSuiteEnd(const TestSuite &) override
void OnTestIterationEnd(const UnitTest &, int) override
const char * value() const
internal::SetUpTestSuiteFunc set_up_tc_
ScopedTrace(const char *file, int line, const char *message)
TimeInMillis elapsed_time() const
static void ClearTestSuiteResult(TestSuite *test_suite)
const TestResult & ad_hoc_test_result() const
static bool TestReportable(const TestInfo *test_info)
static bool TestReportableDisabled(const TestInfo *test_info)
bool is_in_another_shard() const
const std::unique_ptr< const ::std::string > value_param_
bool is_in_another_shard_
std::set< std::string > * GetIgnoredParameterizedTestSuites()
void OnEnvironmentsTearDownStart(const UnitTest &) override
static void TearDownTestCase()
#define GTEST_MUST_USE_RESULT_
internal::CodeLocation location_
void OnEnvironmentsTearDownEnd(const UnitTest &) override
GTEST_API_ AssertionResult FloatLE(const char *expr1, const char *expr2, float val1, float val2)
ScopedTrace(const char *file, int line, const std::string &message)
GTEST_API_ std::string TempDir()
TimeInMillis elapsed_time() const