| OLD | NEW |
| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 list.removeFirst(); | 59 list.removeFirst(); |
| 60 EXPECT_EQ(2, list.first()); | 60 EXPECT_EQ(2, list.first()); |
| 61 | 61 |
| 62 list.removeFirst(); | 62 list.removeFirst(); |
| 63 EXPECT_TRUE(list.isEmpty()); | 63 EXPECT_TRUE(list.isEmpty()); |
| 64 } | 64 } |
| 65 | 65 |
| 66 TEST(ListHashSetTest, RemoveFirst) | 66 TEST(ListHashSetTest, RemoveFirst) |
| 67 { | 67 { |
| 68 removeFirstHelper<ListHashSet<int> >(); | 68 removeFirstHelper<ListHashSet<int>>(); |
| 69 removeFirstHelper<ListHashSet<int, 1> >(); | 69 removeFirstHelper<ListHashSet<int, 1>>(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 TEST(LinkedHashSetTest, RemoveFirst) | 72 TEST(LinkedHashSetTest, RemoveFirst) |
| 73 { | 73 { |
| 74 removeFirstHelper<LinkedHashSet<int> >(); | 74 removeFirstHelper<LinkedHashSet<int>>(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 template<typename Set> | 77 template<typename Set> |
| 78 void appendOrMoveToLastNewItems() | 78 void appendOrMoveToLastNewItems() |
| 79 { | 79 { |
| 80 Set list; | 80 Set list; |
| 81 typename Set::AddResult result = list.appendOrMoveToLast(1); | 81 typename Set::AddResult result = list.appendOrMoveToLast(1); |
| 82 EXPECT_TRUE(result.isNewEntry); | 82 EXPECT_TRUE(result.isNewEntry); |
| 83 result = list.add(2); | 83 result = list.add(2); |
| 84 EXPECT_TRUE(result.isNewEntry); | 84 EXPECT_TRUE(result.isNewEntry); |
| 85 result = list.appendOrMoveToLast(3); | 85 result = list.appendOrMoveToLast(3); |
| 86 EXPECT_TRUE(result.isNewEntry); | 86 EXPECT_TRUE(result.isNewEntry); |
| 87 | 87 |
| 88 EXPECT_EQ(list.size(), 3UL); | 88 EXPECT_EQ(list.size(), 3UL); |
| 89 | 89 |
| 90 // The list should be in order 1, 2, 3. | 90 // The list should be in order 1, 2, 3. |
| 91 typename Set::iterator iterator = list.begin(); | 91 typename Set::iterator iterator = list.begin(); |
| 92 EXPECT_EQ(1, *iterator); | 92 EXPECT_EQ(1, *iterator); |
| 93 ++iterator; | 93 ++iterator; |
| 94 EXPECT_EQ(2, *iterator); | 94 EXPECT_EQ(2, *iterator); |
| 95 ++iterator; | 95 ++iterator; |
| 96 EXPECT_EQ(3, *iterator); | 96 EXPECT_EQ(3, *iterator); |
| 97 ++iterator; | 97 ++iterator; |
| 98 } | 98 } |
| 99 | 99 |
| 100 TEST(ListHashSetTest, AppendOrMoveToLastNewItems) | 100 TEST(ListHashSetTest, AppendOrMoveToLastNewItems) |
| 101 { | 101 { |
| 102 appendOrMoveToLastNewItems<ListHashSet<int> >(); | 102 appendOrMoveToLastNewItems<ListHashSet<int>>(); |
| 103 appendOrMoveToLastNewItems<ListHashSet<int, 1> >(); | 103 appendOrMoveToLastNewItems<ListHashSet<int, 1>>(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 TEST(LinkedHashSetTest, AppendOrMoveToLastNewItems) | 106 TEST(LinkedHashSetTest, AppendOrMoveToLastNewItems) |
| 107 { | 107 { |
| 108 appendOrMoveToLastNewItems<LinkedHashSet<int> >(); | 108 appendOrMoveToLastNewItems<LinkedHashSet<int>>(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 template<typename Set> | 111 template<typename Set> |
| 112 void appendOrMoveToLastWithDuplicates() | 112 void appendOrMoveToLastWithDuplicates() |
| 113 { | 113 { |
| 114 Set list; | 114 Set list; |
| 115 | 115 |
| 116 // Add a single element twice. | 116 // Add a single element twice. |
| 117 typename Set::AddResult result = list.add(1); | 117 typename Set::AddResult result = list.add(1); |
| 118 EXPECT_TRUE(result.isNewEntry); | 118 EXPECT_TRUE(result.isNewEntry); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 143 EXPECT_EQ(3, *iterator); | 143 EXPECT_EQ(3, *iterator); |
| 144 ++iterator; | 144 ++iterator; |
| 145 EXPECT_EQ(2, *iterator); | 145 EXPECT_EQ(2, *iterator); |
| 146 ++iterator; | 146 ++iterator; |
| 147 EXPECT_EQ(1, *iterator); | 147 EXPECT_EQ(1, *iterator); |
| 148 ++iterator; | 148 ++iterator; |
| 149 } | 149 } |
| 150 | 150 |
| 151 TEST(ListHashSetTest, AppendOrMoveToLastWithDuplicates) | 151 TEST(ListHashSetTest, AppendOrMoveToLastWithDuplicates) |
| 152 { | 152 { |
| 153 appendOrMoveToLastWithDuplicates<ListHashSet<int> >(); | 153 appendOrMoveToLastWithDuplicates<ListHashSet<int>>(); |
| 154 appendOrMoveToLastWithDuplicates<ListHashSet<int, 1> >(); | 154 appendOrMoveToLastWithDuplicates<ListHashSet<int, 1>>(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 TEST(LinkedHashSetTest, AppendOrMoveToLastWithDuplicates) | 157 TEST(LinkedHashSetTest, AppendOrMoveToLastWithDuplicates) |
| 158 { | 158 { |
| 159 appendOrMoveToLastWithDuplicates<LinkedHashSet<int> >(); | 159 appendOrMoveToLastWithDuplicates<LinkedHashSet<int>>(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 template<typename Set> | 162 template<typename Set> |
| 163 void prependOrMoveToFirstNewItems() | 163 void prependOrMoveToFirstNewItems() |
| 164 { | 164 { |
| 165 Set list; | 165 Set list; |
| 166 typename Set::AddResult result = list.prependOrMoveToFirst(1); | 166 typename Set::AddResult result = list.prependOrMoveToFirst(1); |
| 167 EXPECT_TRUE(result.isNewEntry); | 167 EXPECT_TRUE(result.isNewEntry); |
| 168 result = list.add(2); | 168 result = list.add(2); |
| 169 EXPECT_TRUE(result.isNewEntry); | 169 EXPECT_TRUE(result.isNewEntry); |
| 170 result = list.prependOrMoveToFirst(3); | 170 result = list.prependOrMoveToFirst(3); |
| 171 EXPECT_TRUE(result.isNewEntry); | 171 EXPECT_TRUE(result.isNewEntry); |
| 172 | 172 |
| 173 EXPECT_EQ(list.size(), 3UL); | 173 EXPECT_EQ(list.size(), 3UL); |
| 174 | 174 |
| 175 // The list should be in order 3, 1, 2. | 175 // The list should be in order 3, 1, 2. |
| 176 typename Set::iterator iterator = list.begin(); | 176 typename Set::iterator iterator = list.begin(); |
| 177 EXPECT_EQ(3, *iterator); | 177 EXPECT_EQ(3, *iterator); |
| 178 ++iterator; | 178 ++iterator; |
| 179 EXPECT_EQ(1, *iterator); | 179 EXPECT_EQ(1, *iterator); |
| 180 ++iterator; | 180 ++iterator; |
| 181 EXPECT_EQ(2, *iterator); | 181 EXPECT_EQ(2, *iterator); |
| 182 ++iterator; | 182 ++iterator; |
| 183 } | 183 } |
| 184 | 184 |
| 185 TEST(ListHashSetTest, PrependOrMoveToFirstNewItems) | 185 TEST(ListHashSetTest, PrependOrMoveToFirstNewItems) |
| 186 { | 186 { |
| 187 prependOrMoveToFirstNewItems<ListHashSet<int> >(); | 187 prependOrMoveToFirstNewItems<ListHashSet<int>>(); |
| 188 prependOrMoveToFirstNewItems<ListHashSet<int, 1> >(); | 188 prependOrMoveToFirstNewItems<ListHashSet<int, 1>>(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 TEST(LinkedHashSetTest, PrependOrMoveToFirstNewItems) | 191 TEST(LinkedHashSetTest, PrependOrMoveToFirstNewItems) |
| 192 { | 192 { |
| 193 prependOrMoveToFirstNewItems<LinkedHashSet<int> >(); | 193 prependOrMoveToFirstNewItems<LinkedHashSet<int>>(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 template<typename Set> | 196 template<typename Set> |
| 197 void prependOrMoveToLastWithDuplicates() | 197 void prependOrMoveToLastWithDuplicates() |
| 198 { | 198 { |
| 199 Set list; | 199 Set list; |
| 200 | 200 |
| 201 // Add a single element twice. | 201 // Add a single element twice. |
| 202 typename Set::AddResult result = list.add(1); | 202 typename Set::AddResult result = list.add(1); |
| 203 EXPECT_TRUE(result.isNewEntry); | 203 EXPECT_TRUE(result.isNewEntry); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 228 EXPECT_EQ(3, *iterator); | 228 EXPECT_EQ(3, *iterator); |
| 229 ++iterator; | 229 ++iterator; |
| 230 EXPECT_EQ(2, *iterator); | 230 EXPECT_EQ(2, *iterator); |
| 231 ++iterator; | 231 ++iterator; |
| 232 EXPECT_EQ(1, *iterator); | 232 EXPECT_EQ(1, *iterator); |
| 233 ++iterator; | 233 ++iterator; |
| 234 } | 234 } |
| 235 | 235 |
| 236 TEST(ListHashSetTest, PrependOrMoveToLastWithDuplicates) | 236 TEST(ListHashSetTest, PrependOrMoveToLastWithDuplicates) |
| 237 { | 237 { |
| 238 prependOrMoveToLastWithDuplicates<ListHashSet<int> >(); | 238 prependOrMoveToLastWithDuplicates<ListHashSet<int>>(); |
| 239 prependOrMoveToLastWithDuplicates<ListHashSet<int, 1> >(); | 239 prependOrMoveToLastWithDuplicates<ListHashSet<int, 1>>(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 TEST(LinkedHashSetTest, PrependOrMoveToLastWithDuplicates) | 242 TEST(LinkedHashSetTest, PrependOrMoveToLastWithDuplicates) |
| 243 { | 243 { |
| 244 prependOrMoveToLastWithDuplicates<LinkedHashSet<int> >(); | 244 prependOrMoveToLastWithDuplicates<LinkedHashSet<int>>(); |
| 245 } | 245 } |
| 246 | 246 |
| 247 class DummyRefCounted: public WTF::RefCounted<DummyRefCounted> { | 247 class DummyRefCounted: public WTF::RefCounted<DummyRefCounted> { |
| 248 public: | 248 public: |
| 249 DummyRefCounted(bool& isDeleted) : m_isDeleted(isDeleted) { m_isDeleted = fa
lse; } | 249 DummyRefCounted(bool& isDeleted) : m_isDeleted(isDeleted) { m_isDeleted = fa
lse; } |
| 250 ~DummyRefCounted() { m_isDeleted = true; } | 250 ~DummyRefCounted() { m_isDeleted = true; } |
| 251 void ref() | 251 void ref() |
| 252 { | 252 { |
| 253 WTF::RefCounted<DummyRefCounted>::ref(); | 253 WTF::RefCounted<DummyRefCounted>::ref(); |
| 254 ++m_refInvokesCount; | 254 ++m_refInvokesCount; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 EXPECT_EQ(1, DummyRefCounted::m_refInvokesCount); | 288 EXPECT_EQ(1, DummyRefCounted::m_refInvokesCount); |
| 289 | 289 |
| 290 set.remove(rawPtr); | 290 set.remove(rawPtr); |
| 291 EXPECT_TRUE(isDeleted); | 291 EXPECT_TRUE(isDeleted); |
| 292 | 292 |
| 293 EXPECT_EQ(1, DummyRefCounted::m_refInvokesCount); | 293 EXPECT_EQ(1, DummyRefCounted::m_refInvokesCount); |
| 294 } | 294 } |
| 295 | 295 |
| 296 TEST(ListHashSetTest, WithRefPtr) | 296 TEST(ListHashSetTest, WithRefPtr) |
| 297 { | 297 { |
| 298 withRefPtr<ListHashSet<RefPtr<DummyRefCounted> > >(); | 298 withRefPtr<ListHashSet<RefPtr<DummyRefCounted>>>(); |
| 299 withRefPtr<ListHashSet<RefPtr<DummyRefCounted>, 1> >(); | 299 withRefPtr<ListHashSet<RefPtr<DummyRefCounted>, 1>>(); |
| 300 } | 300 } |
| 301 | 301 |
| 302 TEST(LinkedHashSetTest, WithRefPtr) | 302 TEST(LinkedHashSetTest, WithRefPtr) |
| 303 { | 303 { |
| 304 withRefPtr<LinkedHashSet<RefPtr<DummyRefCounted> > >(); | 304 withRefPtr<LinkedHashSet<RefPtr<DummyRefCounted>>>(); |
| 305 } | 305 } |
| 306 | 306 |
| 307 template<typename Set, typename SetRef, typename Iterator> | 307 template<typename Set, typename SetRef, typename Iterator> |
| 308 void findHelper() | 308 void findHelper() |
| 309 { | 309 { |
| 310 Set set; | 310 Set set; |
| 311 set.add(-1); | 311 set.add(-1); |
| 312 set.add(0); | 312 set.add(0); |
| 313 set.add(1); | 313 set.add(1); |
| 314 set.add(2); | 314 set.add(2); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 EXPECT_EQ(103, set.first()); | 379 EXPECT_EQ(103, set.first()); |
| 380 if (!canModifyWhileIterating) | 380 if (!canModifyWhileIterating) |
| 381 it = set.find(1); | 381 it = set.find(1); |
| 382 ++it; | 382 ++it; |
| 383 EXPECT_EQ(42, *it); | 383 EXPECT_EQ(42, *it); |
| 384 EXPECT_EQ(7u, set.size()); | 384 EXPECT_EQ(7u, set.size()); |
| 385 } | 385 } |
| 386 | 386 |
| 387 TEST(ListHashSetTest, InsertBefore) | 387 TEST(ListHashSetTest, InsertBefore) |
| 388 { | 388 { |
| 389 insertBeforeHelper<ListHashSet<int> >(true); | 389 insertBeforeHelper<ListHashSet<int>>(true); |
| 390 insertBeforeHelper<ListHashSet<int, 1> >(true); | 390 insertBeforeHelper<ListHashSet<int, 1>>(true); |
| 391 } | 391 } |
| 392 | 392 |
| 393 TEST(LinkedHashSetTest, InsertBefore) | 393 TEST(LinkedHashSetTest, InsertBefore) |
| 394 { | 394 { |
| 395 insertBeforeHelper<LinkedHashSet<int> >(false); | 395 insertBeforeHelper<LinkedHashSet<int>>(false); |
| 396 } | 396 } |
| 397 | 397 |
| 398 template<typename Set> | 398 template<typename Set> |
| 399 void addReturnIterator(bool canModifyWhileIterating) | 399 void addReturnIterator(bool canModifyWhileIterating) |
| 400 { | 400 { |
| 401 Set set; | 401 Set set; |
| 402 set.add(-1); | 402 set.add(-1); |
| 403 set.add(0); | 403 set.add(0); |
| 404 set.add(1); | 404 set.add(1); |
| 405 set.add(2); | 405 set.add(2); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 EXPECT_EQ(6u, set.size()); | 437 EXPECT_EQ(6u, set.size()); |
| 438 it = set.addReturnIterator(5); | 438 it = set.addReturnIterator(5); |
| 439 EXPECT_EQ(7u, set.size()); | 439 EXPECT_EQ(7u, set.size()); |
| 440 set.remove(it); | 440 set.remove(it); |
| 441 EXPECT_EQ(6u, set.size()); | 441 EXPECT_EQ(6u, set.size()); |
| 442 EXPECT_EQ(4, set.last()); | 442 EXPECT_EQ(4, set.last()); |
| 443 } | 443 } |
| 444 | 444 |
| 445 TEST(ListHashSetTest, AddReturnIterator) | 445 TEST(ListHashSetTest, AddReturnIterator) |
| 446 { | 446 { |
| 447 addReturnIterator<ListHashSet<int> >(true); | 447 addReturnIterator<ListHashSet<int>>(true); |
| 448 addReturnIterator<ListHashSet<int, 1> >(true); | 448 addReturnIterator<ListHashSet<int, 1>>(true); |
| 449 } | 449 } |
| 450 | 450 |
| 451 TEST(LinkedHashSetTest, AddReturnIterator) | 451 TEST(LinkedHashSetTest, AddReturnIterator) |
| 452 { | 452 { |
| 453 addReturnIterator<LinkedHashSet<int> >(false); | 453 addReturnIterator<LinkedHashSet<int>>(false); |
| 454 } | 454 } |
| 455 | 455 |
| 456 template<typename Set> | 456 template<typename Set> |
| 457 void excerciseValuePeekInType() | 457 void excerciseValuePeekInType() |
| 458 { | 458 { |
| 459 Set set; | 459 Set set; |
| 460 bool isDeleted = false; | 460 bool isDeleted = false; |
| 461 bool isDeleted2 = false; | 461 bool isDeleted2 = false; |
| 462 | 462 |
| 463 RefPtr<DummyRefCounted> ptr = adoptRef(new DummyRefCounted(isDeleted)); | 463 RefPtr<DummyRefCounted> ptr = adoptRef(new DummyRefCounted(isDeleted)); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 485 | 485 |
| 486 EXPECT_FALSE(isDeleted2); | 486 EXPECT_FALSE(isDeleted2); |
| 487 set.removeFirst(); | 487 set.removeFirst(); |
| 488 EXPECT_TRUE(isDeleted2); | 488 EXPECT_TRUE(isDeleted2); |
| 489 | 489 |
| 490 EXPECT_EQ(0u, set.size()); | 490 EXPECT_EQ(0u, set.size()); |
| 491 } | 491 } |
| 492 | 492 |
| 493 TEST(ListHashSetTest, ExcerciseValuePeekInType) | 493 TEST(ListHashSetTest, ExcerciseValuePeekInType) |
| 494 { | 494 { |
| 495 excerciseValuePeekInType<ListHashSet<RefPtr<DummyRefCounted> > >(); | 495 excerciseValuePeekInType<ListHashSet<RefPtr<DummyRefCounted>>>(); |
| 496 excerciseValuePeekInType<ListHashSet<RefPtr<DummyRefCounted>, 1> >(); | 496 excerciseValuePeekInType<ListHashSet<RefPtr<DummyRefCounted>, 1>>(); |
| 497 } | 497 } |
| 498 | 498 |
| 499 TEST(LinkedHashSetTest, ExcerciseValuePeekInType) | 499 TEST(LinkedHashSetTest, ExcerciseValuePeekInType) |
| 500 { | 500 { |
| 501 excerciseValuePeekInType<LinkedHashSet<RefPtr<DummyRefCounted> > >(); | 501 excerciseValuePeekInType<LinkedHashSet<RefPtr<DummyRefCounted>>>(); |
| 502 } | 502 } |
| 503 | 503 |
| 504 struct Simple { | 504 struct Simple { |
| 505 Simple(int value) : m_value(value) { }; | 505 Simple(int value) : m_value(value) { }; |
| 506 int m_value; | 506 int m_value; |
| 507 }; | 507 }; |
| 508 | 508 |
| 509 struct Complicated { | 509 struct Complicated { |
| 510 Complicated(int value) : m_simple(value) | 510 Complicated(int value) : m_simple(value) |
| 511 { | 511 { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 EXPECT_NE(constIterator, constSet.end()); | 556 EXPECT_NE(constIterator, constSet.end()); |
| 557 EXPECT_EQ(baseLine, Complicated::s_objectsConstructed); | 557 EXPECT_EQ(baseLine, Complicated::s_objectsConstructed); |
| 558 | 558 |
| 559 constIterator = constSet.template find<ComplexityTranslator>(Simple(103)); | 559 constIterator = constSet.template find<ComplexityTranslator>(Simple(103)); |
| 560 EXPECT_EQ(constIterator, constSet.end()); | 560 EXPECT_EQ(constIterator, constSet.end()); |
| 561 EXPECT_EQ(baseLine, Complicated::s_objectsConstructed); | 561 EXPECT_EQ(baseLine, Complicated::s_objectsConstructed); |
| 562 } | 562 } |
| 563 | 563 |
| 564 TEST(ListHashSetTest, ComplexityTranslator) | 564 TEST(ListHashSetTest, ComplexityTranslator) |
| 565 { | 565 { |
| 566 translatorTest<ListHashSet<Complicated, 256, ComplicatedHashFunctions> >(); | 566 translatorTest<ListHashSet<Complicated, 256, ComplicatedHashFunctions>>(); |
| 567 translatorTest<ListHashSet<Complicated, 1, ComplicatedHashFunctions> >(); | 567 translatorTest<ListHashSet<Complicated, 1, ComplicatedHashFunctions>>(); |
| 568 } | 568 } |
| 569 | 569 |
| 570 TEST(LinkedHashSetTest, ComplexityTranslator) | 570 TEST(LinkedHashSetTest, ComplexityTranslator) |
| 571 { | 571 { |
| 572 translatorTest<LinkedHashSet<Complicated, ComplicatedHashFunctions> >(); | 572 translatorTest<LinkedHashSet<Complicated, ComplicatedHashFunctions>>(); |
| 573 } | 573 } |
| 574 | 574 |
| 575 struct Dummy { | 575 struct Dummy { |
| 576 Dummy(bool& deleted) : deleted(deleted) { } | 576 Dummy(bool& deleted) : deleted(deleted) { } |
| 577 | 577 |
| 578 ~Dummy() | 578 ~Dummy() |
| 579 { | 579 { |
| 580 deleted = true; | 580 deleted = true; |
| 581 } | 581 } |
| 582 | 582 |
| 583 bool& deleted; | 583 bool& deleted; |
| 584 }; | 584 }; |
| 585 | 585 |
| 586 TEST(ListHashSetTest, WithOwnPtr) | 586 TEST(ListHashSetTest, WithOwnPtr) |
| 587 { | 587 { |
| 588 bool deleted1 = false, deleted2 = false; | 588 bool deleted1 = false, deleted2 = false; |
| 589 | 589 |
| 590 typedef ListHashSet<OwnPtr<Dummy> > OwnPtrSet; | 590 typedef ListHashSet<OwnPtr<Dummy>> OwnPtrSet; |
| 591 OwnPtrSet set; | 591 OwnPtrSet set; |
| 592 | 592 |
| 593 Dummy* ptr1 = new Dummy(deleted1); | 593 Dummy* ptr1 = new Dummy(deleted1); |
| 594 { | 594 { |
| 595 // AddResult in a separate scope to avoid assertion hit, | 595 // AddResult in a separate scope to avoid assertion hit, |
| 596 // since we modify the container further. | 596 // since we modify the container further. |
| 597 OwnPtrSet::AddResult res1 = set.add(adoptPtr(ptr1)); | 597 OwnPtrSet::AddResult res1 = set.add(adoptPtr(ptr1)); |
| 598 EXPECT_EQ(res1.storedValue->m_value.get(), ptr1); | 598 EXPECT_EQ(res1.storedValue->m_value.get(), ptr1); |
| 599 } | 599 } |
| 600 | 600 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 ++i; | 703 ++i; |
| 704 EXPECT_EQ(*it1, i + 1); | 704 EXPECT_EQ(*it1, i + 1); |
| 705 EXPECT_EQ(*it2, num - i); | 705 EXPECT_EQ(*it2, num - i); |
| 706 } | 706 } |
| 707 EXPECT_EQ(it1, set0.end()); | 707 EXPECT_EQ(it1, set0.end()); |
| 708 EXPECT_EQ(it2, set1.end()); | 708 EXPECT_EQ(it2, set1.end()); |
| 709 } | 709 } |
| 710 | 710 |
| 711 TEST(ListHashSetTest, Swap) | 711 TEST(ListHashSetTest, Swap) |
| 712 { | 712 { |
| 713 swapTestHelper<ListHashSet<int> >(); | 713 swapTestHelper<ListHashSet<int>>(); |
| 714 } | 714 } |
| 715 | 715 |
| 716 TEST(LinkedHashSetTest, Swap) | 716 TEST(LinkedHashSetTest, Swap) |
| 717 { | 717 { |
| 718 swapTestHelper<LinkedHashSet<int> >(); | 718 swapTestHelper<LinkedHashSet<int>>(); |
| 719 } | 719 } |
| 720 | 720 |
| 721 } // namespace | 721 } // namespace |
| OLD | NEW |