From 3d7042176307f0d7700a3640f3b3bcc8790b8fcd Mon Sep 17 00:00:00 2001 From: vladlosev Date: Thu, 20 Nov 2008 01:40:35 +0000 Subject: Value-parameterized tests and many bugfixes --- src/gtest-internal-inl.h | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src/gtest-internal-inl.h') diff --git a/src/gtest-internal-inl.h b/src/gtest-internal-inl.h index ce1d0f4f..0f2bcfba 100644 --- a/src/gtest-internal-inl.h +++ b/src/gtest-internal-inl.h @@ -53,7 +53,6 @@ #include // NOLINT #endif // GTEST_OS_WINDOWS -#include // NOLINT #include #include @@ -846,7 +845,7 @@ class OsStackTraceGetterInterface { GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetterInterface); }; -// A working implemenation of the OsStackTraceGetterInterface interface. +// A working implementation of the OsStackTraceGetterInterface interface. class OsStackTraceGetter : public OsStackTraceGetterInterface { public: OsStackTraceGetter() {} @@ -1063,6 +1062,14 @@ class UnitTestImpl { tear_down_tc)->AddTestInfo(test_info); } +#ifdef GTEST_HAS_PARAM_TEST + // Returns ParameterizedTestCaseRegistry object used to keep track of + // value-parameterized tests and instantiate and register them. + internal::ParameterizedTestCaseRegistry& parameterized_test_registry() { + return parameterized_test_registry_; + } +#endif // GTEST_HAS_PARAM_TEST + // Sets the TestCase object for the test that's currently running. void set_current_test_case(TestCase* current_test_case) { current_test_case_ = current_test_case; @@ -1075,6 +1082,14 @@ class UnitTestImpl { current_test_info_ = current_test_info; } + // Registers all parameterized tests defined using TEST_P and + // INSTANTIATE_TEST_P, creating regular tests for each test/parameter + // combination. This method can be called more then once; it has + // guards protecting from registering the tests more then once. + // If value-parameterized tests are disabled, RegisterParameterizedTests + // is present but does nothing. + void RegisterParameterizedTests(); + // Runs all tests in this UnitTest object, prints the result, and // returns 0 if all tests are successful, or 1 otherwise. If any // exception is thrown during a test on Windows, this test is @@ -1169,6 +1184,15 @@ class UnitTestImpl { internal::List test_cases_; // The list of TestCases. +#ifdef GTEST_HAS_PARAM_TEST + // ParameterizedTestRegistry object used to register value-parameterized + // tests. + internal::ParameterizedTestCaseRegistry parameterized_test_registry_; + + // Indicates whether RegisterParameterizedTests() has been called already. + bool parameterized_tests_registered_; +#endif // GTEST_HAS_PARAM_TEST + // Points to the last death test case registered. Initially NULL. internal::ListNode* last_death_test_case_; -- cgit v1.2.3