diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2010-02-25 01:09:07 (GMT) |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2010-02-25 01:09:07 (GMT) |
commit | 0d27868d0faef474594682f25336229daa89d6d7 (patch) | |
tree | 2b870d231c4e24592a2ea55ef7d94af707bd5e27 /include | |
parent | 3bef459eac9aa84c579f34249aebc9ff56832054 (diff) | |
download | googletest-0d27868d0faef474594682f25336229daa89d6d7.zip googletest-0d27868d0faef474594682f25336229daa89d6d7.tar.gz googletest-0d27868d0faef474594682f25336229daa89d6d7.tar.bz2 |
Simplifies the implementation by using std::vector instead of Vector.
Diffstat (limited to 'include')
-rw-r--r-- | include/gtest/gtest-test-part.h | 11 | ||||
-rw-r--r-- | include/gtest/gtest.h | 24 | ||||
-rw-r--r-- | include/gtest/internal/gtest-internal.h | 1 |
3 files changed, 17 insertions, 19 deletions
diff --git a/include/gtest/gtest-test-part.h b/include/gtest/gtest-test-part.h index 348e4ec..dd27160 100644 --- a/include/gtest/gtest-test-part.h +++ b/include/gtest/gtest-test-part.h @@ -34,6 +34,7 @@ #define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ #include <iosfwd> +#include <vector> #include <gtest/internal/gtest-internal.h> #include <gtest/internal/gtest-string.h> @@ -117,15 +118,11 @@ std::ostream& operator<<(std::ostream& os, const TestPartResult& result); // An array of TestPartResult objects. // -// We define this class as we cannot use STL containers when compiling -// Google Test with MSVC 7.1 and exceptions disabled. -// // Don't inherit from TestPartResultArray as its destructor is not // virtual. class TestPartResultArray { public: - TestPartResultArray(); - ~TestPartResultArray(); + TestPartResultArray() {} // Appends the given TestPartResult to the array. void Append(const TestPartResult& result); @@ -135,9 +132,9 @@ class TestPartResultArray { // Returns the number of TestPartResult objects in the array. int size() const; + private: - // Internally we use a Vector to implement the array. - internal::Vector<TestPartResult>* const array_; + std::vector<TestPartResult> array_; GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray); }; diff --git a/include/gtest/gtest.h b/include/gtest/gtest.h index 02d4c5e..c6f82e7 100644 --- a/include/gtest/gtest.h +++ b/include/gtest/gtest.h @@ -52,6 +52,8 @@ #define GTEST_INCLUDE_GTEST_GTEST_H_ #include <limits> +#include <vector> + #include <gtest/internal/gtest-internal.h> #include <gtest/internal/gtest-string.h> #include <gtest/gtest-death-test.h> @@ -535,13 +537,13 @@ class TestResult { friend class internal::WindowsDeathTest; // Gets the vector of TestPartResults. - const internal::Vector<TestPartResult>& test_part_results() const { - return *test_part_results_; + const std::vector<TestPartResult>& test_part_results() const { + return test_part_results_; } // Gets the vector of TestProperties. - const internal::Vector<TestProperty>& test_properties() const { - return *test_properties_; + const std::vector<TestProperty>& test_properties() const { + return test_properties_; } // Sets the elapsed time. @@ -579,9 +581,9 @@ class TestResult { internal::Mutex test_properites_mutex_; // The vector of TestPartResults - internal::scoped_ptr<internal::Vector<TestPartResult> > test_part_results_; + std::vector<TestPartResult> test_part_results_; // The vector of TestProperties - internal::scoped_ptr<internal::Vector<TestProperty> > test_properties_; + std::vector<TestProperty> test_properties_; // Running count of death tests. int death_test_count_; // The elapsed time, in milliseconds. @@ -745,11 +747,11 @@ class TestCase { friend class internal::UnitTestImpl; // Gets the (mutable) vector of TestInfos in this TestCase. - internal::Vector<TestInfo*>& test_info_list() { return *test_info_list_; } + std::vector<TestInfo*>& test_info_list() { return test_info_list_; } // Gets the (immutable) vector of TestInfos in this TestCase. - const internal::Vector<TestInfo *> & test_info_list() const { - return *test_info_list_; + const std::vector<TestInfo*>& test_info_list() const { + return test_info_list_; } // Returns the i-th test among all the tests. i can range from 0 to @@ -798,11 +800,11 @@ class TestCase { internal::String comment_; // The vector of TestInfos in their original order. It owns the // elements in the vector. - const internal::scoped_ptr<internal::Vector<TestInfo*> > test_info_list_; + std::vector<TestInfo*> test_info_list_; // Provides a level of indirection for the test list to allow easy // shuffling and restoring the test order. The i-th element in this // vector is the index of the i-th test in the shuffled test list. - const internal::scoped_ptr<internal::Vector<int> > test_indices_; + std::vector<int> test_indices_; // Pointer to the function that sets up the test case. Test::SetUpTestCaseFunc set_up_tc_; // Pointer to the function that tears down the test case. diff --git a/include/gtest/internal/gtest-internal.h b/include/gtest/internal/gtest-internal.h index 50f9fdf..a7858f9 100644 --- a/include/gtest/internal/gtest-internal.h +++ b/include/gtest/internal/gtest-internal.h @@ -114,7 +114,6 @@ struct TraceInfo; // Information about a trace point. class ScopedTrace; // Implements scoped trace. class TestInfoImpl; // Opaque implementation of TestInfo class UnitTestImpl; // Opaque implementation of UnitTest -template <typename E> class Vector; // A generic vector. // How many times InitGoogleTest() has been called. extern int g_init_gtest_count; |