| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 TYPED_TEST(ListOrLinkedHashSetTest, RemoveFirst) { | 48 TYPED_TEST(ListOrLinkedHashSetTest, RemoveFirst) { |
| 49 using Set = TypeParam; | 49 using Set = TypeParam; |
| 50 Set list; | 50 Set list; |
| 51 list.insert(-1); | 51 list.insert(-1); |
| 52 list.insert(0); | 52 list.insert(0); |
| 53 list.insert(1); | 53 list.insert(1); |
| 54 list.insert(2); | 54 list.insert(2); |
| 55 list.insert(3); | 55 list.insert(3); |
| 56 | 56 |
| 57 EXPECT_EQ(-1, list.front()); | 57 EXPECT_EQ(-1, list.front()); |
| 58 EXPECT_EQ(3, list.last()); | 58 EXPECT_EQ(3, list.back()); |
| 59 | 59 |
| 60 list.removeFirst(); | 60 list.removeFirst(); |
| 61 EXPECT_EQ(0, list.front()); | 61 EXPECT_EQ(0, list.front()); |
| 62 | 62 |
| 63 list.removeLast(); | 63 list.removeLast(); |
| 64 EXPECT_EQ(2, list.last()); | 64 EXPECT_EQ(2, list.back()); |
| 65 | 65 |
| 66 list.removeFirst(); | 66 list.removeFirst(); |
| 67 EXPECT_EQ(1, list.front()); | 67 EXPECT_EQ(1, list.front()); |
| 68 | 68 |
| 69 list.removeFirst(); | 69 list.removeFirst(); |
| 70 EXPECT_EQ(2, list.front()); | 70 EXPECT_EQ(2, list.front()); |
| 71 | 71 |
| 72 list.removeFirst(); | 72 list.removeFirst(); |
| 73 EXPECT_TRUE(list.isEmpty()); | 73 EXPECT_TRUE(list.isEmpty()); |
| 74 } | 74 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 104 EXPECT_TRUE(result.isNewEntry); | 104 EXPECT_TRUE(result.isNewEntry); |
| 105 result = list.appendOrMoveToLast(1); | 105 result = list.appendOrMoveToLast(1); |
| 106 EXPECT_FALSE(result.isNewEntry); | 106 EXPECT_FALSE(result.isNewEntry); |
| 107 EXPECT_EQ(1UL, list.size()); | 107 EXPECT_EQ(1UL, list.size()); |
| 108 | 108 |
| 109 list.insert(2); | 109 list.insert(2); |
| 110 list.insert(3); | 110 list.insert(3); |
| 111 EXPECT_EQ(3UL, list.size()); | 111 EXPECT_EQ(3UL, list.size()); |
| 112 | 112 |
| 113 // Appending 2 move it to the end. | 113 // Appending 2 move it to the end. |
| 114 EXPECT_EQ(3, list.last()); | 114 EXPECT_EQ(3, list.back()); |
| 115 result = list.appendOrMoveToLast(2); | 115 result = list.appendOrMoveToLast(2); |
| 116 EXPECT_FALSE(result.isNewEntry); | 116 EXPECT_FALSE(result.isNewEntry); |
| 117 EXPECT_EQ(2, list.last()); | 117 EXPECT_EQ(2, list.back()); |
| 118 | 118 |
| 119 // Inverse the list by moving each element to end end. | 119 // Inverse the list by moving each element to end end. |
| 120 result = list.appendOrMoveToLast(3); | 120 result = list.appendOrMoveToLast(3); |
| 121 EXPECT_FALSE(result.isNewEntry); | 121 EXPECT_FALSE(result.isNewEntry); |
| 122 result = list.appendOrMoveToLast(2); | 122 result = list.appendOrMoveToLast(2); |
| 123 EXPECT_FALSE(result.isNewEntry); | 123 EXPECT_FALSE(result.isNewEntry); |
| 124 result = list.appendOrMoveToLast(1); | 124 result = list.appendOrMoveToLast(1); |
| 125 EXPECT_FALSE(result.isNewEntry); | 125 EXPECT_FALSE(result.isNewEntry); |
| 126 EXPECT_EQ(3UL, list.size()); | 126 EXPECT_EQ(3UL, list.size()); |
| 127 | 127 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 set.insertBefore(it, 0); | 309 set.insertBefore(it, 0); |
| 310 set.insertBefore(it, 1); | 310 set.insertBefore(it, 1); |
| 311 set.insertBefore(it, 2); | 311 set.insertBefore(it, 2); |
| 312 set.insertBefore(it, 3); | 312 set.insertBefore(it, 3); |
| 313 } | 313 } |
| 314 EXPECT_EQ(6u, set.size()); | 314 EXPECT_EQ(6u, set.size()); |
| 315 it = set.addReturnIterator(5); | 315 it = set.addReturnIterator(5); |
| 316 EXPECT_EQ(7u, set.size()); | 316 EXPECT_EQ(7u, set.size()); |
| 317 set.remove(it); | 317 set.remove(it); |
| 318 EXPECT_EQ(6u, set.size()); | 318 EXPECT_EQ(6u, set.size()); |
| 319 EXPECT_EQ(4, set.last()); | 319 EXPECT_EQ(4, set.back()); |
| 320 } | 320 } |
| 321 | 321 |
| 322 TYPED_TEST(ListOrLinkedHashSetTest, Swap) { | 322 TYPED_TEST(ListOrLinkedHashSetTest, Swap) { |
| 323 using Set = TypeParam; | 323 using Set = TypeParam; |
| 324 int num = 10; | 324 int num = 10; |
| 325 Set set0; | 325 Set set0; |
| 326 Set set1; | 326 Set set1; |
| 327 Set set2; | 327 Set set2; |
| 328 for (int i = 0; i < num; ++i) { | 328 for (int i = 0; i < num; ++i) { |
| 329 set1.insert(i + 1); | 329 set1.insert(i + 1); |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 | 813 |
| 814 // ... but they don't have any pass-out (like take()) methods. | 814 // ... but they don't have any pass-out (like take()) methods. |
| 815 | 815 |
| 816 set.remove(MoveOnly(3)); | 816 set.remove(MoveOnly(3)); |
| 817 set.clear(); | 817 set.clear(); |
| 818 } | 818 } |
| 819 | 819 |
| 820 } // anonymous namespace | 820 } // anonymous namespace |
| 821 | 821 |
| 822 } // namespace WTF | 822 } // namespace WTF |
| OLD | NEW |