| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 #include "platform/globals.h" | 6 #include "platform/globals.h" |
| 7 #include "platform/hashmap.h" | 7 #include "platform/hashmap.h" |
| 8 #include "vm/unit_test.h" | 8 #include "vm/unit_test.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 // Remove all these values. | 140 // Remove all these values. |
| 141 x = start; | 141 x = start; |
| 142 for (uint32_t i = 0; i < n; i++) { | 142 for (uint32_t i = 0; i < n; i++) { |
| 143 EXPECT_EQ(n - i, set.occupancy()); | 143 EXPECT_EQ(n - i, set.occupancy()); |
| 144 EXPECT(set.Present(x)); | 144 EXPECT(set.Present(x)); |
| 145 set.Remove(x); | 145 set.Remove(x); |
| 146 EXPECT(!set.Present(x)); | 146 EXPECT(!set.Present(x)); |
| 147 x = x * factor + offset; | 147 x = x * factor + offset; |
| 148 | 148 |
| 149 // Verify the the expected values are still there. | 149 // Verify the expected values are still there. |
| 150 int y = start; | 150 int y = start; |
| 151 for (uint32_t j = 0; j < n; j++) { | 151 for (uint32_t j = 0; j < n; j++) { |
| 152 if (j <= i) { | 152 if (j <= i) { |
| 153 EXPECT(!set.Present(y)); | 153 EXPECT(!set.Present(y)); |
| 154 } else { | 154 } else { |
| 155 EXPECT(set.Present(y)); | 155 EXPECT(set.Present(y)); |
| 156 } | 156 } |
| 157 y = y * factor + offset; | 157 y = y * factor + offset; |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 EXPECT_EQ(0u, set.occupancy()); | 160 EXPECT_EQ(0u, set.occupancy()); |
| 161 } | 161 } |
| 162 | 162 |
| 163 | 163 |
| 164 UNIT_TEST_CASE(Set) { | 164 UNIT_TEST_CASE(Set) { |
| 165 TestSet(WordHash, 100); | 165 TestSet(WordHash, 100); |
| 166 TestSet(Hash, 100); | 166 TestSet(Hash, 100); |
| 167 TestSet(CollisionHash1, 50); | 167 TestSet(CollisionHash1, 50); |
| 168 TestSet(CollisionHash2, 50); | 168 TestSet(CollisionHash2, 50); |
| 169 TestSet(CollisionHash3, 50); | 169 TestSet(CollisionHash3, 50); |
| 170 TestSet(CollisionHash4, 50); | 170 TestSet(CollisionHash4, 50); |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace dart | 173 } // namespace dart |
| OLD | NEW |