52 #ifndef GTEST_INCLUDE_GTEST_GTEST_H_
53 #define GTEST_INCLUDE_GTEST_GTEST_H_
59 #include <type_traits>
96 # pragma warning(push)
97 # pragma warning(disable:4805)
98 # pragma warning(disable:4100)
170 #if GTEST_USE_OWN_FLAGFILE_FLAG_
175 const int kMaxStackTraceDepth = 100;
180 class DefaultGlobalTestPartResultReporter;
182 class NoExecDeathTest;
183 class FinalSuccessChecker;
184 class GTestFlagSaver;
185 class StreamingListenerTest;
186 class TestResultAccessor;
187 class TestEventListenersAccessor;
188 class TestEventRepeater;
189 class UnitTestRecordPropertyTestHelper;
190 class WindowsDeathTest;
191 class FuchsiaDeathTest;
192 class UnitTestImpl* GetUnitTestImpl();
193 void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
205 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
206 using TestCase = TestSuite;
294 AssertionResult(
const AssertionResult& other);
296 #if defined(_MSC_VER) && _MSC_VER < 1910
307 template <
typename T>
308 explicit AssertionResult(
310 typename internal::EnableIf<
311 !std::is_convertible<T, AssertionResult>::value>::type*
314 : success_(success) {}
316 #if defined(_MSC_VER) && _MSC_VER < 1910
321 AssertionResult& operator=(AssertionResult other) {
327 operator bool()
const {
return success_; }
330 AssertionResult operator!()
const;
336 const char* message()
const {
337 return message_.get() !=
nullptr ? message_->c_str() :
"";
340 const char* failure_message()
const {
return message(); }
343 template <
typename T> AssertionResult&
operator<<(
const T& value) {
344 AppendMessage(Message() << value);
351 ::std::ostream& (*basic_manipulator)(::std::ostream&
stream)) {
352 AppendMessage(Message() << basic_manipulator);
358 void AppendMessage(
const Message& a_message) {
360 message_->append(a_message.GetString().c_str());
364 void swap(AssertionResult& other);
372 std::unique_ptr< ::std::string> message_;
376 GTEST_API_ AssertionResult AssertionSuccess();
379 GTEST_API_ AssertionResult AssertionFailure();
383 GTEST_API_ AssertionResult AssertionFailure(
const Message& msg);
441 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
457 static bool HasFailure() {
return HasFatalFailure() || HasNonfatalFailure(); }
488 static bool HasSameFixtureClass();
496 virtual void TestBody() = 0;
503 void DeleteSelf_() {
delete this; }
505 const std::unique_ptr<GTEST_FLAG_SAVER_> gtest_flag_saver_;
523 struct Setup_should_be_spelled_SetUp {};
524 virtual Setup_should_be_spelled_SetUp* Setup() {
return nullptr; }
542 key_(a_key), value_(a_value) {
552 return value_.c_str();
589 bool Passed()
const {
return !Skipped() && !Failed(); }
619 friend class internal::DefaultGlobalTestPartResultReporter;
620 friend class internal::ExecDeathTest;
621 friend class internal::TestResultAccessor;
622 friend class internal::UnitTestImpl;
623 friend class internal::WindowsDeathTest;
624 friend class internal::FuchsiaDeathTest;
627 const std::vector<TestPartResult>& test_part_results()
const {
628 return test_part_results_;
632 const std::vector<TestProperty>& test_properties()
const {
633 return test_properties_;
637 void set_elapsed_time(
TimeInMillis elapsed) { elapsed_time_ = elapsed; }
645 void RecordProperty(
const std::string& xml_element,
646 const TestProperty& test_property);
651 static bool ValidateTestProperty(
const std::string& xml_element,
652 const TestProperty& test_property);
655 void AddTestPartResult(
const TestPartResult& test_part_result);
658 int death_test_count()
const {
return death_test_count_; }
661 int increment_death_test_count() {
return ++death_test_count_; }
664 void ClearTestPartResults();
671 internal::Mutex test_properites_mutex_;
674 std::vector<TestPartResult> test_part_results_;
676 std::vector<TestProperty> test_properties_;
678 int death_test_count_;
707 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
712 const char*
name()
const {
return name_.c_str(); }
717 if (type_param_.get() !=
nullptr)
return type_param_->c_str();
724 if (value_param_.get() !=
nullptr)
return value_param_->c_str();
729 const char*
file()
const {
return location_.file.c_str(); }
732 int line()
const {
return location_.line; }
759 return matches_filter_ && !is_in_another_shard_;
766 #if GTEST_HAS_DEATH_TEST
767 friend class internal::DefaultDeathTestFactory;
771 friend class internal::UnitTestImpl;
772 friend class internal::StreamingListenerTest;
774 const char* test_suite_name,
const char* name,
const char* type_param,
783 const char* a_type_param,
784 const char* a_value_param,
791 int increment_death_test_count() {
792 return result_.increment_death_test_count();
799 static void ClearTestResult(
TestInfo* test_info) {
800 test_info->result_.Clear();
808 const std::unique_ptr<const ::std::string> type_param_;
811 const std::unique_ptr<const ::std::string> value_param_;
812 internal::CodeLocation location_;
816 bool matches_filter_;
818 bool is_in_another_shard_;
819 internal::TestFactoryBase*
const factory_;
854 const char*
name()
const {
return name_.c_str(); }
859 if (type_param_.get() !=
nullptr)
return type_param_->c_str();
891 bool Passed()
const {
return !Failed(); }
894 bool Failed()
const {
return failed_test_count() > 0; }
909 friend class internal::UnitTestImpl;
912 std::vector<TestInfo*>& test_info_list() {
return test_info_list_; }
915 const std::vector<TestInfo*>& test_info_list()
const {
916 return test_info_list_;
921 TestInfo* GetMutableTestInfo(
int i);
924 void set_should_run(
bool should) { should_run_ = should; }
928 void AddTestInfo(TestInfo * test_info);
934 static void ClearTestSuiteResult(TestSuite* test_suite) {
935 test_suite->ClearResult();
943 void RunSetUpTestSuite() {
944 if (set_up_tc_ !=
nullptr) {
951 void RunTearDownTestSuite() {
952 if (tear_down_tc_ !=
nullptr) {
958 static bool TestPassed(
const TestInfo* test_info) {
959 return test_info->should_run() && test_info->result()->Passed();
963 static bool TestSkipped(
const TestInfo* test_info) {
964 return test_info->should_run() && test_info->result()->Skipped();
968 static bool TestFailed(
const TestInfo* test_info) {
969 return test_info->should_run() && test_info->result()->Failed();
974 static bool TestReportableDisabled(
const TestInfo* test_info) {
975 return test_info->is_reportable() && test_info->is_disabled_;
979 static bool TestDisabled(
const TestInfo* test_info) {
980 return test_info->is_disabled_;
984 static bool TestReportable(
const TestInfo* test_info) {
985 return test_info->is_reportable();
989 static bool ShouldRunTest(
const TestInfo* test_info) {
990 return test_info->should_run();
997 void UnshuffleTests();
1003 const std::unique_ptr<const ::std::string> type_param_;
1006 std::vector<TestInfo*> test_info_list_;
1010 std::vector<int> test_indices_;
1021 TestResult ad_hoc_test_result_;
1054 struct Setup_should_be_spelled_SetUp {};
1055 virtual Setup_should_be_spelled_SetUp* Setup() {
return nullptr; }
1058 #if GTEST_HAS_EXCEPTIONS
1062 :
public internal::GoogleTestFailureException {
1064 explicit AssertionException(
const TestPartResult& result)
1065 : GoogleTestFailureException(result) {}
1095 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1114 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1146 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1154 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1187 return default_result_printer_;
1198 return default_xml_generator_;
1204 friend class internal::DefaultGlobalTestPartResultReporter;
1205 friend class internal::NoExecDeathTest;
1206 friend class internal::TestEventListenersAccessor;
1207 friend class internal::UnitTestImpl;
1229 bool EventForwardingEnabled()
const;
1230 void SuppressEventForwarding();
1233 internal::TestEventRepeater* repeater_;
1270 const
char* original_working_dir() const;
1277 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1287 int random_seed() const;
1293 internal::ParameterizedTestSuiteRegistry& parameterized_test_registry()
1297 int successful_test_suite_count() const;
1300 int failed_test_suite_count() const;
1303 int total_test_suite_count() const;
1307 int test_suite_to_run_count() const;
1310 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1360 #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1388 void AddTestPartResult(TestPartResult::Type result_type,
1407 internal::UnitTestImpl* impl() {
return impl_; }
1408 const internal::UnitTestImpl* impl()
const {
return impl_; }
1415 friend class internal::StreamingListenerTest;
1416 friend class internal::UnitTestRecordPropertyTestHelper;
1418 friend internal::UnitTestImpl* internal::GetUnitTestImpl();
1419 friend void internal::ReportFailureInUnknownLocation(
1420 TestPartResult::Type result_type,
1431 void PushGTestTrace(
const internal::TraceInfo& trace)
1435 void PopGTestTrace()
1440 mutable internal::Mutex mutex_;
1446 internal::UnitTestImpl* impl_;
1493 namespace internal {
1498 template <
typename T1,
typename T2>
1500 const char* rhs_expression,
1501 const T1& lhs,
const T2& rhs) {
1517 template <
typename T1,
typename T2>
1519 const char* rhs_expression,
1523 return AssertionSuccess();
1533 const char* rhs_expression,
1541 typename T1,
typename T2,
1544 typename std::enable_if<!std::is_integral<T1>::value ||
1545 !std::is_pointer<T2>::value>::type* =
nullptr>
1546 static AssertionResult
Compare(
const char* lhs_expression,
1547 const char* rhs_expression,
const T1& lhs,
1549 return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
1558 static AssertionResult
Compare(
const char* lhs_expression,
1559 const char* rhs_expression,
1562 return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
1565 template <
typename T>
1567 const char* lhs_expression,
const char* rhs_expression,
1569 std::nullptr_t , T* rhs) {
1571 return CmpHelperEQ(lhs_expression, rhs_expression,
static_cast<T*
>(
nullptr),
1579 template <
typename T1,
typename T2>
1581 const T1& val1,
const T2& val2,
1583 return AssertionFailure()
1584 <<
"Expected: (" << expr1 <<
") " << op <<
" (" << expr2
1600 #define GTEST_IMPL_CMP_HELPER_(op_name, op)\
1601 template <typename T1, typename T2>\
1602 AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
1603 const T1& val1, const T2& val2) {\
1604 if (val1 op val2) {\
1605 return AssertionSuccess();\
1607 return CmpHelperOpFailure(expr1, expr2, val1, val2, #op);\
1610 GTEST_API_ AssertionResult CmpHelper##op_name(\
1611 const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2)
1626 #undef GTEST_IMPL_CMP_HELPER_
1632 const char* s2_expression,
1640 const char* s2_expression,
1648 const char* s2_expression,
1656 const char* s2_expression,
1665 const char* s2_expression,
1673 const char* s2_expression,
1688 const char* needle_expr,
const char* haystack_expr,
1689 const char* needle,
const char* haystack);
1691 const char* needle_expr,
const char* haystack_expr,
1692 const wchar_t* needle,
const wchar_t* haystack);
1694 const char* needle_expr,
const char* haystack_expr,
1695 const char* needle,
const char* haystack);
1697 const char* needle_expr,
const char* haystack_expr,
1698 const wchar_t* needle,
const wchar_t* haystack);
1700 const char* needle_expr,
const char* haystack_expr,
1703 const char* needle_expr,
const char* haystack_expr,
1706 #if GTEST_HAS_STD_WSTRING
1708 const char* needle_expr,
const char* haystack_expr,
1711 const char* needle_expr,
const char* haystack_expr,
1715 namespace internal {
1724 template <
typename RawType>
1726 const char* rhs_expression,
1728 RawType rhs_value) {
1731 if (lhs.AlmostEquals(rhs)) {
1732 return AssertionSuccess();
1735 ::std::stringstream lhs_ss;
1736 lhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
1739 ::std::stringstream rhs_ss;
1740 rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
1755 const char* abs_error_expr,
1768 const char* message);
1780 struct AssertHelperData {
1781 AssertHelperData(TestPartResult::Type t,
1782 const char* srcfile,
1785 : type(t), file(srcfile), line(line_num), message(msg) { }
1787 TestPartResult::Type
const type;
1788 const char*
const file;
1796 AssertHelperData*
const data_;
1843 template <typename T>
1853 <<
"GetParam() can only be called inside a value-parameterized test "
1854 <<
"-- did you intend to write TEST_P instead of TEST_F?";
1861 static void SetParam(
const ParamType* parameter) {
1862 parameter_ = parameter;
1866 static const ParamType* parameter_;
1872 template <
typename T>
1878 template <
typename T>
1887 #define GTEST_SKIP() GTEST_SKIP_("Skipped")
1907 #define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
1911 #define ADD_FAILURE_AT(file, line) \
1912 GTEST_MESSAGE_AT_(file, line, "Failed", \
1913 ::testing::TestPartResult::kNonFatalFailure)
1916 #define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed")
1920 #if !GTEST_DONT_DEFINE_FAIL
1921 # define FAIL() GTEST_FAIL()
1925 #define GTEST_SUCCEED() GTEST_SUCCESS_("Succeeded")
1929 #if !GTEST_DONT_DEFINE_SUCCEED
1930 # define SUCCEED() GTEST_SUCCEED()
1942 #define EXPECT_THROW(statement, expected_exception) \
1943 GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)
1944 #define EXPECT_NO_THROW(statement) \
1945 GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
1946 #define EXPECT_ANY_THROW(statement) \
1947 GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)
1948 #define ASSERT_THROW(statement, expected_exception) \
1949 GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)
1950 #define ASSERT_NO_THROW(statement) \
1951 GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)
1952 #define ASSERT_ANY_THROW(statement) \
1953 GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)
1958 #define EXPECT_TRUE(condition) \
1959 GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
1960 GTEST_NONFATAL_FAILURE_)
1961 #define EXPECT_FALSE(condition) \
1962 GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
1963 GTEST_NONFATAL_FAILURE_)
1964 #define ASSERT_TRUE(condition) \
1965 GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
1966 GTEST_FATAL_FAILURE_)
1967 #define ASSERT_FALSE(condition) \
1968 GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
1969 GTEST_FATAL_FAILURE_)
2017 #define EXPECT_EQ(val1, val2) \
2018 EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
2019 #define EXPECT_NE(val1, val2) \
2020 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
2021 #define EXPECT_LE(val1, val2) \
2022 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
2023 #define EXPECT_LT(val1, val2) \
2024 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
2025 #define EXPECT_GE(val1, val2) \
2026 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
2027 #define EXPECT_GT(val1, val2) \
2028 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
2030 #define GTEST_ASSERT_EQ(val1, val2) \
2031 ASSERT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
2032 #define GTEST_ASSERT_NE(val1, val2) \
2033 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
2034 #define GTEST_ASSERT_LE(val1, val2) \
2035 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
2036 #define GTEST_ASSERT_LT(val1, val2) \
2037 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
2038 #define GTEST_ASSERT_GE(val1, val2) \
2039 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
2040 #define GTEST_ASSERT_GT(val1, val2) \
2041 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
2046 #if !GTEST_DONT_DEFINE_ASSERT_EQ
2047 # define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
2050 #if !GTEST_DONT_DEFINE_ASSERT_NE
2051 # define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
2054 #if !GTEST_DONT_DEFINE_ASSERT_LE
2055 # define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
2058 #if !GTEST_DONT_DEFINE_ASSERT_LT
2059 # define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
2062 #if !GTEST_DONT_DEFINE_ASSERT_GE
2063 # define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
2066 #if !GTEST_DONT_DEFINE_ASSERT_GT
2067 # define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
2086 #define EXPECT_STREQ(s1, s2) \
2087 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
2088 #define EXPECT_STRNE(s1, s2) \
2089 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
2090 #define EXPECT_STRCASEEQ(s1, s2) \
2091 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
2092 #define EXPECT_STRCASENE(s1, s2)\
2093 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
2095 #define ASSERT_STREQ(s1, s2) \
2096 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
2097 #define ASSERT_STRNE(s1, s2) \
2098 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
2099 #define ASSERT_STRCASEEQ(s1, s2) \
2100 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
2101 #define ASSERT_STRCASENE(s1, s2)\
2102 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
2118 #define EXPECT_FLOAT_EQ(val1, val2)\
2119 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
2122 #define EXPECT_DOUBLE_EQ(val1, val2)\
2123 EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
2126 #define ASSERT_FLOAT_EQ(val1, val2)\
2127 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
2130 #define ASSERT_DOUBLE_EQ(val1, val2)\
2131 ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
2134 #define EXPECT_NEAR(val1, val2, abs_error)\
2135 EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
2136 val1, val2, abs_error)
2138 #define ASSERT_NEAR(val1, val2, abs_error)\
2139 ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
2140 val1, val2, abs_error)
2150 float val1,
float val2);
2152 double val1,
double val2);
2155 #if GTEST_OS_WINDOWS
2166 # define EXPECT_HRESULT_SUCCEEDED(expr) \
2167 EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
2169 # define ASSERT_HRESULT_SUCCEEDED(expr) \
2170 ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
2172 # define EXPECT_HRESULT_FAILED(expr) \
2173 EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
2175 # define ASSERT_HRESULT_FAILED(expr) \
2176 ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
2190 #define ASSERT_NO_FATAL_FAILURE(statement) \
2191 GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
2192 #define EXPECT_NO_FATAL_FAILURE(statement) \
2193 GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
2212 template <
typename T>
2214 PushTrace(file, line, (
Message() << message).GetString());
2219 PushTrace(file, line, message ? message :
"(null)");
2222 #if GTEST_HAS_GLOBAL_STRING
2224 PushTrace(file, line, message);
2229 PushTrace(file, line, message);
2239 void PushTrace(
const char* file,
int line,
std::string message);
2261 #define SCOPED_TRACE(message) \
2262 ::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
2263 __FILE__, __LINE__, (message))
2296 template <
typename T1,
typename T2>
2327 #define GTEST_TEST(test_suite_name, test_name) \
2328 GTEST_TEST_(test_suite_name, test_name, ::testing::Test, \
2329 ::testing::internal::GetTestTypeId())
2333 #if !GTEST_DONT_DEFINE_TEST
2334 #define TEST(test_suite_name, test_name) GTEST_TEST(test_suite_name, test_name)
2364 #define TEST_F(test_fixture, test_name)\
2365 GTEST_TEST_(test_fixture, test_name, test_fixture, \
2366 ::testing::internal::GetTypeId<test_fixture>())
2373 # pragma warning(pop)
2433 template <
int&... ExplicitParameterBarrier,
typename Factory>
2435 const char* type_param,
const char* value_param,
2436 const char* file,
int line, Factory factory) {
2437 using TestT =
typename std::remove_pointer<decltype(factory())>::type;
2441 explicit FactoryImpl(Factory f) : factory_(std::move(f)) {}
2442 Test* CreateTest()
override {
return factory_(); }
2449 test_suite_name, test_name, type_param, value_param,
2453 new FactoryImpl{std::move(factory)});
2469 return ::testing::UnitTest::GetInstance()->Run();
void OnTestStart(const TestInfo &) override
void OnTestSuiteStart(const TestSuite &) override
void OnTestIterationStart(const UnitTest &, int) override
void OnEnvironmentsTearDownStart(const UnitTest &) override
void OnEnvironmentsSetUpStart(const UnitTest &) override
void OnTestEnd(const TestInfo &) override
void OnTestCaseStart(const TestCase &) override
void OnEnvironmentsSetUpEnd(const UnitTest &) override
void OnTestProgramEnd(const UnitTest &) override
void OnTestIterationEnd(const UnitTest &, int) override
void OnTestPartResult(const TestPartResult &) override
void OnTestCaseEnd(const TestCase &) override
void OnTestProgramStart(const UnitTest &) override
void OnEnvironmentsTearDownEnd(const UnitTest &) override
void OnTestSuiteEnd(const TestSuite &) override
ScopedTrace(const char *file, int line, const std::string &message)
ScopedTrace(const char *file, int line, const T &message)
ScopedTrace(const char *file, int line, const char *message)
virtual void OnTestPartResult(const TestPartResult &test_part_result)=0
virtual void OnTestSuiteStart(const TestSuite &)
virtual ~TestEventListener()
virtual void OnEnvironmentsTearDownStart(const UnitTest &unit_test)=0
virtual void OnTestIterationEnd(const UnitTest &unit_test, int iteration)=0
virtual void OnTestProgramStart(const UnitTest &unit_test)=0
virtual void OnTestIterationStart(const UnitTest &unit_test, int iteration)=0
virtual void OnTestCaseEnd(const TestCase &)
virtual void OnTestSuiteEnd(const TestSuite &)
virtual void OnEnvironmentsTearDownEnd(const UnitTest &unit_test)=0
virtual void OnEnvironmentsSetUpStart(const UnitTest &unit_test)=0
virtual void OnEnvironmentsSetUpEnd(const UnitTest &unit_test)=0
virtual void OnTestStart(const TestInfo &test_info)=0
virtual void OnTestEnd(const TestInfo &test_info)=0
virtual void OnTestCaseStart(const TestCase &)
virtual void OnTestProgramEnd(const UnitTest &unit_test)=0
void Append(TestEventListener *listener)
TestEventListener * Release(TestEventListener *listener)
TestEventListener * default_result_printer() const
TestEventListener * default_xml_generator() const
static bool HasNonfatalFailure()
static bool HasFatalFailure()
static void SetUpTestCase()
static void TearDownTestSuite()
static void RecordProperty(const std::string &key, const std::string &value)
static void SetUpTestSuite()
static void TearDownTestCase()
static void RecordProperty(const std::string &key, int value)
const char * test_case_name() const
bool is_reportable() const
const char * type_param() const
const char * test_suite_name() const
bool is_in_another_shard() const
const char * file() const
const char * value_param() const
const char * name() const
const TestResult * result() const
TestProperty(const std::string &a_key, const std::string &a_value)
void SetValue(const std::string &new_value)
const char * value() const
bool HasFatalFailure() const
const TestProperty & GetTestProperty(int i) const
bool HasNonfatalFailure() const
int total_part_count() const
TimeInMillis elapsed_time() const
const TestPartResult & GetTestPartResult(int i) const
int test_property_count() const
int test_to_run_count() const
int reportable_test_count() const
TestSuite(const char *name, const char *a_type_param, internal::SetUpTestSuiteFunc set_up_tc, internal::TearDownTestSuiteFunc tear_down_tc)
TimeInMillis elapsed_time() const
const TestResult & ad_hoc_test_result() const
int total_test_count() const
int successful_test_count() const
const TestInfo * GetTestInfo(int i) const
int failed_test_count() const
int reportable_disabled_test_count() const
const char * type_param() const
const char * name() const
int disabled_test_count() const
int skipped_test_count() const
int skipped_test_count() const
const TestInfo * current_test_info() const GTEST_LOCK_EXCLUDED_(mutex_)
const TestCase * current_test_case() const GTEST_LOCK_EXCLUDED_(mutex_)
TestEventListeners & listeners()
int reportable_disabled_test_count() const
int Run() GTEST_MUST_USE_RESULT_
TimeInMillis elapsed_time() const
int reportable_test_count() const
int test_to_run_count() const
int successful_test_count() const
const TestSuite * GetTestSuite(int i) const
int total_test_case_count() const
int test_case_to_run_count() const
TimeInMillis start_timestamp() const
int failed_test_case_count() const
int successful_test_case_count() const
int failed_test_count() const
int disabled_test_count() const
const TestCase * GetTestCase(int i) const
static UnitTest * GetInstance()
int total_test_count() const
const TestResult & ad_hoc_test_result() const
static const ParamType & GetParam()
virtual ~WithParamInterface()
void operator=(const Message &message) const
AssertHelper(TestPartResult::Type type, const char *file, int line, const char *message)
static AssertionResult Compare(const char *lhs_expression, const char *rhs_expression, const T1 &lhs, const T2 &rhs)
static AssertionResult Compare(const char *lhs_expression, const char *rhs_expression, std::nullptr_t, T *rhs)
static AssertionResult Compare(const char *lhs_expression, const char *rhs_expression, BiggestInt lhs, BiggestInt rhs)
#define GTEST_DECLARE_bool_(name)
#define GTEST_LOCK_EXCLUDED_(locks)
#define GTEST_MUST_USE_RESULT_
#define GTEST_DECLARE_string_(name)
#define GTEST_DECLARE_int32_(name)
#define GTEST_DISABLE_MSC_WARNINGS_POP_()
#define GTEST_CHECK_(condition)
#define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check)
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)
#define GTEST_IMPL_CMP_HELPER_(op_name, op)
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251) namespace testing
constexpr const char * file_name(const char *str)
__device__ Real Random(cuRNGState &state, Real a, Real b)
Return a random number between a and b.
std::ostream & operator<<(std::ostream &output, const CloverFieldParam ¶m)
GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char *s1_expression, const char *s2_expression, const char *s1, const char *s2)
AssertionResult CmpHelperEQFailure(const char *lhs_expression, const char *rhs_expression, const T1 &lhs, const T2 &rhs)
GTEST_API_ AssertionResult CmpHelperEQ(const char *lhs_expression, const char *rhs_expression, BiggestInt lhs, BiggestInt rhs)
GTEST_API_ const char * fmt
bool operator==(faketype, faketype)
GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char *s1_expression, const char *s2_expression, const char *s1, const char *s2)
TypeWithSize< 8 >::Int TimeInMillis
GTEST_API_ AssertionResult CmpHelperSTRNE(const char *s1_expression, const char *s2_expression, const wchar_t *s1, const wchar_t *s2)
GTEST_API_ std::string StringStreamToString(::std::stringstream *stream)
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)
void(*)() TearDownTestSuiteFunc
void(*)() SetUpTestSuiteFunc
AssertionResult CmpHelperOpFailure(const char *expr1, const char *expr2, const T1 &val1, const T2 &val2, const char *op)
std::string FormatForComparisonFailureMessage(const T1 &value, const T2 &)
AssertionResult CmpHelperFloatingPointEQ(const char *lhs_expression, const char *rhs_expression, RawType lhs_value, RawType rhs_value)
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_ AssertionResult CmpHelperSTREQ(const char *s1_expression, const char *s2_expression, const wchar_t *s1, const wchar_t *s2)
GTEST_API_ AssertionResult DoubleNearPredFormat(const char *expr1, const char *expr2, const char *abs_error_expr, double val1, double val2, double abs_error)
bool operator!=(faketype, faketype)
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)
Environment * AddGlobalTestEnvironment(Environment *env)
GTEST_API_ AssertionResult IsSubstring(const char *needle_expr, const char *haystack_expr, const char *needle, const char *haystack)
bool StaticAssertTypeEq()
GTEST_API_ AssertionResult FloatLE(const char *expr1, const char *expr2, float val1, float val2)
GTEST_API_ AssertionResult DoubleLE(const char *expr1, const char *expr2, double val1, double val2)
internal::TimeInMillis TimeInMillis
GTEST_API_ AssertionResult IsNotSubstring(const char *needle_expr, const char *haystack_expr, const char *needle, const char *haystack)
GTEST_API_ std::string TempDir()
class GTEST_API_ testing::ScopedTrace GTEST_ATTRIBUTE_UNUSED_
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
DEVICEHOST void swap(Real &a, Real &b)