Bug Summary

File:unittests/ADT/SmallVectorTest.cpp
Location:line 743, column 3
Description:Value stored to 'x' is never read

Annotated Source Code

1//===- llvm/unittest/ADT/SmallVectorTest.cpp ------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// SmallVector unit tests.
11//
12//===----------------------------------------------------------------------===//
13
14#include "llvm/ADT/ArrayRef.h"
15#include "llvm/ADT/SmallVector.h"
16#include "llvm/Support/Compiler.h"
17#include "gtest/gtest.h"
18#include <list>
19#include <stdarg.h>
20
21using namespace llvm;
22
23namespace {
24
25/// A helper class that counts the total number of constructor and
26/// destructor calls.
27class Constructable {
28private:
29 static int numConstructorCalls;
30 static int numMoveConstructorCalls;
31 static int numCopyConstructorCalls;
32 static int numDestructorCalls;
33 static int numAssignmentCalls;
34 static int numMoveAssignmentCalls;
35 static int numCopyAssignmentCalls;
36
37 bool constructed;
38 int value;
39
40public:
41 Constructable() : constructed(true), value(0) {
42 ++numConstructorCalls;
43 }
44
45 Constructable(int val) : constructed(true), value(val) {
46 ++numConstructorCalls;
47 }
48
49 Constructable(const Constructable & src) : constructed(true) {
50 value = src.value;
51 ++numConstructorCalls;
52 ++numCopyConstructorCalls;
53 }
54
55 Constructable(Constructable && src) : constructed(true) {
56 value = src.value;
57 ++numConstructorCalls;
58 ++numMoveConstructorCalls;
59 }
60
61 ~Constructable() {
62 EXPECT_TRUE(constructed)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(constructed)) ; else ::
testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 62, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "constructed", "false", "true").c_str()) = ::testing::Message
()
;
63 ++numDestructorCalls;
64 constructed = false;
65 }
66
67 Constructable & operator=(const Constructable & src) {
68 EXPECT_TRUE(constructed)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(constructed)) ; else ::
testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 68, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "constructed", "false", "true").c_str()) = ::testing::Message
()
;
69 value = src.value;
70 ++numAssignmentCalls;
71 ++numCopyAssignmentCalls;
72 return *this;
73 }
74
75 Constructable & operator=(Constructable && src) {
76 EXPECT_TRUE(constructed)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(constructed)) ; else ::
testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 76, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "constructed", "false", "true").c_str()) = ::testing::Message
()
;
77 value = src.value;
78 ++numAssignmentCalls;
79 ++numMoveAssignmentCalls;
80 return *this;
81 }
82
83 int getValue() const {
84 return abs(value);
85 }
86
87 static void reset() {
88 numConstructorCalls = 0;
89 numMoveConstructorCalls = 0;
90 numCopyConstructorCalls = 0;
91 numDestructorCalls = 0;
92 numAssignmentCalls = 0;
93 numMoveAssignmentCalls = 0;
94 numCopyAssignmentCalls = 0;
95 }
96
97 static int getNumConstructorCalls() {
98 return numConstructorCalls;
99 }
100
101 static int getNumMoveConstructorCalls() {
102 return numMoveConstructorCalls;
103 }
104
105 static int getNumCopyConstructorCalls() {
106 return numCopyConstructorCalls;
107 }
108
109 static int getNumDestructorCalls() {
110 return numDestructorCalls;
111 }
112
113 static int getNumAssignmentCalls() {
114 return numAssignmentCalls;
115 }
116
117 static int getNumMoveAssignmentCalls() {
118 return numMoveAssignmentCalls;
119 }
120
121 static int getNumCopyAssignmentCalls() {
122 return numCopyAssignmentCalls;
123 }
124
125 friend bool operator==(const Constructable & c0, const Constructable & c1) {
126 return c0.getValue() == c1.getValue();
127 }
128
129 friend bool LLVM_ATTRIBUTE_UNUSED__attribute__((__unused__))
130 operator!=(const Constructable & c0, const Constructable & c1) {
131 return c0.getValue() != c1.getValue();
132 }
133};
134
135int Constructable::numConstructorCalls;
136int Constructable::numCopyConstructorCalls;
137int Constructable::numMoveConstructorCalls;
138int Constructable::numDestructorCalls;
139int Constructable::numAssignmentCalls;
140int Constructable::numCopyAssignmentCalls;
141int Constructable::numMoveAssignmentCalls;
142
143struct NonCopyable {
144 NonCopyable() {}
145 NonCopyable(NonCopyable &&) {}
146 NonCopyable &operator=(NonCopyable &&) { return *this; }
147private:
148 NonCopyable(const NonCopyable &) = delete;
149 NonCopyable &operator=(const NonCopyable &) = delete;
150};
151
152LLVM_ATTRIBUTE_USED__attribute__((__used__)) void CompileTest() {
153 SmallVector<NonCopyable, 0> V;
154 V.resize(42);
155}
156
157class SmallVectorTestBase : public testing::Test {
158protected:
159 void SetUp() override { Constructable::reset(); }
160
161 template <typename VectorT>
162 void assertEmpty(VectorT & v) {
163 // Size tests
164 EXPECT_EQ(0u, v.size())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(0u)) == 1)>::Compare("0u",
"v.size()", 0u, v.size()))) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 164, gtest_ar.failure_message()) = ::testing::Message()
;
165 EXPECT_TRUE(v.empty())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(v.empty())) ; else ::
testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 165, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "v.empty()", "false", "true").c_str()) = ::testing::Message
()
;
166
167 // Iterator tests
168 EXPECT_TRUE(v.begin() == v.end())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(v.begin() == v.end())
) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 168, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "v.begin() == v.end()", "false", "true").c_str()) = ::testing
::Message()
;
169 }
170
171 // Assert that v contains the specified values, in order.
172 template <typename VectorT>
173 void assertValuesInOrder(VectorT & v, size_t size, ...) {
174 EXPECT_EQ(size, v.size())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(size)) == 1)>::Compare("size"
, "v.size()", size, v.size()))) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 174, gtest_ar.failure_message()) = ::testing::Message()
;
175
176 va_list ap;
177 va_start(ap, size)__builtin_va_start(ap, size);
178 for (size_t i = 0; i < size; ++i) {
179 int value = va_arg(ap, int)__builtin_va_arg(ap, int);
180 EXPECT_EQ(value, v[i].getValue())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(value)) == 1)>::Compare("value"
, "v[i].getValue()", value, v[i].getValue()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 180, gtest_ar.failure_message()) = ::testing::Message()
;
181 }
182
183 va_end(ap)__builtin_va_end(ap);
184 }
185
186 // Generate a sequence of values to initialize the vector.
187 template <typename VectorT>
188 void makeSequence(VectorT & v, int start, int end) {
189 for (int i = start; i <= end; ++i) {
190 v.push_back(Constructable(i));
191 }
192 }
193};
194
195// Test fixture class
196template <typename VectorT>
197class SmallVectorTest : public SmallVectorTestBase {
198protected:
199 VectorT theVector;
200 VectorT otherVector;
201};
202
203
204typedef ::testing::Types<SmallVector<Constructable, 0>,
205 SmallVector<Constructable, 1>,
206 SmallVector<Constructable, 2>,
207 SmallVector<Constructable, 4>,
208 SmallVector<Constructable, 5>
209 > SmallVectorTestTypes;
210TYPED_TEST_CASE(SmallVectorTest, SmallVectorTestTypes)typedef ::testing::internal::TypeList< SmallVectorTestTypes
>::type gtest_type_params_SmallVectorTest_
;
211
212// New vector test.
213TYPED_TEST(SmallVectorTest, EmptyVectorTest)template <typename gtest_TypeParam_> class SmallVectorTest_EmptyVectorTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_EmptyVectorTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_EmptyVectorTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "EmptyVectorTest", 0); template <typename gtest_TypeParam_
> void SmallVectorTest_EmptyVectorTest_Test<gtest_TypeParam_
>::TestBody()
{
214 SCOPED_TRACE("EmptyVectorTest")::testing::internal::ScopedTrace gtest_trace_214( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 214, ::testing::Message() << ("EmptyVectorTest"))
;
215 this->assertEmpty(this->theVector);
216 EXPECT_TRUE(this->theVector.rbegin() == this->theVector.rend())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(this->theVector.rbegin
() == this->theVector.rend())) ; else ::testing::internal::
AssertHelper(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 216, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "this->theVector.rbegin() == this->theVector.rend()",
"false", "true").c_str()) = ::testing::Message()
;
217 EXPECT_EQ(0, Constructable::getNumConstructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(0)) == 1)>::Compare("0", "Constructable::getNumConstructorCalls()"
, 0, Constructable::getNumConstructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 217, gtest_ar.failure_message()) = ::testing::Message()
;
218 EXPECT_EQ(0, Constructable::getNumDestructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(0)) == 1)>::Compare("0", "Constructable::getNumDestructorCalls()"
, 0, Constructable::getNumDestructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 218, gtest_ar.failure_message()) = ::testing::Message()
;
219}
220
221// Simple insertions and deletions.
222TYPED_TEST(SmallVectorTest, PushPopTest)template <typename gtest_TypeParam_> class SmallVectorTest_PushPopTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_PushPopTest_registered_ __attribute__ (
(unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_PushPopTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "PushPopTest", 0); template <typename gtest_TypeParam_>
void SmallVectorTest_PushPopTest_Test<gtest_TypeParam_>
::TestBody()
{
223 SCOPED_TRACE("PushPopTest")::testing::internal::ScopedTrace gtest_trace_223( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 223, ::testing::Message() << ("PushPopTest"))
;
224
225 // Track whether the vector will potentially have to grow.
226 bool RequiresGrowth = this->theVector.capacity() < 3;
227
228 // Push an element
229 this->theVector.push_back(Constructable(1));
230
231 // Size tests
232 this->assertValuesInOrder(this->theVector, 1u, 1);
233 EXPECT_FALSE(this->theVector.begin() == this->theVector.end())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(!(this->theVector.
begin() == this->theVector.end()))) ; else ::testing::internal
::AssertHelper(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 233, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "this->theVector.begin() == this->theVector.end()", "true"
, "false").c_str()) = ::testing::Message()
;
234 EXPECT_FALSE(this->theVector.empty())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(!(this->theVector.
empty()))) ; else ::testing::internal::AssertHelper(::testing
::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 234, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "this->theVector.empty()", "true", "false").c_str()) = ::
testing::Message()
;
235
236 // Push another element
237 this->theVector.push_back(Constructable(2));
238 this->assertValuesInOrder(this->theVector, 2u, 1, 2);
239
240 // Insert at beginning
241 this->theVector.insert(this->theVector.begin(), this->theVector[1]);
242 this->assertValuesInOrder(this->theVector, 3u, 2, 1, 2);
243
244 // Pop one element
245 this->theVector.pop_back();
246 this->assertValuesInOrder(this->theVector, 2u, 2, 1);
247
248 // Pop remaining elements
249 this->theVector.pop_back();
250 this->theVector.pop_back();
251 this->assertEmpty(this->theVector);
252
253 // Check number of constructor calls. Should be 2 for each list element,
254 // one for the argument to push_back, one for the argument to insert,
255 // and one for the list element itself.
256 if (!RequiresGrowth) {
257 EXPECT_EQ(5, Constructable::getNumConstructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(5)) == 1)>::Compare("5", "Constructable::getNumConstructorCalls()"
, 5, Constructable::getNumConstructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 257, gtest_ar.failure_message()) = ::testing::Message()
;
258 EXPECT_EQ(5, Constructable::getNumDestructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(5)) == 1)>::Compare("5", "Constructable::getNumDestructorCalls()"
, 5, Constructable::getNumDestructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 258, gtest_ar.failure_message()) = ::testing::Message()
;
259 } else {
260 // If we had to grow the vector, these only have a lower bound, but should
261 // always be equal.
262 EXPECT_LE(5, Constructable::getNumConstructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal::CmpHelperLE("5", "Constructable::getNumConstructorCalls()"
, 5, Constructable::getNumConstructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 262, gtest_ar.failure_message()) = ::testing::Message()
;
263 EXPECT_EQ(Constructable::getNumConstructorCalls(),switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(Constructable::getNumConstructorCalls
())) == 1)>::Compare("Constructable::getNumConstructorCalls()"
, "Constructable::getNumDestructorCalls()", Constructable::getNumConstructorCalls
(), Constructable::getNumDestructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 264, gtest_ar.failure_message()) = ::testing::Message()
264 Constructable::getNumDestructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(Constructable::getNumConstructorCalls
())) == 1)>::Compare("Constructable::getNumConstructorCalls()"
, "Constructable::getNumDestructorCalls()", Constructable::getNumConstructorCalls
(), Constructable::getNumDestructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 264, gtest_ar.failure_message()) = ::testing::Message()
;
265 }
266}
267
268// Clear test.
269TYPED_TEST(SmallVectorTest, ClearTest)template <typename gtest_TypeParam_> class SmallVectorTest_ClearTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_ClearTest_registered_ __attribute__ ((
unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_ClearTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "ClearTest", 0); template <typename gtest_TypeParam_>
void SmallVectorTest_ClearTest_Test<gtest_TypeParam_>::
TestBody()
{
270 SCOPED_TRACE("ClearTest")::testing::internal::ScopedTrace gtest_trace_270( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 270, ::testing::Message() << ("ClearTest"))
;
271
272 this->theVector.reserve(2);
273 this->makeSequence(this->theVector, 1, 2);
274 this->theVector.clear();
275
276 this->assertEmpty(this->theVector);
277 EXPECT_EQ(4, Constructable::getNumConstructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(4)) == 1)>::Compare("4", "Constructable::getNumConstructorCalls()"
, 4, Constructable::getNumConstructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 277, gtest_ar.failure_message()) = ::testing::Message()
;
278 EXPECT_EQ(4, Constructable::getNumDestructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(4)) == 1)>::Compare("4", "Constructable::getNumDestructorCalls()"
, 4, Constructable::getNumDestructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 278, gtest_ar.failure_message()) = ::testing::Message()
;
279}
280
281// Resize smaller test.
282TYPED_TEST(SmallVectorTest, ResizeShrinkTest)template <typename gtest_TypeParam_> class SmallVectorTest_ResizeShrinkTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_ResizeShrinkTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_ResizeShrinkTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "ResizeShrinkTest", 0); template <typename gtest_TypeParam_
> void SmallVectorTest_ResizeShrinkTest_Test<gtest_TypeParam_
>::TestBody()
{
283 SCOPED_TRACE("ResizeShrinkTest")::testing::internal::ScopedTrace gtest_trace_283( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 283, ::testing::Message() << ("ResizeShrinkTest"))
;
284
285 this->theVector.reserve(3);
286 this->makeSequence(this->theVector, 1, 3);
287 this->theVector.resize(1);
288
289 this->assertValuesInOrder(this->theVector, 1u, 1);
290 EXPECT_EQ(6, Constructable::getNumConstructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(6)) == 1)>::Compare("6", "Constructable::getNumConstructorCalls()"
, 6, Constructable::getNumConstructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 290, gtest_ar.failure_message()) = ::testing::Message()
;
291 EXPECT_EQ(5, Constructable::getNumDestructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(5)) == 1)>::Compare("5", "Constructable::getNumDestructorCalls()"
, 5, Constructable::getNumDestructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 291, gtest_ar.failure_message()) = ::testing::Message()
;
292}
293
294// Resize bigger test.
295TYPED_TEST(SmallVectorTest, ResizeGrowTest)template <typename gtest_TypeParam_> class SmallVectorTest_ResizeGrowTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_ResizeGrowTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_ResizeGrowTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "ResizeGrowTest", 0); template <typename gtest_TypeParam_
> void SmallVectorTest_ResizeGrowTest_Test<gtest_TypeParam_
>::TestBody()
{
296 SCOPED_TRACE("ResizeGrowTest")::testing::internal::ScopedTrace gtest_trace_296( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 296, ::testing::Message() << ("ResizeGrowTest"))
;
297
298 this->theVector.resize(2);
299
300 EXPECT_EQ(2, Constructable::getNumConstructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(2)) == 1)>::Compare("2", "Constructable::getNumConstructorCalls()"
, 2, Constructable::getNumConstructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 300, gtest_ar.failure_message()) = ::testing::Message()
;
301 EXPECT_EQ(0, Constructable::getNumDestructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(0)) == 1)>::Compare("0", "Constructable::getNumDestructorCalls()"
, 0, Constructable::getNumDestructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 301, gtest_ar.failure_message()) = ::testing::Message()
;
302 EXPECT_EQ(2u, this->theVector.size())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(2u)) == 1)>::Compare("2u",
"this->theVector.size()", 2u, this->theVector.size()))
) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 302, gtest_ar.failure_message()) = ::testing::Message()
;
303}
304
305TYPED_TEST(SmallVectorTest, ResizeWithElementsTest)template <typename gtest_TypeParam_> class SmallVectorTest_ResizeWithElementsTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_ResizeWithElementsTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_ResizeWithElementsTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "ResizeWithElementsTest", 0); template <typename gtest_TypeParam_
> void SmallVectorTest_ResizeWithElementsTest_Test<gtest_TypeParam_
>::TestBody()
{
306 this->theVector.resize(2);
307
308 Constructable::reset();
309
310 this->theVector.resize(4);
311
312 size_t Ctors = Constructable::getNumConstructorCalls();
313 EXPECT_TRUE(Ctors == 2 || Ctors == 4)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(Ctors == 2 || Ctors ==
4)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 313, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "Ctors == 2 || Ctors == 4", "false", "true").c_str()) = ::testing
::Message()
;
314 size_t MoveCtors = Constructable::getNumMoveConstructorCalls();
315 EXPECT_TRUE(MoveCtors == 0 || MoveCtors == 2)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(MoveCtors == 0 || MoveCtors
== 2)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 315, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "MoveCtors == 0 || MoveCtors == 2", "false", "true").c_str(
)) = ::testing::Message()
;
316 size_t Dtors = Constructable::getNumDestructorCalls();
317 EXPECT_TRUE(Dtors == 0 || Dtors == 2)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(Dtors == 0 || Dtors ==
2)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 317, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "Dtors == 0 || Dtors == 2", "false", "true").c_str()) = ::testing
::Message()
;
318}
319
320// Resize with fill value.
321TYPED_TEST(SmallVectorTest, ResizeFillTest)template <typename gtest_TypeParam_> class SmallVectorTest_ResizeFillTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_ResizeFillTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_ResizeFillTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "ResizeFillTest", 0); template <typename gtest_TypeParam_
> void SmallVectorTest_ResizeFillTest_Test<gtest_TypeParam_
>::TestBody()
{
322 SCOPED_TRACE("ResizeFillTest")::testing::internal::ScopedTrace gtest_trace_322( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 322, ::testing::Message() << ("ResizeFillTest"))
;
323
324 this->theVector.resize(3, Constructable(77));
325 this->assertValuesInOrder(this->theVector, 3u, 77, 77, 77);
326}
327
328// Overflow past fixed size.
329TYPED_TEST(SmallVectorTest, OverflowTest)template <typename gtest_TypeParam_> class SmallVectorTest_OverflowTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_OverflowTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_OverflowTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "OverflowTest", 0); template <typename gtest_TypeParam_>
void SmallVectorTest_OverflowTest_Test<gtest_TypeParam_>
::TestBody()
{
330 SCOPED_TRACE("OverflowTest")::testing::internal::ScopedTrace gtest_trace_330( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 330, ::testing::Message() << ("OverflowTest"))
;
331
332 // Push more elements than the fixed size.
333 this->makeSequence(this->theVector, 1, 10);
334
335 // Test size and values.
336 EXPECT_EQ(10u, this->theVector.size())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(10u)) == 1)>::Compare("10u"
, "this->theVector.size()", 10u, this->theVector.size()
))) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 336, gtest_ar.failure_message()) = ::testing::Message()
;
337 for (int i = 0; i < 10; ++i) {
338 EXPECT_EQ(i+1, this->theVector[i].getValue())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(i+1)) == 1)>::Compare("i+1"
, "this->theVector[i].getValue()", i+1, this->theVector
[i].getValue()))) ; else ::testing::internal::AssertHelper(::
testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 338, gtest_ar.failure_message()) = ::testing::Message()
;
339 }
340
341 // Now resize back to fixed size.
342 this->theVector.resize(1);
343
344 this->assertValuesInOrder(this->theVector, 1u, 1);
345}
346
347// Iteration tests.
348TYPED_TEST(SmallVectorTest, IterationTest)template <typename gtest_TypeParam_> class SmallVectorTest_IterationTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_IterationTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_IterationTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "IterationTest", 0); template <typename gtest_TypeParam_
> void SmallVectorTest_IterationTest_Test<gtest_TypeParam_
>::TestBody()
{
349 this->makeSequence(this->theVector, 1, 2);
350
351 // Forward Iteration
352 typename TypeParam::iterator it = this->theVector.begin();
353 EXPECT_TRUE(*it == this->theVector.front())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(*it == this->theVector
.front())) ; else ::testing::internal::AssertHelper(::testing
::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 353, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "*it == this->theVector.front()", "false", "true").c_str
()) = ::testing::Message()
;
354 EXPECT_TRUE(*it == this->theVector[0])switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(*it == this->theVector
[0])) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 354, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "*it == this->theVector[0]", "false", "true").c_str()) =
::testing::Message()
;
355 EXPECT_EQ(1, it->getValue())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(1)) == 1)>::Compare("1", "it->getValue()"
, 1, it->getValue()))) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 355, gtest_ar.failure_message()) = ::testing::Message()
;
356 ++it;
357 EXPECT_TRUE(*it == this->theVector[1])switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(*it == this->theVector
[1])) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 357, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "*it == this->theVector[1]", "false", "true").c_str()) =
::testing::Message()
;
358 EXPECT_TRUE(*it == this->theVector.back())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(*it == this->theVector
.back())) ; else ::testing::internal::AssertHelper(::testing::
TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 358, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "*it == this->theVector.back()", "false", "true").c_str(
)) = ::testing::Message()
;
359 EXPECT_EQ(2, it->getValue())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(2)) == 1)>::Compare("2", "it->getValue()"
, 2, it->getValue()))) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 359, gtest_ar.failure_message()) = ::testing::Message()
;
360 ++it;
361 EXPECT_TRUE(it == this->theVector.end())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(it == this->theVector
.end())) ; else ::testing::internal::AssertHelper(::testing::
TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 361, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "it == this->theVector.end()", "false", "true").c_str())
= ::testing::Message()
;
362 --it;
363 EXPECT_TRUE(*it == this->theVector[1])switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(*it == this->theVector
[1])) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 363, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "*it == this->theVector[1]", "false", "true").c_str()) =
::testing::Message()
;
364 EXPECT_EQ(2, it->getValue())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(2)) == 1)>::Compare("2", "it->getValue()"
, 2, it->getValue()))) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 364, gtest_ar.failure_message()) = ::testing::Message()
;
365 --it;
366 EXPECT_TRUE(*it == this->theVector[0])switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(*it == this->theVector
[0])) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 366, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "*it == this->theVector[0]", "false", "true").c_str()) =
::testing::Message()
;
367 EXPECT_EQ(1, it->getValue())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(1)) == 1)>::Compare("1", "it->getValue()"
, 1, it->getValue()))) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 367, gtest_ar.failure_message()) = ::testing::Message()
;
368
369 // Reverse Iteration
370 typename TypeParam::reverse_iterator rit = this->theVector.rbegin();
371 EXPECT_TRUE(*rit == this->theVector[1])switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(*rit == this->theVector
[1])) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 371, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "*rit == this->theVector[1]", "false", "true").c_str()) =
::testing::Message()
;
372 EXPECT_EQ(2, rit->getValue())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(2)) == 1)>::Compare("2", "rit->getValue()"
, 2, rit->getValue()))) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 372, gtest_ar.failure_message()) = ::testing::Message()
;
373 ++rit;
374 EXPECT_TRUE(*rit == this->theVector[0])switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(*rit == this->theVector
[0])) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 374, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "*rit == this->theVector[0]", "false", "true").c_str()) =
::testing::Message()
;
375 EXPECT_EQ(1, rit->getValue())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(1)) == 1)>::Compare("1", "rit->getValue()"
, 1, rit->getValue()))) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 375, gtest_ar.failure_message()) = ::testing::Message()
;
376 ++rit;
377 EXPECT_TRUE(rit == this->theVector.rend())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(rit == this->theVector
.rend())) ; else ::testing::internal::AssertHelper(::testing::
TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 377, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "rit == this->theVector.rend()", "false", "true").c_str(
)) = ::testing::Message()
;
378 --rit;
379 EXPECT_TRUE(*rit == this->theVector[0])switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(*rit == this->theVector
[0])) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 379, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "*rit == this->theVector[0]", "false", "true").c_str()) =
::testing::Message()
;
380 EXPECT_EQ(1, rit->getValue())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(1)) == 1)>::Compare("1", "rit->getValue()"
, 1, rit->getValue()))) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 380, gtest_ar.failure_message()) = ::testing::Message()
;
381 --rit;
382 EXPECT_TRUE(*rit == this->theVector[1])switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(*rit == this->theVector
[1])) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 382, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "*rit == this->theVector[1]", "false", "true").c_str()) =
::testing::Message()
;
383 EXPECT_EQ(2, rit->getValue())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(2)) == 1)>::Compare("2", "rit->getValue()"
, 2, rit->getValue()))) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 383, gtest_ar.failure_message()) = ::testing::Message()
;
384}
385
386// Swap test.
387TYPED_TEST(SmallVectorTest, SwapTest)template <typename gtest_TypeParam_> class SmallVectorTest_SwapTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_SwapTest_registered_ __attribute__ ((unused
)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_SwapTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "SwapTest", 0); template <typename gtest_TypeParam_> void
SmallVectorTest_SwapTest_Test<gtest_TypeParam_>::TestBody
()
{
388 SCOPED_TRACE("SwapTest")::testing::internal::ScopedTrace gtest_trace_388( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 388, ::testing::Message() << ("SwapTest"))
;
389
390 this->makeSequence(this->theVector, 1, 2);
391 std::swap(this->theVector, this->otherVector);
392
393 this->assertEmpty(this->theVector);
394 this->assertValuesInOrder(this->otherVector, 2u, 1, 2);
395}
396
397// Append test
398TYPED_TEST(SmallVectorTest, AppendTest)template <typename gtest_TypeParam_> class SmallVectorTest_AppendTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_AppendTest_registered_ __attribute__ (
(unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_AppendTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "AppendTest", 0); template <typename gtest_TypeParam_>
void SmallVectorTest_AppendTest_Test<gtest_TypeParam_>
::TestBody()
{
399 SCOPED_TRACE("AppendTest")::testing::internal::ScopedTrace gtest_trace_399( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 399, ::testing::Message() << ("AppendTest"))
;
400
401 this->makeSequence(this->otherVector, 2, 3);
402
403 this->theVector.push_back(Constructable(1));
404 this->theVector.append(this->otherVector.begin(), this->otherVector.end());
405
406 this->assertValuesInOrder(this->theVector, 3u, 1, 2, 3);
407}
408
409// Append repeated test
410TYPED_TEST(SmallVectorTest, AppendRepeatedTest)template <typename gtest_TypeParam_> class SmallVectorTest_AppendRepeatedTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_AppendRepeatedTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_AppendRepeatedTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "AppendRepeatedTest", 0); template <typename gtest_TypeParam_
> void SmallVectorTest_AppendRepeatedTest_Test<gtest_TypeParam_
>::TestBody()
{
411 SCOPED_TRACE("AppendRepeatedTest")::testing::internal::ScopedTrace gtest_trace_411( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 411, ::testing::Message() << ("AppendRepeatedTest"))
;
412
413 this->theVector.push_back(Constructable(1));
414 this->theVector.append(2, Constructable(77));
415 this->assertValuesInOrder(this->theVector, 3u, 1, 77, 77);
416}
417
418// Assign test
419TYPED_TEST(SmallVectorTest, AssignTest)template <typename gtest_TypeParam_> class SmallVectorTest_AssignTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_AssignTest_registered_ __attribute__ (
(unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_AssignTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "AssignTest", 0); template <typename gtest_TypeParam_>
void SmallVectorTest_AssignTest_Test<gtest_TypeParam_>
::TestBody()
{
420 SCOPED_TRACE("AssignTest")::testing::internal::ScopedTrace gtest_trace_420( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 420, ::testing::Message() << ("AssignTest"))
;
421
422 this->theVector.push_back(Constructable(1));
423 this->theVector.assign(2, Constructable(77));
424 this->assertValuesInOrder(this->theVector, 2u, 77, 77);
425}
426
427// Move-assign test
428TYPED_TEST(SmallVectorTest, MoveAssignTest)template <typename gtest_TypeParam_> class SmallVectorTest_MoveAssignTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_MoveAssignTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_MoveAssignTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "MoveAssignTest", 0); template <typename gtest_TypeParam_
> void SmallVectorTest_MoveAssignTest_Test<gtest_TypeParam_
>::TestBody()
{
429 SCOPED_TRACE("MoveAssignTest")::testing::internal::ScopedTrace gtest_trace_429( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 429, ::testing::Message() << ("MoveAssignTest"))
;
430
431 // Set up our vector with a single element, but enough capacity for 4.
432 this->theVector.reserve(4);
433 this->theVector.push_back(Constructable(1));
434
435 // Set up the other vector with 2 elements.
436 this->otherVector.push_back(Constructable(2));
437 this->otherVector.push_back(Constructable(3));
438
439 // Move-assign from the other vector.
440 this->theVector = std::move(this->otherVector);
441
442 // Make sure we have the right result.
443 this->assertValuesInOrder(this->theVector, 2u, 2, 3);
444
445 // Make sure the # of constructor/destructor calls line up. There
446 // are two live objects after clearing the other vector.
447 this->otherVector.clear();
448 EXPECT_EQ(Constructable::getNumConstructorCalls()-2,switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(Constructable::getNumConstructorCalls
()-2)) == 1)>::Compare("Constructable::getNumConstructorCalls()-2"
, "Constructable::getNumDestructorCalls()", Constructable::getNumConstructorCalls
()-2, Constructable::getNumDestructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 449, gtest_ar.failure_message()) = ::testing::Message()
449 Constructable::getNumDestructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(Constructable::getNumConstructorCalls
()-2)) == 1)>::Compare("Constructable::getNumConstructorCalls()-2"
, "Constructable::getNumDestructorCalls()", Constructable::getNumConstructorCalls
()-2, Constructable::getNumDestructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 449, gtest_ar.failure_message()) = ::testing::Message()
;
450
451 // There shouldn't be any live objects any more.
452 this->theVector.clear();
453 EXPECT_EQ(Constructable::getNumConstructorCalls(),switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(Constructable::getNumConstructorCalls
())) == 1)>::Compare("Constructable::getNumConstructorCalls()"
, "Constructable::getNumDestructorCalls()", Constructable::getNumConstructorCalls
(), Constructable::getNumDestructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 454, gtest_ar.failure_message()) = ::testing::Message()
454 Constructable::getNumDestructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(Constructable::getNumConstructorCalls
())) == 1)>::Compare("Constructable::getNumConstructorCalls()"
, "Constructable::getNumDestructorCalls()", Constructable::getNumConstructorCalls
(), Constructable::getNumDestructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 454, gtest_ar.failure_message()) = ::testing::Message()
;
455}
456
457// Erase a single element
458TYPED_TEST(SmallVectorTest, EraseTest)template <typename gtest_TypeParam_> class SmallVectorTest_EraseTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_EraseTest_registered_ __attribute__ ((
unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_EraseTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "EraseTest", 0); template <typename gtest_TypeParam_>
void SmallVectorTest_EraseTest_Test<gtest_TypeParam_>::
TestBody()
{
459 SCOPED_TRACE("EraseTest")::testing::internal::ScopedTrace gtest_trace_459( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 459, ::testing::Message() << ("EraseTest"))
;
460
461 this->makeSequence(this->theVector, 1, 3);
462 this->theVector.erase(this->theVector.begin());
463 this->assertValuesInOrder(this->theVector, 2u, 2, 3);
464}
465
466// Erase a range of elements
467TYPED_TEST(SmallVectorTest, EraseRangeTest)template <typename gtest_TypeParam_> class SmallVectorTest_EraseRangeTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_EraseRangeTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_EraseRangeTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "EraseRangeTest", 0); template <typename gtest_TypeParam_
> void SmallVectorTest_EraseRangeTest_Test<gtest_TypeParam_
>::TestBody()
{
468 SCOPED_TRACE("EraseRangeTest")::testing::internal::ScopedTrace gtest_trace_468( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 468, ::testing::Message() << ("EraseRangeTest"))
;
469
470 this->makeSequence(this->theVector, 1, 3);
471 this->theVector.erase(this->theVector.begin(), this->theVector.begin() + 2);
472 this->assertValuesInOrder(this->theVector, 1u, 3);
473}
474
475// Insert a single element.
476TYPED_TEST(SmallVectorTest, InsertTest)template <typename gtest_TypeParam_> class SmallVectorTest_InsertTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_InsertTest_registered_ __attribute__ (
(unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_InsertTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "InsertTest", 0); template <typename gtest_TypeParam_>
void SmallVectorTest_InsertTest_Test<gtest_TypeParam_>
::TestBody()
{
477 SCOPED_TRACE("InsertTest")::testing::internal::ScopedTrace gtest_trace_477( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 477, ::testing::Message() << ("InsertTest"))
;
478
479 this->makeSequence(this->theVector, 1, 3);
480 typename TypeParam::iterator I =
481 this->theVector.insert(this->theVector.begin() + 1, Constructable(77));
482 EXPECT_EQ(this->theVector.begin() + 1, I)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.begin() + 1
)) == 1)>::Compare("this->theVector.begin() + 1", "I", this
->theVector.begin() + 1, I))) ; else ::testing::internal::
AssertHelper(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 482, gtest_ar.failure_message()) = ::testing::Message()
;
483 this->assertValuesInOrder(this->theVector, 4u, 1, 77, 2, 3);
484}
485
486// Insert a copy of a single element.
487TYPED_TEST(SmallVectorTest, InsertCopy)template <typename gtest_TypeParam_> class SmallVectorTest_InsertCopy_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_InsertCopy_registered_ __attribute__ (
(unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_InsertCopy_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "InsertCopy", 0); template <typename gtest_TypeParam_>
void SmallVectorTest_InsertCopy_Test<gtest_TypeParam_>
::TestBody()
{
488 SCOPED_TRACE("InsertTest")::testing::internal::ScopedTrace gtest_trace_488( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 488, ::testing::Message() << ("InsertTest"))
;
489
490 this->makeSequence(this->theVector, 1, 3);
491 Constructable C(77);
492 typename TypeParam::iterator I =
493 this->theVector.insert(this->theVector.begin() + 1, C);
494 EXPECT_EQ(this->theVector.begin() + 1, I)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.begin() + 1
)) == 1)>::Compare("this->theVector.begin() + 1", "I", this
->theVector.begin() + 1, I))) ; else ::testing::internal::
AssertHelper(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 494, gtest_ar.failure_message()) = ::testing::Message()
;
495 this->assertValuesInOrder(this->theVector, 4u, 1, 77, 2, 3);
496}
497
498// Insert repeated elements.
499TYPED_TEST(SmallVectorTest, InsertRepeatedTest)template <typename gtest_TypeParam_> class SmallVectorTest_InsertRepeatedTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_InsertRepeatedTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_InsertRepeatedTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "InsertRepeatedTest", 0); template <typename gtest_TypeParam_
> void SmallVectorTest_InsertRepeatedTest_Test<gtest_TypeParam_
>::TestBody()
{
500 SCOPED_TRACE("InsertRepeatedTest")::testing::internal::ScopedTrace gtest_trace_500( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 500, ::testing::Message() << ("InsertRepeatedTest"))
;
501
502 this->makeSequence(this->theVector, 1, 4);
503 Constructable::reset();
504 auto I =
505 this->theVector.insert(this->theVector.begin() + 1, 2, Constructable(16));
506 // Move construct the top element into newly allocated space, and optionally
507 // reallocate the whole buffer, move constructing into it.
508 // FIXME: This is inefficient, we shouldn't move things into newly allocated
509 // space, then move them up/around, there should only be 2 or 4 move
510 // constructions here.
511 EXPECT_TRUE(Constructable::getNumMoveConstructorCalls() == 2 ||switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(Constructable::getNumMoveConstructorCalls
() == 2 || Constructable::getNumMoveConstructorCalls() == 6))
; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 512, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "Constructable::getNumMoveConstructorCalls() == 2 || Constructable::getNumMoveConstructorCalls() == 6"
, "false", "true").c_str()) = ::testing::Message()
512 Constructable::getNumMoveConstructorCalls() == 6)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(Constructable::getNumMoveConstructorCalls
() == 2 || Constructable::getNumMoveConstructorCalls() == 6))
; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 512, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "Constructable::getNumMoveConstructorCalls() == 2 || Constructable::getNumMoveConstructorCalls() == 6"
, "false", "true").c_str()) = ::testing::Message()
;
513 // Move assign the next two to shift them up and make a gap.
514 EXPECT_EQ(1, Constructable::getNumMoveAssignmentCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(1)) == 1)>::Compare("1", "Constructable::getNumMoveAssignmentCalls()"
, 1, Constructable::getNumMoveAssignmentCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 514, gtest_ar.failure_message()) = ::testing::Message()
;
515 // Copy construct the two new elements from the parameter.
516 EXPECT_EQ(2, Constructable::getNumCopyAssignmentCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(2)) == 1)>::Compare("2", "Constructable::getNumCopyAssignmentCalls()"
, 2, Constructable::getNumCopyAssignmentCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 516, gtest_ar.failure_message()) = ::testing::Message()
;
517 // All without any copy construction.
518 EXPECT_EQ(0, Constructable::getNumCopyConstructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(0)) == 1)>::Compare("0", "Constructable::getNumCopyConstructorCalls()"
, 0, Constructable::getNumCopyConstructorCalls()))) ; else ::
testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 518, gtest_ar.failure_message()) = ::testing::Message()
;
519 EXPECT_EQ(this->theVector.begin() + 1, I)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.begin() + 1
)) == 1)>::Compare("this->theVector.begin() + 1", "I", this
->theVector.begin() + 1, I))) ; else ::testing::internal::
AssertHelper(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 519, gtest_ar.failure_message()) = ::testing::Message()
;
520 this->assertValuesInOrder(this->theVector, 6u, 1, 16, 16, 2, 3, 4);
521}
522
523
524TYPED_TEST(SmallVectorTest, InsertRepeatedAtEndTest)template <typename gtest_TypeParam_> class SmallVectorTest_InsertRepeatedAtEndTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_InsertRepeatedAtEndTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_InsertRepeatedAtEndTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "InsertRepeatedAtEndTest", 0); template <typename gtest_TypeParam_
> void SmallVectorTest_InsertRepeatedAtEndTest_Test<gtest_TypeParam_
>::TestBody()
{
525 SCOPED_TRACE("InsertRepeatedTest")::testing::internal::ScopedTrace gtest_trace_525( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 525, ::testing::Message() << ("InsertRepeatedTest"))
;
526
527 this->makeSequence(this->theVector, 1, 4);
528 Constructable::reset();
529 auto I = this->theVector.insert(this->theVector.end(), 2, Constructable(16));
530 // Just copy construct them into newly allocated space
531 EXPECT_EQ(2, Constructable::getNumCopyConstructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(2)) == 1)>::Compare("2", "Constructable::getNumCopyConstructorCalls()"
, 2, Constructable::getNumCopyConstructorCalls()))) ; else ::
testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 531, gtest_ar.failure_message()) = ::testing::Message()
;
532 // Move everything across if reallocation is needed.
533 EXPECT_TRUE(Constructable::getNumMoveConstructorCalls() == 0 ||switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(Constructable::getNumMoveConstructorCalls
() == 0 || Constructable::getNumMoveConstructorCalls() == 4))
; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 534, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "Constructable::getNumMoveConstructorCalls() == 0 || Constructable::getNumMoveConstructorCalls() == 4"
, "false", "true").c_str()) = ::testing::Message()
534 Constructable::getNumMoveConstructorCalls() == 4)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(Constructable::getNumMoveConstructorCalls
() == 0 || Constructable::getNumMoveConstructorCalls() == 4))
; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 534, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "Constructable::getNumMoveConstructorCalls() == 0 || Constructable::getNumMoveConstructorCalls() == 4"
, "false", "true").c_str()) = ::testing::Message()
;
535 // Without ever moving or copying anything else.
536 EXPECT_EQ(0, Constructable::getNumCopyAssignmentCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(0)) == 1)>::Compare("0", "Constructable::getNumCopyAssignmentCalls()"
, 0, Constructable::getNumCopyAssignmentCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 536, gtest_ar.failure_message()) = ::testing::Message()
;
537 EXPECT_EQ(0, Constructable::getNumMoveAssignmentCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(0)) == 1)>::Compare("0", "Constructable::getNumMoveAssignmentCalls()"
, 0, Constructable::getNumMoveAssignmentCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 537, gtest_ar.failure_message()) = ::testing::Message()
;
538
539 EXPECT_EQ(this->theVector.begin() + 4, I)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.begin() + 4
)) == 1)>::Compare("this->theVector.begin() + 4", "I", this
->theVector.begin() + 4, I))) ; else ::testing::internal::
AssertHelper(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 539, gtest_ar.failure_message()) = ::testing::Message()
;
540 this->assertValuesInOrder(this->theVector, 6u, 1, 2, 3, 4, 16, 16);
541}
542
543TYPED_TEST(SmallVectorTest, InsertRepeatedEmptyTest)template <typename gtest_TypeParam_> class SmallVectorTest_InsertRepeatedEmptyTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_InsertRepeatedEmptyTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_InsertRepeatedEmptyTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "InsertRepeatedEmptyTest", 0); template <typename gtest_TypeParam_
> void SmallVectorTest_InsertRepeatedEmptyTest_Test<gtest_TypeParam_
>::TestBody()
{
544 SCOPED_TRACE("InsertRepeatedTest")::testing::internal::ScopedTrace gtest_trace_544( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 544, ::testing::Message() << ("InsertRepeatedTest"))
;
545
546 this->makeSequence(this->theVector, 10, 15);
547
548 // Empty insert.
549 EXPECT_EQ(this->theVector.end(),switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.end())) ==
1)>::Compare("this->theVector.end()", "this->theVector.insert(this->theVector.end(), 0, Constructable(42))"
, this->theVector.end(), this->theVector.insert(this->
theVector.end(), 0, Constructable(42))))) ; else ::testing::internal
::AssertHelper(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 551, gtest_ar.failure_message()) = ::testing::Message()
550 this->theVector.insert(this->theVector.end(),switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.end())) ==
1)>::Compare("this->theVector.end()", "this->theVector.insert(this->theVector.end(), 0, Constructable(42))"
, this->theVector.end(), this->theVector.insert(this->
theVector.end(), 0, Constructable(42))))) ; else ::testing::internal
::AssertHelper(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 551, gtest_ar.failure_message()) = ::testing::Message()
551 0, Constructable(42)))switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.end())) ==
1)>::Compare("this->theVector.end()", "this->theVector.insert(this->theVector.end(), 0, Constructable(42))"
, this->theVector.end(), this->theVector.insert(this->
theVector.end(), 0, Constructable(42))))) ; else ::testing::internal
::AssertHelper(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 551, gtest_ar.failure_message()) = ::testing::Message()
;
552 EXPECT_EQ(this->theVector.begin() + 1,switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.begin() + 1
)) == 1)>::Compare("this->theVector.begin() + 1", "this->theVector.insert(this->theVector.begin() + 1, 0, Constructable(42))"
, this->theVector.begin() + 1, this->theVector.insert(this
->theVector.begin() + 1, 0, Constructable(42))))) ; else ::
testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 554, gtest_ar.failure_message()) = ::testing::Message()
553 this->theVector.insert(this->theVector.begin() + 1,switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.begin() + 1
)) == 1)>::Compare("this->theVector.begin() + 1", "this->theVector.insert(this->theVector.begin() + 1, 0, Constructable(42))"
, this->theVector.begin() + 1, this->theVector.insert(this
->theVector.begin() + 1, 0, Constructable(42))))) ; else ::
testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 554, gtest_ar.failure_message()) = ::testing::Message()
554 0, Constructable(42)))switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.begin() + 1
)) == 1)>::Compare("this->theVector.begin() + 1", "this->theVector.insert(this->theVector.begin() + 1, 0, Constructable(42))"
, this->theVector.begin() + 1, this->theVector.insert(this
->theVector.begin() + 1, 0, Constructable(42))))) ; else ::
testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 554, gtest_ar.failure_message()) = ::testing::Message()
;
555}
556
557// Insert range.
558TYPED_TEST(SmallVectorTest, InsertRangeTest)template <typename gtest_TypeParam_> class SmallVectorTest_InsertRangeTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_InsertRangeTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_InsertRangeTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "InsertRangeTest", 0); template <typename gtest_TypeParam_
> void SmallVectorTest_InsertRangeTest_Test<gtest_TypeParam_
>::TestBody()
{
559 SCOPED_TRACE("InsertRangeTest")::testing::internal::ScopedTrace gtest_trace_559( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 559, ::testing::Message() << ("InsertRangeTest"))
;
560
561 Constructable Arr[3] =
562 { Constructable(77), Constructable(77), Constructable(77) };
563
564 this->makeSequence(this->theVector, 1, 3);
565 Constructable::reset();
566 auto I = this->theVector.insert(this->theVector.begin() + 1, Arr, Arr + 3);
567 // Move construct the top 3 elements into newly allocated space.
568 // Possibly move the whole sequence into new space first.
569 // FIXME: This is inefficient, we shouldn't move things into newly allocated
570 // space, then move them up/around, there should only be 2 or 3 move
571 // constructions here.
572 EXPECT_TRUE(Constructable::getNumMoveConstructorCalls() == 2 ||switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(Constructable::getNumMoveConstructorCalls
() == 2 || Constructable::getNumMoveConstructorCalls() == 5))
; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 573, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "Constructable::getNumMoveConstructorCalls() == 2 || Constructable::getNumMoveConstructorCalls() == 5"
, "false", "true").c_str()) = ::testing::Message()
573 Constructable::getNumMoveConstructorCalls() == 5)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(Constructable::getNumMoveConstructorCalls
() == 2 || Constructable::getNumMoveConstructorCalls() == 5))
; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 573, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "Constructable::getNumMoveConstructorCalls() == 2 || Constructable::getNumMoveConstructorCalls() == 5"
, "false", "true").c_str()) = ::testing::Message()
;
574 // Copy assign the lower 2 new elements into existing space.
575 EXPECT_EQ(2, Constructable::getNumCopyAssignmentCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(2)) == 1)>::Compare("2", "Constructable::getNumCopyAssignmentCalls()"
, 2, Constructable::getNumCopyAssignmentCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 575, gtest_ar.failure_message()) = ::testing::Message()
;
576 // Copy construct the third element into newly allocated space.
577 EXPECT_EQ(1, Constructable::getNumCopyConstructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(1)) == 1)>::Compare("1", "Constructable::getNumCopyConstructorCalls()"
, 1, Constructable::getNumCopyConstructorCalls()))) ; else ::
testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 577, gtest_ar.failure_message()) = ::testing::Message()
;
578 EXPECT_EQ(this->theVector.begin() + 1, I)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.begin() + 1
)) == 1)>::Compare("this->theVector.begin() + 1", "I", this
->theVector.begin() + 1, I))) ; else ::testing::internal::
AssertHelper(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 578, gtest_ar.failure_message()) = ::testing::Message()
;
579 this->assertValuesInOrder(this->theVector, 6u, 1, 77, 77, 77, 2, 3);
580}
581
582
583TYPED_TEST(SmallVectorTest, InsertRangeAtEndTest)template <typename gtest_TypeParam_> class SmallVectorTest_InsertRangeAtEndTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_InsertRangeAtEndTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_InsertRangeAtEndTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "InsertRangeAtEndTest", 0); template <typename gtest_TypeParam_
> void SmallVectorTest_InsertRangeAtEndTest_Test<gtest_TypeParam_
>::TestBody()
{
584 SCOPED_TRACE("InsertRangeTest")::testing::internal::ScopedTrace gtest_trace_584( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 584, ::testing::Message() << ("InsertRangeTest"))
;
585
586 Constructable Arr[3] =
587 { Constructable(77), Constructable(77), Constructable(77) };
588
589 this->makeSequence(this->theVector, 1, 3);
590
591 // Insert at end.
592 Constructable::reset();
593 auto I = this->theVector.insert(this->theVector.end(), Arr, Arr+3);
594 // Copy construct the 3 elements into new space at the top.
595 EXPECT_EQ(3, Constructable::getNumCopyConstructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(3)) == 1)>::Compare("3", "Constructable::getNumCopyConstructorCalls()"
, 3, Constructable::getNumCopyConstructorCalls()))) ; else ::
testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 595, gtest_ar.failure_message()) = ::testing::Message()
;
596 // Don't copy/move anything else.
597 EXPECT_EQ(0, Constructable::getNumCopyAssignmentCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(0)) == 1)>::Compare("0", "Constructable::getNumCopyAssignmentCalls()"
, 0, Constructable::getNumCopyAssignmentCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 597, gtest_ar.failure_message()) = ::testing::Message()
;
598 // Reallocation might occur, causing all elements to be moved into the new
599 // buffer.
600 EXPECT_TRUE(Constructable::getNumMoveConstructorCalls() == 0 ||switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(Constructable::getNumMoveConstructorCalls
() == 0 || Constructable::getNumMoveConstructorCalls() == 3))
; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 601, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "Constructable::getNumMoveConstructorCalls() == 0 || Constructable::getNumMoveConstructorCalls() == 3"
, "false", "true").c_str()) = ::testing::Message()
601 Constructable::getNumMoveConstructorCalls() == 3)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(Constructable::getNumMoveConstructorCalls
() == 0 || Constructable::getNumMoveConstructorCalls() == 3))
; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 601, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "Constructable::getNumMoveConstructorCalls() == 0 || Constructable::getNumMoveConstructorCalls() == 3"
, "false", "true").c_str()) = ::testing::Message()
;
602 EXPECT_EQ(0, Constructable::getNumMoveAssignmentCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(0)) == 1)>::Compare("0", "Constructable::getNumMoveAssignmentCalls()"
, 0, Constructable::getNumMoveAssignmentCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 602, gtest_ar.failure_message()) = ::testing::Message()
;
603 EXPECT_EQ(this->theVector.begin() + 3, I)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.begin() + 3
)) == 1)>::Compare("this->theVector.begin() + 3", "I", this
->theVector.begin() + 3, I))) ; else ::testing::internal::
AssertHelper(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 603, gtest_ar.failure_message()) = ::testing::Message()
;
604 this->assertValuesInOrder(this->theVector, 6u,
605 1, 2, 3, 77, 77, 77);
606}
607
608TYPED_TEST(SmallVectorTest, InsertEmptyRangeTest)template <typename gtest_TypeParam_> class SmallVectorTest_InsertEmptyRangeTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_InsertEmptyRangeTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_InsertEmptyRangeTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "InsertEmptyRangeTest", 0); template <typename gtest_TypeParam_
> void SmallVectorTest_InsertEmptyRangeTest_Test<gtest_TypeParam_
>::TestBody()
{
609 SCOPED_TRACE("InsertRangeTest")::testing::internal::ScopedTrace gtest_trace_609( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 609, ::testing::Message() << ("InsertRangeTest"))
;
610
611 this->makeSequence(this->theVector, 1, 3);
612
613 // Empty insert.
614 EXPECT_EQ(this->theVector.end(),switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.end())) ==
1)>::Compare("this->theVector.end()", "this->theVector.insert(this->theVector.end(), this->theVector.begin(), this->theVector.begin())"
, this->theVector.end(), this->theVector.insert(this->
theVector.end(), this->theVector.begin(), this->theVector
.begin())))) ; else ::testing::internal::AssertHelper(::testing
::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 617, gtest_ar.failure_message()) = ::testing::Message()
615 this->theVector.insert(this->theVector.end(),switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.end())) ==
1)>::Compare("this->theVector.end()", "this->theVector.insert(this->theVector.end(), this->theVector.begin(), this->theVector.begin())"
, this->theVector.end(), this->theVector.insert(this->
theVector.end(), this->theVector.begin(), this->theVector
.begin())))) ; else ::testing::internal::AssertHelper(::testing
::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 617, gtest_ar.failure_message()) = ::testing::Message()
616 this->theVector.begin(),switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.end())) ==
1)>::Compare("this->theVector.end()", "this->theVector.insert(this->theVector.end(), this->theVector.begin(), this->theVector.begin())"
, this->theVector.end(), this->theVector.insert(this->
theVector.end(), this->theVector.begin(), this->theVector
.begin())))) ; else ::testing::internal::AssertHelper(::testing
::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 617, gtest_ar.failure_message()) = ::testing::Message()
617 this->theVector.begin()))switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.end())) ==
1)>::Compare("this->theVector.end()", "this->theVector.insert(this->theVector.end(), this->theVector.begin(), this->theVector.begin())"
, this->theVector.end(), this->theVector.insert(this->
theVector.end(), this->theVector.begin(), this->theVector
.begin())))) ; else ::testing::internal::AssertHelper(::testing
::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 617, gtest_ar.failure_message()) = ::testing::Message()
;
618 EXPECT_EQ(this->theVector.begin() + 1,switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.begin() + 1
)) == 1)>::Compare("this->theVector.begin() + 1", "this->theVector.insert(this->theVector.begin() + 1, this->theVector.begin(), this->theVector.begin())"
, this->theVector.begin() + 1, this->theVector.insert(this
->theVector.begin() + 1, this->theVector.begin(), this->
theVector.begin())))) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 621, gtest_ar.failure_message()) = ::testing::Message()
619 this->theVector.insert(this->theVector.begin() + 1,switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.begin() + 1
)) == 1)>::Compare("this->theVector.begin() + 1", "this->theVector.insert(this->theVector.begin() + 1, this->theVector.begin(), this->theVector.begin())"
, this->theVector.begin() + 1, this->theVector.insert(this
->theVector.begin() + 1, this->theVector.begin(), this->
theVector.begin())))) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 621, gtest_ar.failure_message()) = ::testing::Message()
620 this->theVector.begin(),switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.begin() + 1
)) == 1)>::Compare("this->theVector.begin() + 1", "this->theVector.insert(this->theVector.begin() + 1, this->theVector.begin(), this->theVector.begin())"
, this->theVector.begin() + 1, this->theVector.insert(this
->theVector.begin() + 1, this->theVector.begin(), this->
theVector.begin())))) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 621, gtest_ar.failure_message()) = ::testing::Message()
621 this->theVector.begin()))switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(this->theVector.begin() + 1
)) == 1)>::Compare("this->theVector.begin() + 1", "this->theVector.insert(this->theVector.begin() + 1, this->theVector.begin(), this->theVector.begin())"
, this->theVector.begin() + 1, this->theVector.insert(this
->theVector.begin() + 1, this->theVector.begin(), this->
theVector.begin())))) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 621, gtest_ar.failure_message()) = ::testing::Message()
;
622}
623
624// Comparison tests.
625TYPED_TEST(SmallVectorTest, ComparisonTest)template <typename gtest_TypeParam_> class SmallVectorTest_ComparisonTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_ComparisonTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_ComparisonTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "ComparisonTest", 0); template <typename gtest_TypeParam_
> void SmallVectorTest_ComparisonTest_Test<gtest_TypeParam_
>::TestBody()
{
626 SCOPED_TRACE("ComparisonTest")::testing::internal::ScopedTrace gtest_trace_626( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 626, ::testing::Message() << ("ComparisonTest"))
;
627
628 this->makeSequence(this->theVector, 1, 3);
629 this->makeSequence(this->otherVector, 1, 3);
630
631 EXPECT_TRUE(this->theVector == this->otherVector)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(this->theVector ==
this->otherVector)) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 631, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "this->theVector == this->otherVector", "false", "true"
).c_str()) = ::testing::Message()
;
632 EXPECT_FALSE(this->theVector != this->otherVector)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(!(this->theVector !=
this->otherVector))) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 632, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "this->theVector != this->otherVector", "true", "false"
).c_str()) = ::testing::Message()
;
633
634 this->otherVector.clear();
635 this->makeSequence(this->otherVector, 2, 4);
636
637 EXPECT_FALSE(this->theVector == this->otherVector)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(!(this->theVector ==
this->otherVector))) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 637, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "this->theVector == this->otherVector", "true", "false"
).c_str()) = ::testing::Message()
;
638 EXPECT_TRUE(this->theVector != this->otherVector)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(this->theVector !=
this->otherVector)) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 638, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "this->theVector != this->otherVector", "false", "true"
).c_str()) = ::testing::Message()
;
639}
640
641// Constant vector tests.
642TYPED_TEST(SmallVectorTest, ConstVectorTest)template <typename gtest_TypeParam_> class SmallVectorTest_ConstVectorTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_ConstVectorTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_ConstVectorTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "ConstVectorTest", 0); template <typename gtest_TypeParam_
> void SmallVectorTest_ConstVectorTest_Test<gtest_TypeParam_
>::TestBody()
{
643 const TypeParam constVector;
644
645 EXPECT_EQ(0u, constVector.size())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(0u)) == 1)>::Compare("0u",
"constVector.size()", 0u, constVector.size()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 645, gtest_ar.failure_message()) = ::testing::Message()
;
646 EXPECT_TRUE(constVector.empty())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(constVector.empty()))
; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 646, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "constVector.empty()", "false", "true").c_str()) = ::testing
::Message()
;
647 EXPECT_TRUE(constVector.begin() == constVector.end())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(constVector.begin() ==
constVector.end())) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 647, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "constVector.begin() == constVector.end()", "false", "true"
).c_str()) = ::testing::Message()
;
648}
649
650// Direct array access.
651TYPED_TEST(SmallVectorTest, DirectVectorTest)template <typename gtest_TypeParam_> class SmallVectorTest_DirectVectorTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_DirectVectorTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_DirectVectorTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "DirectVectorTest", 0); template <typename gtest_TypeParam_
> void SmallVectorTest_DirectVectorTest_Test<gtest_TypeParam_
>::TestBody()
{
652 EXPECT_EQ(0u, this->theVector.size())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(0u)) == 1)>::Compare("0u",
"this->theVector.size()", 0u, this->theVector.size()))
) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 652, gtest_ar.failure_message()) = ::testing::Message()
;
653 this->theVector.reserve(4);
654 EXPECT_LE(4u, this->theVector.capacity())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal::CmpHelperLE("4u", "this->theVector.capacity()"
, 4u, this->theVector.capacity()))) ; else ::testing::internal
::AssertHelper(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 654, gtest_ar.failure_message()) = ::testing::Message()
;
655 EXPECT_EQ(0, Constructable::getNumConstructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(0)) == 1)>::Compare("0", "Constructable::getNumConstructorCalls()"
, 0, Constructable::getNumConstructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 655, gtest_ar.failure_message()) = ::testing::Message()
;
656 this->theVector.push_back(1);
657 this->theVector.push_back(2);
658 this->theVector.push_back(3);
659 this->theVector.push_back(4);
660 EXPECT_EQ(4u, this->theVector.size())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(4u)) == 1)>::Compare("4u",
"this->theVector.size()", 4u, this->theVector.size()))
) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 660, gtest_ar.failure_message()) = ::testing::Message()
;
661 EXPECT_EQ(8, Constructable::getNumConstructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(8)) == 1)>::Compare("8", "Constructable::getNumConstructorCalls()"
, 8, Constructable::getNumConstructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 661, gtest_ar.failure_message()) = ::testing::Message()
;
662 EXPECT_EQ(1, this->theVector[0].getValue())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(1)) == 1)>::Compare("1", "this->theVector[0].getValue()"
, 1, this->theVector[0].getValue()))) ; else ::testing::internal
::AssertHelper(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 662, gtest_ar.failure_message()) = ::testing::Message()
;
663 EXPECT_EQ(2, this->theVector[1].getValue())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(2)) == 1)>::Compare("2", "this->theVector[1].getValue()"
, 2, this->theVector[1].getValue()))) ; else ::testing::internal
::AssertHelper(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 663, gtest_ar.failure_message()) = ::testing::Message()
;
664 EXPECT_EQ(3, this->theVector[2].getValue())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(3)) == 1)>::Compare("3", "this->theVector[2].getValue()"
, 3, this->theVector[2].getValue()))) ; else ::testing::internal
::AssertHelper(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 664, gtest_ar.failure_message()) = ::testing::Message()
;
665 EXPECT_EQ(4, this->theVector[3].getValue())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(4)) == 1)>::Compare("4", "this->theVector[3].getValue()"
, 4, this->theVector[3].getValue()))) ; else ::testing::internal
::AssertHelper(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 665, gtest_ar.failure_message()) = ::testing::Message()
;
666}
667
668TYPED_TEST(SmallVectorTest, IteratorTest)template <typename gtest_TypeParam_> class SmallVectorTest_IteratorTest_Test
: public SmallVectorTest<gtest_TypeParam_> { private: typedef
SmallVectorTest<gtest_TypeParam_> TestFixture; typedef
gtest_TypeParam_ TypeParam; virtual void TestBody(); }; bool
gtest_SmallVectorTest_IteratorTest_registered_ __attribute__
((unused)) = ::testing::internal::TypeParameterizedTest< SmallVectorTest
, ::testing::internal::TemplateSel< SmallVectorTest_IteratorTest_Test
>, gtest_type_params_SmallVectorTest_>::Register( "", "SmallVectorTest"
, "IteratorTest", 0); template <typename gtest_TypeParam_>
void SmallVectorTest_IteratorTest_Test<gtest_TypeParam_>
::TestBody()
{
669 std::list<int> L;
670 this->theVector.insert(this->theVector.end(), L.begin(), L.end());
671}
672
673template <typename InvalidType> class DualSmallVectorsTest;
674
675template <typename VectorT1, typename VectorT2>
676class DualSmallVectorsTest<std::pair<VectorT1, VectorT2>> : public SmallVectorTestBase {
677protected:
678 VectorT1 theVector;
679 VectorT2 otherVector;
680
681 template <typename T, unsigned N>
682 static unsigned NumBuiltinElts(const SmallVector<T, N>&) { return N; }
683};
684
685typedef ::testing::Types<
686 // Small mode -> Small mode.
687 std::pair<SmallVector<Constructable, 4>, SmallVector<Constructable, 4>>,
688 // Small mode -> Big mode.
689 std::pair<SmallVector<Constructable, 4>, SmallVector<Constructable, 2>>,
690 // Big mode -> Small mode.
691 std::pair<SmallVector<Constructable, 2>, SmallVector<Constructable, 4>>,
692 // Big mode -> Big mode.
693 std::pair<SmallVector<Constructable, 2>, SmallVector<Constructable, 2>>
694 > DualSmallVectorTestTypes;
695
696TYPED_TEST_CASE(DualSmallVectorsTest, DualSmallVectorTestTypes)typedef ::testing::internal::TypeList< DualSmallVectorTestTypes
>::type gtest_type_params_DualSmallVectorsTest_
;
697
698TYPED_TEST(DualSmallVectorsTest, MoveAssignment)template <typename gtest_TypeParam_> class DualSmallVectorsTest_MoveAssignment_Test
: public DualSmallVectorsTest<gtest_TypeParam_> { private
: typedef DualSmallVectorsTest<gtest_TypeParam_> TestFixture
; typedef gtest_TypeParam_ TypeParam; virtual void TestBody()
; }; bool gtest_DualSmallVectorsTest_MoveAssignment_registered_
__attribute__ ((unused)) = ::testing::internal::TypeParameterizedTest
< DualSmallVectorsTest, ::testing::internal::TemplateSel<
DualSmallVectorsTest_MoveAssignment_Test>, gtest_type_params_DualSmallVectorsTest_
>::Register( "", "DualSmallVectorsTest", "MoveAssignment",
0); template <typename gtest_TypeParam_> void DualSmallVectorsTest_MoveAssignment_Test
<gtest_TypeParam_>::TestBody()
{
699 SCOPED_TRACE("MoveAssignTest-DualVectorTypes")::testing::internal::ScopedTrace gtest_trace_699( "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 699, ::testing::Message() << ("MoveAssignTest-DualVectorTypes"
))
;
700
701 // Set up our vector with four elements.
702 for (unsigned I = 0; I < 4; ++I)
703 this->otherVector.push_back(Constructable(I));
704
705 const Constructable *OrigDataPtr = this->otherVector.data();
706
707 // Move-assign from the other vector.
708 this->theVector =
709 std::move(static_cast<SmallVectorImpl<Constructable>&>(this->otherVector));
710
711 // Make sure we have the right result.
712 this->assertValuesInOrder(this->theVector, 4u, 0, 1, 2, 3);
713
714 // Make sure the # of constructor/destructor calls line up. There
715 // are two live objects after clearing the other vector.
716 this->otherVector.clear();
717 EXPECT_EQ(Constructable::getNumConstructorCalls()-4,switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(Constructable::getNumConstructorCalls
()-4)) == 1)>::Compare("Constructable::getNumConstructorCalls()-4"
, "Constructable::getNumDestructorCalls()", Constructable::getNumConstructorCalls
()-4, Constructable::getNumDestructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 718, gtest_ar.failure_message()) = ::testing::Message()
718 Constructable::getNumDestructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(Constructable::getNumConstructorCalls
()-4)) == 1)>::Compare("Constructable::getNumConstructorCalls()-4"
, "Constructable::getNumDestructorCalls()", Constructable::getNumConstructorCalls
()-4, Constructable::getNumDestructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 718, gtest_ar.failure_message()) = ::testing::Message()
;
719
720 // If the source vector (otherVector) was in small-mode, assert that we just
721 // moved the data pointer over.
722 EXPECT_TRUE(this->NumBuiltinElts(this->otherVector) == 4 ||switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(this->NumBuiltinElts
(this->otherVector) == 4 || this->theVector.data() == OrigDataPtr
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 723, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "this->NumBuiltinElts(this->otherVector) == 4 || this->theVector.data() == OrigDataPtr"
, "false", "true").c_str()) = ::testing::Message()
723 this->theVector.data() == OrigDataPtr)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(this->NumBuiltinElts
(this->otherVector) == 4 || this->theVector.data() == OrigDataPtr
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 723, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "this->NumBuiltinElts(this->otherVector) == 4 || this->theVector.data() == OrigDataPtr"
, "false", "true").c_str()) = ::testing::Message()
;
724
725 // There shouldn't be any live objects any more.
726 this->theVector.clear();
727 EXPECT_EQ(Constructable::getNumConstructorCalls(),switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(Constructable::getNumConstructorCalls
())) == 1)>::Compare("Constructable::getNumConstructorCalls()"
, "Constructable::getNumDestructorCalls()", Constructable::getNumConstructorCalls
(), Constructable::getNumDestructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 728, gtest_ar.failure_message()) = ::testing::Message()
728 Constructable::getNumDestructorCalls())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(Constructable::getNumConstructorCalls
())) == 1)>::Compare("Constructable::getNumConstructorCalls()"
, "Constructable::getNumDestructorCalls()", Constructable::getNumConstructorCalls
(), Constructable::getNumDestructorCalls()))) ; else ::testing
::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 728, gtest_ar.failure_message()) = ::testing::Message()
;
729
730 // We shouldn't have copied anything in this whole process.
731 EXPECT_EQ(Constructable::getNumCopyConstructorCalls(), 0)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(Constructable::getNumCopyConstructorCalls
())) == 1)>::Compare("Constructable::getNumCopyConstructorCalls()"
, "0", Constructable::getNumCopyConstructorCalls(), 0))) ; else
::testing::internal::AssertHelper(::testing::TestPartResult::
kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 731, gtest_ar.failure_message()) = ::testing::Message()
;
732}
733
734struct notassignable {
735 int &x;
736 notassignable(int &x) : x(x) {}
737};
738
739TEST(SmallVectorCustomTest, NoAssignTest)class SmallVectorCustomTest_NoAssignTest_Test : public ::testing
::Test { public: SmallVectorCustomTest_NoAssignTest_Test() {}
private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); SmallVectorCustomTest_NoAssignTest_Test
(SmallVectorCustomTest_NoAssignTest_Test const &); void operator
=(SmallVectorCustomTest_NoAssignTest_Test const &);};::testing
::TestInfo* const SmallVectorCustomTest_NoAssignTest_Test ::test_info_
= ::testing::internal::MakeAndRegisterTestInfo( "SmallVectorCustomTest"
, "NoAssignTest", __null, __null, (::testing::internal::GetTestTypeId
()), ::testing::Test::SetUpTestCase, ::testing::Test::TearDownTestCase
, new ::testing::internal::TestFactoryImpl< SmallVectorCustomTest_NoAssignTest_Test
>);void SmallVectorCustomTest_NoAssignTest_Test::TestBody(
)
{
740 int x = 0;
741 SmallVector<notassignable, 2> vec;
742 vec.push_back(notassignable(x));
743 x = 42;
Value stored to 'x' is never read
744 EXPECT_EQ(42, vec.pop_back_val().x)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(42)) == 1)>::Compare("42",
"vec.pop_back_val().x", 42, vec.pop_back_val().x))) ; else ::
testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 744, gtest_ar.failure_message()) = ::testing::Message()
;
745}
746
747struct MovedFrom {
748 bool hasValue;
749 MovedFrom() : hasValue(true) {
750 }
751 MovedFrom(MovedFrom&& m) : hasValue(m.hasValue) {
752 m.hasValue = false;
753 }
754 MovedFrom &operator=(MovedFrom&& m) {
755 hasValue = m.hasValue;
756 m.hasValue = false;
757 return *this;
758 }
759};
760
761TEST(SmallVectorTest, MidInsert)class SmallVectorTest_MidInsert_Test : public ::testing::Test
{ public: SmallVectorTest_MidInsert_Test() {} private: virtual
void TestBody(); static ::testing::TestInfo* const test_info_
__attribute__ ((unused)); SmallVectorTest_MidInsert_Test(SmallVectorTest_MidInsert_Test
const &); void operator=(SmallVectorTest_MidInsert_Test const
&);};::testing::TestInfo* const SmallVectorTest_MidInsert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"SmallVectorTest", "MidInsert", __null, __null, (::testing::
internal::GetTestTypeId()), ::testing::Test::SetUpTestCase, ::
testing::Test::TearDownTestCase, new ::testing::internal::TestFactoryImpl
< SmallVectorTest_MidInsert_Test>);void SmallVectorTest_MidInsert_Test
::TestBody()
{
762 SmallVector<MovedFrom, 3> v;
763 v.push_back(MovedFrom());
764 v.insert(v.begin(), MovedFrom());
765 for (MovedFrom &m : v)
766 EXPECT_TRUE(m.hasValue)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(m.hasValue)) ; else ::
testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 766, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "m.hasValue", "false", "true").c_str()) = ::testing::Message
()
;
767}
768
769enum EmplaceableArgState {
770 EAS_Defaulted,
771 EAS_Arg,
772 EAS_LValue,
773 EAS_RValue,
774 EAS_Failure
775};
776template <int I> struct EmplaceableArg {
777 EmplaceableArgState State;
778 EmplaceableArg() : State(EAS_Defaulted) {}
779 EmplaceableArg(EmplaceableArg &&X)
780 : State(X.State == EAS_Arg ? EAS_RValue : EAS_Failure) {}
781 EmplaceableArg(EmplaceableArg &X)
782 : State(X.State == EAS_Arg ? EAS_LValue : EAS_Failure) {}
783
784 explicit EmplaceableArg(bool) : State(EAS_Arg) {}
785
786private:
787 EmplaceableArg &operator=(EmplaceableArg &&) = delete;
788 EmplaceableArg &operator=(const EmplaceableArg &) = delete;
789};
790
791enum EmplaceableState { ES_Emplaced, ES_Moved };
792struct Emplaceable {
793 EmplaceableArg<0> A0;
794 EmplaceableArg<1> A1;
795 EmplaceableArg<2> A2;
796 EmplaceableArg<3> A3;
797 EmplaceableState State;
798
799 Emplaceable() : State(ES_Emplaced) {}
800
801 template <class A0Ty>
802 explicit Emplaceable(A0Ty &&A0)
803 : A0(std::forward<A0Ty>(A0)), State(ES_Emplaced) {}
804
805 template <class A0Ty, class A1Ty>
806 Emplaceable(A0Ty &&A0, A1Ty &&A1)
807 : A0(std::forward<A0Ty>(A0)), A1(std::forward<A1Ty>(A1)),
808 State(ES_Emplaced) {}
809
810 template <class A0Ty, class A1Ty, class A2Ty>
811 Emplaceable(A0Ty &&A0, A1Ty &&A1, A2Ty &&A2)
812 : A0(std::forward<A0Ty>(A0)), A1(std::forward<A1Ty>(A1)),
813 A2(std::forward<A2Ty>(A2)), State(ES_Emplaced) {}
814
815 template <class A0Ty, class A1Ty, class A2Ty, class A3Ty>
816 Emplaceable(A0Ty &&A0, A1Ty &&A1, A2Ty &&A2, A3Ty &&A3)
817 : A0(std::forward<A0Ty>(A0)), A1(std::forward<A1Ty>(A1)),
818 A2(std::forward<A2Ty>(A2)), A3(std::forward<A3Ty>(A3)),
819 State(ES_Emplaced) {}
820
821 Emplaceable(Emplaceable &&) : State(ES_Moved) {}
822 Emplaceable &operator=(Emplaceable &&) {
823 State = ES_Moved;
824 return *this;
825 }
826
827private:
828 Emplaceable(const Emplaceable &) = delete;
829 Emplaceable &operator=(const Emplaceable &) = delete;
830};
831
832TEST(SmallVectorTest, EmplaceBack)class SmallVectorTest_EmplaceBack_Test : public ::testing::Test
{ public: SmallVectorTest_EmplaceBack_Test() {} private: virtual
void TestBody(); static ::testing::TestInfo* const test_info_
__attribute__ ((unused)); SmallVectorTest_EmplaceBack_Test(SmallVectorTest_EmplaceBack_Test
const &); void operator=(SmallVectorTest_EmplaceBack_Test
const &);};::testing::TestInfo* const SmallVectorTest_EmplaceBack_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"SmallVectorTest", "EmplaceBack", __null, __null, (::testing
::internal::GetTestTypeId()), ::testing::Test::SetUpTestCase,
::testing::Test::TearDownTestCase, new ::testing::internal::
TestFactoryImpl< SmallVectorTest_EmplaceBack_Test>);void
SmallVectorTest_EmplaceBack_Test::TestBody()
{
833 EmplaceableArg<0> A0(true);
834 EmplaceableArg<1> A1(true);
835 EmplaceableArg<2> A2(true);
836 EmplaceableArg<3> A3(true);
837 {
838 SmallVector<Emplaceable, 3> V;
839 V.emplace_back();
840 EXPECT_TRUE(V.size() == 1)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.size() == 1)) ; else
::testing::internal::AssertHelper(::testing::TestPartResult::
kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 840, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.size() == 1", "false", "true").c_str()) = ::testing::Message
()
;
841 EXPECT_TRUE(V.back().State == ES_Emplaced)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().State == ES_Emplaced
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 841, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().State == ES_Emplaced", "false", "true").c_str()) =
::testing::Message()
;
842 EXPECT_TRUE(V.back().A0.State == EAS_Defaulted)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A0.State == EAS_Defaulted
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 842, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A0.State == EAS_Defaulted", "false", "true").c_str
()) = ::testing::Message()
;
843 EXPECT_TRUE(V.back().A1.State == EAS_Defaulted)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A1.State == EAS_Defaulted
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 843, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A1.State == EAS_Defaulted", "false", "true").c_str
()) = ::testing::Message()
;
844 EXPECT_TRUE(V.back().A2.State == EAS_Defaulted)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A2.State == EAS_Defaulted
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 844, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A2.State == EAS_Defaulted", "false", "true").c_str
()) = ::testing::Message()
;
845 EXPECT_TRUE(V.back().A3.State == EAS_Defaulted)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A3.State == EAS_Defaulted
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 845, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A3.State == EAS_Defaulted", "false", "true").c_str
()) = ::testing::Message()
;
846 }
847 {
848 SmallVector<Emplaceable, 3> V;
849 V.emplace_back(std::move(A0));
850 EXPECT_TRUE(V.size() == 1)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.size() == 1)) ; else
::testing::internal::AssertHelper(::testing::TestPartResult::
kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 850, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.size() == 1", "false", "true").c_str()) = ::testing::Message
()
;
851 EXPECT_TRUE(V.back().State == ES_Emplaced)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().State == ES_Emplaced
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 851, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().State == ES_Emplaced", "false", "true").c_str()) =
::testing::Message()
;
852 EXPECT_TRUE(V.back().A0.State == EAS_RValue)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A0.State == EAS_RValue
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 852, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A0.State == EAS_RValue", "false", "true").c_str()
) = ::testing::Message()
;
853 EXPECT_TRUE(V.back().A1.State == EAS_Defaulted)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A1.State == EAS_Defaulted
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 853, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A1.State == EAS_Defaulted", "false", "true").c_str
()) = ::testing::Message()
;
854 EXPECT_TRUE(V.back().A2.State == EAS_Defaulted)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A2.State == EAS_Defaulted
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 854, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A2.State == EAS_Defaulted", "false", "true").c_str
()) = ::testing::Message()
;
855 EXPECT_TRUE(V.back().A3.State == EAS_Defaulted)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A3.State == EAS_Defaulted
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 855, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A3.State == EAS_Defaulted", "false", "true").c_str
()) = ::testing::Message()
;
856 }
857 {
858 SmallVector<Emplaceable, 3> V;
859 V.emplace_back(A0);
860 EXPECT_TRUE(V.size() == 1)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.size() == 1)) ; else
::testing::internal::AssertHelper(::testing::TestPartResult::
kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 860, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.size() == 1", "false", "true").c_str()) = ::testing::Message
()
;
861 EXPECT_TRUE(V.back().State == ES_Emplaced)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().State == ES_Emplaced
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 861, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().State == ES_Emplaced", "false", "true").c_str()) =
::testing::Message()
;
862 EXPECT_TRUE(V.back().A0.State == EAS_LValue)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A0.State == EAS_LValue
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 862, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A0.State == EAS_LValue", "false", "true").c_str()
) = ::testing::Message()
;
863 EXPECT_TRUE(V.back().A1.State == EAS_Defaulted)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A1.State == EAS_Defaulted
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 863, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A1.State == EAS_Defaulted", "false", "true").c_str
()) = ::testing::Message()
;
864 EXPECT_TRUE(V.back().A2.State == EAS_Defaulted)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A2.State == EAS_Defaulted
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 864, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A2.State == EAS_Defaulted", "false", "true").c_str
()) = ::testing::Message()
;
865 EXPECT_TRUE(V.back().A3.State == EAS_Defaulted)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A3.State == EAS_Defaulted
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 865, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A3.State == EAS_Defaulted", "false", "true").c_str
()) = ::testing::Message()
;
866 }
867 {
868 SmallVector<Emplaceable, 3> V;
869 V.emplace_back(A0, A1);
870 EXPECT_TRUE(V.size() == 1)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.size() == 1)) ; else
::testing::internal::AssertHelper(::testing::TestPartResult::
kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 870, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.size() == 1", "false", "true").c_str()) = ::testing::Message
()
;
871 EXPECT_TRUE(V.back().State == ES_Emplaced)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().State == ES_Emplaced
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 871, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().State == ES_Emplaced", "false", "true").c_str()) =
::testing::Message()
;
872 EXPECT_TRUE(V.back().A0.State == EAS_LValue)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A0.State == EAS_LValue
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 872, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A0.State == EAS_LValue", "false", "true").c_str()
) = ::testing::Message()
;
873 EXPECT_TRUE(V.back().A1.State == EAS_LValue)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A1.State == EAS_LValue
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 873, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A1.State == EAS_LValue", "false", "true").c_str()
) = ::testing::Message()
;
874 EXPECT_TRUE(V.back().A2.State == EAS_Defaulted)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A2.State == EAS_Defaulted
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 874, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A2.State == EAS_Defaulted", "false", "true").c_str
()) = ::testing::Message()
;
875 EXPECT_TRUE(V.back().A3.State == EAS_Defaulted)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A3.State == EAS_Defaulted
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 875, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A3.State == EAS_Defaulted", "false", "true").c_str
()) = ::testing::Message()
;
876 }
877 {
878 SmallVector<Emplaceable, 3> V;
879 V.emplace_back(std::move(A0), std::move(A1));
880 EXPECT_TRUE(V.size() == 1)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.size() == 1)) ; else
::testing::internal::AssertHelper(::testing::TestPartResult::
kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 880, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.size() == 1", "false", "true").c_str()) = ::testing::Message
()
;
881 EXPECT_TRUE(V.back().State == ES_Emplaced)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().State == ES_Emplaced
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 881, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().State == ES_Emplaced", "false", "true").c_str()) =
::testing::Message()
;
882 EXPECT_TRUE(V.back().A0.State == EAS_RValue)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A0.State == EAS_RValue
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 882, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A0.State == EAS_RValue", "false", "true").c_str()
) = ::testing::Message()
;
883 EXPECT_TRUE(V.back().A1.State == EAS_RValue)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A1.State == EAS_RValue
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 883, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A1.State == EAS_RValue", "false", "true").c_str()
) = ::testing::Message()
;
884 EXPECT_TRUE(V.back().A2.State == EAS_Defaulted)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A2.State == EAS_Defaulted
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 884, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A2.State == EAS_Defaulted", "false", "true").c_str
()) = ::testing::Message()
;
885 EXPECT_TRUE(V.back().A3.State == EAS_Defaulted)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A3.State == EAS_Defaulted
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 885, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A3.State == EAS_Defaulted", "false", "true").c_str
()) = ::testing::Message()
;
886 }
887 {
888 SmallVector<Emplaceable, 3> V;
889 V.emplace_back(std::move(A0), A1, std::move(A2), A3);
890 EXPECT_TRUE(V.size() == 1)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.size() == 1)) ; else
::testing::internal::AssertHelper(::testing::TestPartResult::
kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 890, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.size() == 1", "false", "true").c_str()) = ::testing::Message
()
;
891 EXPECT_TRUE(V.back().State == ES_Emplaced)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().State == ES_Emplaced
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 891, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().State == ES_Emplaced", "false", "true").c_str()) =
::testing::Message()
;
892 EXPECT_TRUE(V.back().A0.State == EAS_RValue)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A0.State == EAS_RValue
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 892, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A0.State == EAS_RValue", "false", "true").c_str()
) = ::testing::Message()
;
893 EXPECT_TRUE(V.back().A1.State == EAS_LValue)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A1.State == EAS_LValue
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 893, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A1.State == EAS_LValue", "false", "true").c_str()
) = ::testing::Message()
;
894 EXPECT_TRUE(V.back().A2.State == EAS_RValue)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A2.State == EAS_RValue
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 894, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A2.State == EAS_RValue", "false", "true").c_str()
) = ::testing::Message()
;
895 EXPECT_TRUE(V.back().A3.State == EAS_LValue)switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V.back().A3.State == EAS_LValue
)) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 895, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V.back().A3.State == EAS_LValue", "false", "true").c_str()
) = ::testing::Message()
;
896 }
897 {
898 SmallVector<int, 1> V;
899 V.emplace_back();
900 V.emplace_back(42);
901 EXPECT_EQ(2U, V.size())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(2U)) == 1)>::Compare("2U",
"V.size()", 2U, V.size()))) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 901, gtest_ar.failure_message()) = ::testing::Message()
;
902 EXPECT_EQ(0, V[0])switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(0)) == 1)>::Compare("0", "V[0]"
, 0, V[0]))) ; else ::testing::internal::AssertHelper(::testing
::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 902, gtest_ar.failure_message()) = ::testing::Message()
;
903 EXPECT_EQ(42, V[1])switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(42)) == 1)>::Compare("42",
"V[1]", 42, V[1]))) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 903, gtest_ar.failure_message()) = ::testing::Message()
;
904 }
905}
906
907TEST(SmallVectorTest, InitializerList)class SmallVectorTest_InitializerList_Test : public ::testing
::Test { public: SmallVectorTest_InitializerList_Test() {} private
: virtual void TestBody(); static ::testing::TestInfo* const test_info_
__attribute__ ((unused)); SmallVectorTest_InitializerList_Test
(SmallVectorTest_InitializerList_Test const &); void operator
=(SmallVectorTest_InitializerList_Test const &);};::testing
::TestInfo* const SmallVectorTest_InitializerList_Test ::test_info_
= ::testing::internal::MakeAndRegisterTestInfo( "SmallVectorTest"
, "InitializerList", __null, __null, (::testing::internal::GetTestTypeId
()), ::testing::Test::SetUpTestCase, ::testing::Test::TearDownTestCase
, new ::testing::internal::TestFactoryImpl< SmallVectorTest_InitializerList_Test
>);void SmallVectorTest_InitializerList_Test::TestBody()
{
908 SmallVector<int, 2> V1 = {};
909 EXPECT_TRUE(V1.empty())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(V1.empty())) ; else ::
testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure
, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 909, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "V1.empty()", "false", "true").c_str()) = ::testing::Message
()
;
910 V1 = {0, 0};
911 EXPECT_TRUE(makeArrayRef(V1).equals({0, 0}))switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(makeArrayRef(V1).equals
({0, 0}))) ; else ::testing::internal::AssertHelper(::testing
::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 911, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "makeArrayRef(V1).equals({0, 0})", "false", "true").c_str()
) = ::testing::Message()
;
912 V1 = {-1, -1};
913 EXPECT_TRUE(makeArrayRef(V1).equals({-1, -1}))switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(makeArrayRef(V1).equals
({-1, -1}))) ; else ::testing::internal::AssertHelper(::testing
::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 913, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "makeArrayRef(V1).equals({-1, -1})", "false", "true").c_str
()) = ::testing::Message()
;
914
915 SmallVector<int, 2> V2 = {1, 2, 3, 4};
916 EXPECT_TRUE(makeArrayRef(V2).equals({1, 2, 3, 4}))switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(makeArrayRef(V2).equals
({1, 2, 3, 4}))) ; else ::testing::internal::AssertHelper(::testing
::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 916, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "makeArrayRef(V2).equals({1, 2, 3, 4})", "false", "true").c_str
()) = ::testing::Message()
;
917 V2.assign({4});
918 EXPECT_TRUE(makeArrayRef(V2).equals({4}))switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(makeArrayRef(V2).equals
({4}))) ; else ::testing::internal::AssertHelper(::testing::TestPartResult
::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 918, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "makeArrayRef(V2).equals({4})", "false", "true").c_str()) =
::testing::Message()
;
919 V2.append({3, 2});
920 EXPECT_TRUE(makeArrayRef(V2).equals({4, 3, 2}))switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(makeArrayRef(V2).equals
({4, 3, 2}))) ; else ::testing::internal::AssertHelper(::testing
::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 920, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "makeArrayRef(V2).equals({4, 3, 2})", "false", "true").c_str
()) = ::testing::Message()
;
921 V2.insert(V2.begin() + 1, 5);
922 EXPECT_TRUE(makeArrayRef(V2).equals({4, 5, 3, 2}))switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar_ = ::testing::AssertionResult(makeArrayRef(V2).equals
({4, 5, 3, 2}))) ; else ::testing::internal::AssertHelper(::testing
::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn257205/unittests/ADT/SmallVectorTest.cpp"
, 922, ::testing::internal::GetBoolAssertionFailureMessage( gtest_ar_
, "makeArrayRef(V2).equals({4, 5, 3, 2})", "false", "true").c_str
()) = ::testing::Message()
;
923}
924
925} // end namespace