Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Side by Side Diff: third_party/WebKit/Source/wtf/HashSetTest.cpp

Issue 2654033007: Migrate WTF::HashSet::add() to ::insert() [part 2 of N] (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 testSet.reserveCapacityForSize(size); 48 testSet.reserveCapacityForSize(size);
49 const unsigned initialCapacity = testSet.capacity(); 49 const unsigned initialCapacity = testSet.capacity();
50 const unsigned minimumTableSize = HashTraits<int>::minimumTableSize; 50 const unsigned minimumTableSize = HashTraits<int>::minimumTableSize;
51 51
52 // reserveCapacityForSize should respect minimumTableSize. 52 // reserveCapacityForSize should respect minimumTableSize.
53 EXPECT_GE(initialCapacity, minimumTableSize); 53 EXPECT_GE(initialCapacity, minimumTableSize);
54 54
55 // Adding items up to size should never change the capacity. 55 // Adding items up to size should never change the capacity.
56 for (size_t i = 0; i < size; ++i) { 56 for (size_t i = 0; i < size; ++i) {
57 testSet.add(i + 1); // Avoid adding '0'. 57 testSet.insert(i + 1); // Avoid adding '0'.
58 EXPECT_EQ(initialCapacity, testSet.capacity()); 58 EXPECT_EQ(initialCapacity, testSet.capacity());
59 } 59 }
60 60
61 // Adding items up to less than half the capacity should not change the 61 // Adding items up to less than half the capacity should not change the
62 // capacity. 62 // capacity.
63 unsigned capacityLimit = initialCapacity / 2 - 1; 63 unsigned capacityLimit = initialCapacity / 2 - 1;
64 for (size_t i = size; i < capacityLimit; ++i) { 64 for (size_t i = size; i < capacityLimit; ++i) {
65 testSet.add(i + 1); 65 testSet.insert(i + 1);
66 EXPECT_EQ(initialCapacity, testSet.capacity()); 66 EXPECT_EQ(initialCapacity, testSet.capacity());
67 } 67 }
68 68
69 // Adding one more item increases the capacity. 69 // Adding one more item increases the capacity.
70 testSet.add(capacityLimit + 1); 70 testSet.insert(capacityLimit + 1);
71 EXPECT_GT(testSet.capacity(), initialCapacity); 71 EXPECT_GT(testSet.capacity(), initialCapacity);
72 72
73 testReserveCapacity<size - 1>(); 73 testReserveCapacity<size - 1>();
74 } 74 }
75 75
76 TEST(HashSetTest, ReserveCapacity) { 76 TEST(HashSetTest, ReserveCapacity) {
77 testReserveCapacity<128>(); 77 testReserveCapacity<128>();
78 } 78 }
79 79
80 struct Dummy { 80 struct Dummy {
81 Dummy(bool& deleted) : deleted(deleted) {} 81 Dummy(bool& deleted) : deleted(deleted) {}
82 82
83 ~Dummy() { deleted = true; } 83 ~Dummy() { deleted = true; }
84 84
85 bool& deleted; 85 bool& deleted;
86 }; 86 };
87 87
88 TEST(HashSetTest, HashSetOwnPtr) { 88 TEST(HashSetTest, HashSetOwnPtr) {
89 bool deleted1 = false, deleted2 = false; 89 bool deleted1 = false, deleted2 = false;
90 90
91 typedef HashSet<std::unique_ptr<Dummy>> OwnPtrSet; 91 typedef HashSet<std::unique_ptr<Dummy>> OwnPtrSet;
92 OwnPtrSet set; 92 OwnPtrSet set;
93 93
94 Dummy* ptr1 = new Dummy(deleted1); 94 Dummy* ptr1 = new Dummy(deleted1);
95 { 95 {
96 // AddResult in a separate scope to avoid assertion hit, 96 // AddResult in a separate scope to avoid assertion hit,
97 // since we modify the container further. 97 // since we modify the container further.
98 HashSet<std::unique_ptr<Dummy>>::AddResult res1 = 98 HashSet<std::unique_ptr<Dummy>>::AddResult res1 =
99 set.add(WTF::wrapUnique(ptr1)); 99 set.insert(WTF::wrapUnique(ptr1));
100 EXPECT_EQ(ptr1, res1.storedValue->get()); 100 EXPECT_EQ(ptr1, res1.storedValue->get());
101 } 101 }
102 102
103 EXPECT_FALSE(deleted1); 103 EXPECT_FALSE(deleted1);
104 EXPECT_EQ(1UL, set.size()); 104 EXPECT_EQ(1UL, set.size());
105 OwnPtrSet::iterator it1 = set.find(ptr1); 105 OwnPtrSet::iterator it1 = set.find(ptr1);
106 EXPECT_NE(set.end(), it1); 106 EXPECT_NE(set.end(), it1);
107 EXPECT_EQ(ptr1, (*it1).get()); 107 EXPECT_EQ(ptr1, (*it1).get());
108 108
109 Dummy* ptr2 = new Dummy(deleted2); 109 Dummy* ptr2 = new Dummy(deleted2);
110 { 110 {
111 HashSet<std::unique_ptr<Dummy>>::AddResult res2 = 111 HashSet<std::unique_ptr<Dummy>>::AddResult res2 =
112 set.add(WTF::wrapUnique(ptr2)); 112 set.insert(WTF::wrapUnique(ptr2));
113 EXPECT_EQ(res2.storedValue->get(), ptr2); 113 EXPECT_EQ(res2.storedValue->get(), ptr2);
114 } 114 }
115 115
116 EXPECT_FALSE(deleted2); 116 EXPECT_FALSE(deleted2);
117 EXPECT_EQ(2UL, set.size()); 117 EXPECT_EQ(2UL, set.size());
118 OwnPtrSet::iterator it2 = set.find(ptr2); 118 OwnPtrSet::iterator it2 = set.find(ptr2);
119 EXPECT_NE(set.end(), it2); 119 EXPECT_NE(set.end(), it2);
120 EXPECT_EQ(ptr2, (*it2).get()); 120 EXPECT_EQ(ptr2, (*it2).get());
121 121
122 set.remove(ptr1); 122 set.remove(ptr1);
123 EXPECT_TRUE(deleted1); 123 EXPECT_TRUE(deleted1);
124 124
125 set.clear(); 125 set.clear();
126 EXPECT_TRUE(deleted2); 126 EXPECT_TRUE(deleted2);
127 EXPECT_TRUE(set.isEmpty()); 127 EXPECT_TRUE(set.isEmpty());
128 128
129 deleted1 = false; 129 deleted1 = false;
130 deleted2 = false; 130 deleted2 = false;
131 { 131 {
132 OwnPtrSet set; 132 OwnPtrSet set;
133 set.add(WTF::makeUnique<Dummy>(deleted1)); 133 set.insert(WTF::makeUnique<Dummy>(deleted1));
134 set.add(WTF::makeUnique<Dummy>(deleted2)); 134 set.insert(WTF::makeUnique<Dummy>(deleted2));
135 } 135 }
136 EXPECT_TRUE(deleted1); 136 EXPECT_TRUE(deleted1);
137 EXPECT_TRUE(deleted2); 137 EXPECT_TRUE(deleted2);
138 138
139 deleted1 = false; 139 deleted1 = false;
140 deleted2 = false; 140 deleted2 = false;
141 std::unique_ptr<Dummy> ownPtr1; 141 std::unique_ptr<Dummy> ownPtr1;
142 std::unique_ptr<Dummy> ownPtr2; 142 std::unique_ptr<Dummy> ownPtr2;
143 ptr1 = new Dummy(deleted1); 143 ptr1 = new Dummy(deleted1);
144 ptr2 = new Dummy(deleted2); 144 ptr2 = new Dummy(deleted2);
145 { 145 {
146 OwnPtrSet set; 146 OwnPtrSet set;
147 set.add(WTF::wrapUnique(ptr1)); 147 set.insert(WTF::wrapUnique(ptr1));
148 set.add(WTF::wrapUnique(ptr2)); 148 set.insert(WTF::wrapUnique(ptr2));
149 ownPtr1 = set.take(ptr1); 149 ownPtr1 = set.take(ptr1);
150 EXPECT_EQ(1UL, set.size()); 150 EXPECT_EQ(1UL, set.size());
151 ownPtr2 = set.takeAny(); 151 ownPtr2 = set.takeAny();
152 EXPECT_TRUE(set.isEmpty()); 152 EXPECT_TRUE(set.isEmpty());
153 } 153 }
154 EXPECT_FALSE(deleted1); 154 EXPECT_FALSE(deleted1);
155 EXPECT_FALSE(deleted2); 155 EXPECT_FALSE(deleted2);
156 156
157 EXPECT_EQ(ptr1, ownPtr1.get()); 157 EXPECT_EQ(ptr1, ownPtr1.get());
158 EXPECT_EQ(ptr2, ownPtr2.get()); 158 EXPECT_EQ(ptr2, ownPtr2.get());
(...skipping 17 matching lines...) Expand all
176 bool& m_isDeleted; 176 bool& m_isDeleted;
177 }; 177 };
178 178
179 int DummyRefCounted::s_refInvokesCount = 0; 179 int DummyRefCounted::s_refInvokesCount = 0;
180 180
181 TEST(HashSetTest, HashSetRefPtr) { 181 TEST(HashSetTest, HashSetRefPtr) {
182 bool isDeleted = false; 182 bool isDeleted = false;
183 RefPtr<DummyRefCounted> ptr = adoptRef(new DummyRefCounted(isDeleted)); 183 RefPtr<DummyRefCounted> ptr = adoptRef(new DummyRefCounted(isDeleted));
184 EXPECT_EQ(0, DummyRefCounted::s_refInvokesCount); 184 EXPECT_EQ(0, DummyRefCounted::s_refInvokesCount);
185 HashSet<RefPtr<DummyRefCounted>> set; 185 HashSet<RefPtr<DummyRefCounted>> set;
186 set.add(ptr); 186 set.insert(ptr);
187 // Referenced only once (to store a copy in the container). 187 // Referenced only once (to store a copy in the container).
188 EXPECT_EQ(1, DummyRefCounted::s_refInvokesCount); 188 EXPECT_EQ(1, DummyRefCounted::s_refInvokesCount);
189 189
190 DummyRefCounted* rawPtr = ptr.get(); 190 DummyRefCounted* rawPtr = ptr.get();
191 191
192 EXPECT_TRUE(set.contains(rawPtr)); 192 EXPECT_TRUE(set.contains(rawPtr));
193 EXPECT_NE(set.end(), set.find(rawPtr)); 193 EXPECT_NE(set.end(), set.find(rawPtr));
194 EXPECT_TRUE(set.contains(ptr)); 194 EXPECT_TRUE(set.contains(ptr));
195 EXPECT_NE(set.end(), set.find(ptr)); 195 EXPECT_NE(set.end(), set.find(ptr));
196 196
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 template <> 257 template <>
258 struct DefaultHash<CountCopy> { 258 struct DefaultHash<CountCopy> {
259 using Hash = CountCopyHash; 259 using Hash = CountCopyHash;
260 }; 260 };
261 261
262 namespace { 262 namespace {
263 263
264 TEST(HashSetTest, MoveShouldNotMakeCopy) { 264 TEST(HashSetTest, MoveShouldNotMakeCopy) {
265 HashSet<CountCopy> set; 265 HashSet<CountCopy> set;
266 int counter = 0; 266 int counter = 0;
267 set.add(CountCopy(&counter)); 267 set.insert(CountCopy(&counter));
268 268
269 HashSet<CountCopy> other(set); 269 HashSet<CountCopy> other(set);
270 counter = 0; 270 counter = 0;
271 set = std::move(other); 271 set = std::move(other);
272 EXPECT_EQ(0, counter); 272 EXPECT_EQ(0, counter);
273 273
274 counter = 0; 274 counter = 0;
275 HashSet<CountCopy> yetAnother(std::move(set)); 275 HashSet<CountCopy> yetAnother(std::move(set));
276 EXPECT_EQ(0, counter); 276 EXPECT_EQ(0, counter);
277 } 277 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 struct DefaultHash<MoveOnly> { 344 struct DefaultHash<MoveOnly> {
345 using Hash = MoveOnlyHash; 345 using Hash = MoveOnlyHash;
346 }; 346 };
347 347
348 namespace { 348 namespace {
349 349
350 TEST(HashSetTest, MoveOnlyValue) { 350 TEST(HashSetTest, MoveOnlyValue) {
351 using TheSet = HashSet<MoveOnly>; 351 using TheSet = HashSet<MoveOnly>;
352 TheSet set; 352 TheSet set;
353 { 353 {
354 TheSet::AddResult addResult = set.add(MoveOnly(1, 1)); 354 TheSet::AddResult addResult = set.insert(MoveOnly(1, 1));
355 EXPECT_TRUE(addResult.isNewEntry); 355 EXPECT_TRUE(addResult.isNewEntry);
356 EXPECT_EQ(1, addResult.storedValue->value()); 356 EXPECT_EQ(1, addResult.storedValue->value());
357 EXPECT_EQ(1, addResult.storedValue->id()); 357 EXPECT_EQ(1, addResult.storedValue->id());
358 } 358 }
359 auto iter = set.find(MoveOnly(1)); 359 auto iter = set.find(MoveOnly(1));
360 ASSERT_TRUE(iter != set.end()); 360 ASSERT_TRUE(iter != set.end());
361 EXPECT_EQ(1, iter->value()); 361 EXPECT_EQ(1, iter->value());
362 362
363 iter = set.find(MoveOnly(2)); 363 iter = set.find(MoveOnly(2));
364 EXPECT_TRUE(iter == set.end()); 364 EXPECT_TRUE(iter == set.end());
365 365
366 for (int i = 2; i < 32; ++i) { 366 for (int i = 2; i < 32; ++i) {
367 TheSet::AddResult addResult = set.add(MoveOnly(i, i)); 367 TheSet::AddResult addResult = set.insert(MoveOnly(i, i));
368 EXPECT_TRUE(addResult.isNewEntry); 368 EXPECT_TRUE(addResult.isNewEntry);
369 EXPECT_EQ(i, addResult.storedValue->value()); 369 EXPECT_EQ(i, addResult.storedValue->value());
370 EXPECT_EQ(i, addResult.storedValue->id()); 370 EXPECT_EQ(i, addResult.storedValue->id());
371 } 371 }
372 372
373 iter = set.find(MoveOnly(1)); 373 iter = set.find(MoveOnly(1));
374 ASSERT_TRUE(iter != set.end()); 374 ASSERT_TRUE(iter != set.end());
375 EXPECT_EQ(1, iter->value()); 375 EXPECT_EQ(1, iter->value());
376 EXPECT_EQ(1, iter->id()); 376 EXPECT_EQ(1, iter->id());
377 377
378 iter = set.find(MoveOnly(7)); 378 iter = set.find(MoveOnly(7));
379 ASSERT_TRUE(iter != set.end()); 379 ASSERT_TRUE(iter != set.end());
380 EXPECT_EQ(7, iter->value()); 380 EXPECT_EQ(7, iter->value());
381 EXPECT_EQ(7, iter->id()); 381 EXPECT_EQ(7, iter->id());
382 382
383 { 383 {
384 TheSet::AddResult addResult = 384 TheSet::AddResult addResult =
385 set.add(MoveOnly(7, 777)); // With different ID for identification. 385 set.insert(MoveOnly(7, 777)); // With different ID for identification.
386 EXPECT_FALSE(addResult.isNewEntry); 386 EXPECT_FALSE(addResult.isNewEntry);
387 EXPECT_EQ(7, addResult.storedValue->value()); 387 EXPECT_EQ(7, addResult.storedValue->value());
388 EXPECT_EQ(7, addResult.storedValue->id()); 388 EXPECT_EQ(7, addResult.storedValue->id());
389 } 389 }
390 390
391 set.remove(MoveOnly(11)); 391 set.remove(MoveOnly(11));
392 iter = set.find(MoveOnly(11)); 392 iter = set.find(MoveOnly(11));
393 EXPECT_TRUE(iter == set.end()); 393 EXPECT_TRUE(iter == set.end());
394 394
395 MoveOnly thirteen(set.take(MoveOnly(13))); 395 MoveOnly thirteen(set.take(MoveOnly(13)));
396 EXPECT_EQ(13, thirteen.value()); 396 EXPECT_EQ(13, thirteen.value());
397 EXPECT_EQ(13, thirteen.id()); 397 EXPECT_EQ(13, thirteen.id());
398 iter = set.find(MoveOnly(13)); 398 iter = set.find(MoveOnly(13));
399 EXPECT_TRUE(iter == set.end()); 399 EXPECT_TRUE(iter == set.end());
400 400
401 set.clear(); 401 set.clear();
402 } 402 }
403 403
404 TEST(HashSetTest, UniquePtr) { 404 TEST(HashSetTest, UniquePtr) {
405 using Pointer = std::unique_ptr<int>; 405 using Pointer = std::unique_ptr<int>;
406 using Set = HashSet<Pointer>; 406 using Set = HashSet<Pointer>;
407 Set set; 407 Set set;
408 int* onePointer = new int(1); 408 int* onePointer = new int(1);
409 { 409 {
410 Set::AddResult addResult = set.add(Pointer(onePointer)); 410 Set::AddResult addResult = set.insert(Pointer(onePointer));
411 EXPECT_TRUE(addResult.isNewEntry); 411 EXPECT_TRUE(addResult.isNewEntry);
412 EXPECT_EQ(onePointer, addResult.storedValue->get()); 412 EXPECT_EQ(onePointer, addResult.storedValue->get());
413 EXPECT_EQ(1, **addResult.storedValue); 413 EXPECT_EQ(1, **addResult.storedValue);
414 } 414 }
415 auto iter = set.find(onePointer); 415 auto iter = set.find(onePointer);
416 ASSERT_TRUE(iter != set.end()); 416 ASSERT_TRUE(iter != set.end());
417 EXPECT_EQ(onePointer, iter->get()); 417 EXPECT_EQ(onePointer, iter->get());
418 418
419 Pointer nonexistent(new int(42)); 419 Pointer nonexistent(new int(42));
420 iter = set.find(nonexistent.get()); 420 iter = set.find(nonexistent.get());
421 EXPECT_TRUE(iter == set.end()); 421 EXPECT_TRUE(iter == set.end());
422 422
423 // Insert more to cause a rehash. 423 // Insert more to cause a rehash.
424 for (int i = 2; i < 32; ++i) { 424 for (int i = 2; i < 32; ++i) {
425 Set::AddResult addResult = set.add(Pointer(new int(i))); 425 Set::AddResult addResult = set.insert(Pointer(new int(i)));
426 EXPECT_TRUE(addResult.isNewEntry); 426 EXPECT_TRUE(addResult.isNewEntry);
427 EXPECT_EQ(i, **addResult.storedValue); 427 EXPECT_EQ(i, **addResult.storedValue);
428 } 428 }
429 429
430 iter = set.find(onePointer); 430 iter = set.find(onePointer);
431 ASSERT_TRUE(iter != set.end()); 431 ASSERT_TRUE(iter != set.end());
432 EXPECT_EQ(onePointer, iter->get()); 432 EXPECT_EQ(onePointer, iter->get());
433 433
434 Pointer one(set.take(onePointer)); 434 Pointer one(set.take(onePointer));
435 ASSERT_TRUE(one); 435 ASSERT_TRUE(one);
436 EXPECT_EQ(onePointer, one.get()); 436 EXPECT_EQ(onePointer, one.get());
437 437
438 Pointer empty(set.take(nonexistent.get())); 438 Pointer empty(set.take(nonexistent.get()));
439 EXPECT_TRUE(!empty); 439 EXPECT_TRUE(!empty);
440 440
441 iter = set.find(onePointer); 441 iter = set.find(onePointer);
442 EXPECT_TRUE(iter == set.end()); 442 EXPECT_TRUE(iter == set.end());
443 443
444 // Re-insert to the deleted slot. 444 // Re-insert to the deleted slot.
445 { 445 {
446 Set::AddResult addResult = set.add(std::move(one)); 446 Set::AddResult addResult = set.insert(std::move(one));
447 EXPECT_TRUE(addResult.isNewEntry); 447 EXPECT_TRUE(addResult.isNewEntry);
448 EXPECT_EQ(onePointer, addResult.storedValue->get()); 448 EXPECT_EQ(onePointer, addResult.storedValue->get());
449 EXPECT_EQ(1, **addResult.storedValue); 449 EXPECT_EQ(1, **addResult.storedValue);
450 } 450 }
451 } 451 }
452 452
453 bool isOneTwoThree(const HashSet<int>& set) { 453 bool isOneTwoThree(const HashSet<int>& set) {
454 return set.size() == 3 && set.contains(1) && set.contains(2) && 454 return set.size() == 3 && set.contains(1) && set.contains(2) &&
455 set.contains(3); 455 set.contains(3);
456 } 456 }
(...skipping 10 matching lines...) Expand all
467 EXPECT_EQ(1u, one.size()); 467 EXPECT_EQ(1u, one.size());
468 EXPECT_TRUE(one.contains(1)); 468 EXPECT_TRUE(one.contains(1));
469 469
470 HashSet<int> oneTwoThree({1, 2, 3}); 470 HashSet<int> oneTwoThree({1, 2, 3});
471 EXPECT_EQ(3u, oneTwoThree.size()); 471 EXPECT_EQ(3u, oneTwoThree.size());
472 EXPECT_TRUE(oneTwoThree.contains(1)); 472 EXPECT_TRUE(oneTwoThree.contains(1));
473 EXPECT_TRUE(oneTwoThree.contains(2)); 473 EXPECT_TRUE(oneTwoThree.contains(2));
474 EXPECT_TRUE(oneTwoThree.contains(3)); 474 EXPECT_TRUE(oneTwoThree.contains(3));
475 475
476 // Put some jank so we can check if the assignments later can clear them. 476 // Put some jank so we can check if the assignments later can clear them.
477 empty.add(9999); 477 empty.insert(9999);
478 one.add(9999); 478 one.insert(9999);
479 oneTwoThree.add(9999); 479 oneTwoThree.insert(9999);
480 480
481 empty = {}; 481 empty = {};
482 EXPECT_TRUE(empty.isEmpty()); 482 EXPECT_TRUE(empty.isEmpty());
483 483
484 one = {1}; 484 one = {1};
485 EXPECT_EQ(1u, one.size()); 485 EXPECT_EQ(1u, one.size());
486 EXPECT_TRUE(one.contains(1)); 486 EXPECT_TRUE(one.contains(1));
487 487
488 oneTwoThree = {1, 2, 3}; 488 oneTwoThree = {1, 2, 3};
489 EXPECT_EQ(3u, oneTwoThree.size()); 489 EXPECT_EQ(3u, oneTwoThree.size());
490 EXPECT_TRUE(oneTwoThree.contains(1)); 490 EXPECT_TRUE(oneTwoThree.contains(1));
491 EXPECT_TRUE(oneTwoThree.contains(2)); 491 EXPECT_TRUE(oneTwoThree.contains(2));
492 EXPECT_TRUE(oneTwoThree.contains(3)); 492 EXPECT_TRUE(oneTwoThree.contains(3));
493 493
494 oneTwoThree = {3, 1, 1, 2, 1, 1, 3}; 494 oneTwoThree = {3, 1, 1, 2, 1, 1, 3};
495 EXPECT_EQ(3u, oneTwoThree.size()); 495 EXPECT_EQ(3u, oneTwoThree.size());
496 EXPECT_TRUE(oneTwoThree.contains(1)); 496 EXPECT_TRUE(oneTwoThree.contains(1));
497 EXPECT_TRUE(oneTwoThree.contains(2)); 497 EXPECT_TRUE(oneTwoThree.contains(2));
498 EXPECT_TRUE(oneTwoThree.contains(3)); 498 EXPECT_TRUE(oneTwoThree.contains(3));
499 499
500 // Other ways of construction: as a function parameter and in a return 500 // Other ways of construction: as a function parameter and in a return
501 // statement. 501 // statement.
502 EXPECT_TRUE(isOneTwoThree({1, 2, 3})); 502 EXPECT_TRUE(isOneTwoThree({1, 2, 3}));
503 EXPECT_TRUE(isOneTwoThree(returnOneTwoThree())); 503 EXPECT_TRUE(isOneTwoThree(returnOneTwoThree()));
504 } 504 }
505 505
506 } // anonymous namespace 506 } // anonymous namespace
507 507
508 } // namespace WTF 508 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/DequeTest.cpp ('k') | third_party/WebKit/Source/wtf/VectorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698