Adds color support for TERM=linux (by Alexander Demin); renames List to Vector (by Zhanyong Wan); implements Vector::Erase (by Vlad Losev).

This commit is contained in:
zhanyong.wan
2009-07-13 19:25:02 +00:00
parent 600105ee3a
commit 89080477ae
10 changed files with 208 additions and 132 deletions

View File

@@ -193,7 +193,7 @@ class Message {
// decide between class template specializations for T and T*, so a
// tr1::type_traits-like is_pointer works, and we can overload on that.
template <typename T>
inline void StreamHelper(internal::true_type dummy, T* pointer) {
inline void StreamHelper(internal::true_type /*dummy*/, T* pointer) {
if (pointer == NULL) {
*ss_ << "(null)";
} else {
@@ -201,7 +201,7 @@ class Message {
}
}
template <typename T>
inline void StreamHelper(internal::false_type dummy, const T& value) {
inline void StreamHelper(internal::false_type /*dummy*/, const T& value) {
::GTestStreamToHelper(ss_, value);
}
#endif // GTEST_OS_SYMBIAN

View File

@@ -136,9 +136,8 @@ class TestPartResultArray {
// Returns the number of TestPartResult objects in the array.
int size() const;
private:
// Internally we use a list to simulate the array. Yes, this means
// that random access is O(N) in time, but it's OK for its purpose.
internal::List<TestPartResult>* const list_;
// Internally we use a Vector to implement the array.
internal::Vector<TestPartResult>* const array_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);
};

View File

@@ -453,13 +453,13 @@ class TestResult {
friend class testing::TestInfo;
friend class testing::UnitTest;
// Gets the list of TestPartResults.
const internal::List<TestPartResult>& test_part_results() const {
// Gets the vector of TestPartResults.
const internal::Vector<TestPartResult>& test_part_results() const {
return *test_part_results_;
}
// Gets the list of TestProperties.
const internal::List<internal::TestProperty>& test_properties() const {
// Gets the vector of TestProperties.
const internal::Vector<internal::TestProperty>& test_properties() const {
return *test_properties_;
}
@@ -493,14 +493,15 @@ class TestResult {
// Clears the object.
void Clear();
// Protects mutable state of the property list and of owned properties, whose
// values may be updated.
// Protects mutable state of the property vector and of owned
// properties, whose values may be updated.
internal::Mutex test_properites_mutex_;
// The list of TestPartResults
scoped_ptr<internal::List<TestPartResult> > test_part_results_;
// The list of TestProperties
scoped_ptr<internal::List<internal::TestProperty> > test_properties_;
// The vector of TestPartResults
internal::scoped_ptr<internal::Vector<TestPartResult> > test_part_results_;
// The vector of TestProperties
internal::scoped_ptr<internal::Vector<internal::TestProperty> >
test_properties_;
// Running count of death tests.
int death_test_count_;
// The elapsed time, in milliseconds.
@@ -604,7 +605,7 @@ class TestInfo {
namespace internal {
// A test case, which consists of a list of TestInfos.
// A test case, which consists of a vector of TestInfos.
//
// TestCase is not copyable.
class TestCase {
@@ -667,11 +668,11 @@ class TestCase {
friend class testing::Test;
friend class UnitTestImpl;
// Gets the (mutable) list of TestInfos in this TestCase.
internal::List<TestInfo*>& test_info_list() { return *test_info_list_; }
// Gets the (mutable) vector of TestInfos in this TestCase.
internal::Vector<TestInfo*>& test_info_list() { return *test_info_list_; }
// Gets the (immutable) list of TestInfos in this TestCase.
const internal::List<TestInfo *> & test_info_list() const {
// Gets the (immutable) vector of TestInfos in this TestCase.
const internal::Vector<TestInfo *> & test_info_list() const {
return *test_info_list_;
}
@@ -712,8 +713,8 @@ class TestCase {
internal::String name_;
// Comment on the test case.
internal::String comment_;
// List of TestInfos.
internal::List<TestInfo*>* test_info_list_;
// Vector of TestInfos.
internal::Vector<TestInfo*>* test_info_list_;
// 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.
@@ -760,7 +761,7 @@ class Environment {
virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
};
// A UnitTest consists of a list of TestCases.
// A UnitTest consists of a vector of TestCases.
//
// This is a singleton class. The only instance of UnitTest is
// created when UnitTest::GetInstance() is first called. This

View File

@@ -116,7 +116,7 @@ class ScopedTrace; // Implements scoped trace.
class TestInfoImpl; // Opaque implementation of TestInfo
class TestResult; // Result of a single Test.
class UnitTestImpl; // Opaque implementation of UnitTest
template <typename E> class List; // A generic list.
template <typename E> class Vector; // A generic vector.
// How many times InitGoogleTest() has been called.
extern int g_init_gtest_count;
@@ -208,13 +208,13 @@ String StreamableToString(const T& streamable);
// This overload makes sure that all pointers (including
// those to char or wchar_t) are printed as raw pointers.
template <typename T>
inline String FormatValueForFailureMessage(internal::true_type dummy,
inline String FormatValueForFailureMessage(internal::true_type /*dummy*/,
T* pointer) {
return StreamableToString(static_cast<const void*>(pointer));
}
template <typename T>
inline String FormatValueForFailureMessage(internal::false_type dummy,
inline String FormatValueForFailureMessage(internal::false_type /*dummy*/,
const T& value) {
return StreamableToString(value);
}