Simplifies the implementation by using std::vector instead of Vector.
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user