diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2010-02-25 01:09:07 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2010-02-25 01:09:07 +0000 |
commit | 93d13a8bbcb70bfd80b0d7ae2bf9aedfc06bf0cc (patch) | |
tree | 2b870d231c4e24592a2ea55ef7d94af707bd5e27 /test/gtest_stress_test.cc | |
parent | 050a520ddf9a34b93a3b41704fa2450d7450783f (diff) | |
download | googletest-93d13a8bbcb70bfd80b0d7ae2bf9aedfc06bf0cc.tar.gz |
Simplifies the implementation by using std::vector instead of Vector.
git-svn-id: http://googletest.googlecode.com/svn/trunk@377 861a406c-534a-0410-8894-cb66d6ee9925
Diffstat (limited to 'test/gtest_stress_test.cc')
-rw-r--r-- | test/gtest_stress_test.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/test/gtest_stress_test.cc b/test/gtest_stress_test.cc index 3cb68de..01f4fc6 100644 --- a/test/gtest_stress_test.cc +++ b/test/gtest_stress_test.cc @@ -35,6 +35,7 @@ #include <gtest/gtest.h> #include <iostream> +#include <vector> // We must define this macro in order to #include // gtest-internal-inl.h. This is how Google Test prevents a user from @@ -51,7 +52,6 @@ namespace { using internal::scoped_ptr; using internal::String; using internal::TestPropertyKeyIs; -using internal::Vector; using internal::ThreadStartSemaphore; using internal::ThreadWithParam; @@ -75,12 +75,13 @@ String IdToString(int id) { return id_message.GetString(); } -void ExpectKeyAndValueWereRecordedForId(const Vector<TestProperty>& properties, - int id, - const char* suffix) { +void ExpectKeyAndValueWereRecordedForId( + const std::vector<TestProperty>& properties, + int id, const char* suffix) { TestPropertyKeyIs matches_key(IdToKey(id, suffix).c_str()); - const TestProperty* property = properties.FindIf(matches_key); - ASSERT_TRUE(property != NULL) + const std::vector<TestProperty>::const_iterator property = + std::find_if(properties.begin(), properties.end(), matches_key); + ASSERT_TRUE(property != properties.end()) << "expecting " << suffix << " value for id " << id; EXPECT_STREQ(IdToString(id).c_str(), property->value()); } @@ -143,11 +144,11 @@ TEST(StressTest, CanUseScopedTraceAndAssertionsInManyThreads) { const TestInfo* const info = UnitTest::GetInstance()->current_test_info(); const TestResult* const result = info->result(); - Vector<TestProperty> properties; + std::vector<TestProperty> properties; // We have no access to the TestResult's list of properties but we can // copy them one by one. for (int i = 0; i < result->test_property_count(); ++i) - properties.PushBack(result->GetTestProperty(i)); + properties.push_back(result->GetTestProperty(i)); EXPECT_EQ(kThreadCount * 2 + 1, result->test_property_count()) << "String and int values recorded on each thread, " |