| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <cstring> | 6 #include <cstring> |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 num_deleted -= table.IsDeleted(i); | 56 num_deleted -= table.IsDeleted(i); |
| 57 } | 57 } |
| 58 EXPECT_EQ(0, num_unused); | 58 EXPECT_EQ(0, num_unused); |
| 59 EXPECT_EQ(0, num_occupied); | 59 EXPECT_EQ(0, num_occupied); |
| 60 EXPECT_EQ(0, num_deleted); | 60 EXPECT_EQ(0, num_deleted); |
| 61 } | 61 } |
| 62 | 62 |
| 63 | 63 |
| 64 TEST_CASE(HashTable) { | 64 TEST_CASE(HashTable) { |
| 65 typedef HashTable<TestTraits, 2, 1> Table; | 65 typedef HashTable<TestTraits, 2, 1> Table; |
| 66 Table table(HashTables::New<Table>(5)); | 66 Table table(Thread::Current()->zone(), HashTables::New<Table>(5)); |
| 67 // Ensure that we did get at least 5 entries. | 67 // Ensure that we did get at least 5 entries. |
| 68 EXPECT_LE(5, table.NumEntries()); | 68 EXPECT_LE(5, table.NumEntries()); |
| 69 EXPECT_EQ(0, table.NumOccupied()); | 69 EXPECT_EQ(0, table.NumOccupied()); |
| 70 Validate(table); | 70 Validate(table); |
| 71 EXPECT_EQ(-1, table.FindKey("a")); | 71 EXPECT_EQ(-1, table.FindKey("a")); |
| 72 | 72 |
| 73 // Insertion and lookup. | 73 // Insertion and lookup. |
| 74 intptr_t a_entry = -1; | 74 intptr_t a_entry = -1; |
| 75 EXPECT(!table.FindKeyOrDeletedOrUnused("a", &a_entry)); | 75 EXPECT(!table.FindKeyOrDeletedOrUnused("a", &a_entry)); |
| 76 EXPECT_NE(-1, a_entry); | 76 EXPECT_NE(-1, a_entry); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 TEST_CASE(Maps) { | 298 TEST_CASE(Maps) { |
| 299 for (intptr_t initial_capacity = 0; | 299 for (intptr_t initial_capacity = 0; |
| 300 initial_capacity < 32; | 300 initial_capacity < 32; |
| 301 ++initial_capacity) { | 301 ++initial_capacity) { |
| 302 TestMap<UnorderedHashMap<TestTraits> >(initial_capacity, false); | 302 TestMap<UnorderedHashMap<TestTraits> >(initial_capacity, false); |
| 303 TestMap<EnumIndexHashMap<TestTraits> >(initial_capacity, true); | 303 TestMap<EnumIndexHashMap<TestTraits> >(initial_capacity, true); |
| 304 } | 304 } |
| 305 } | 305 } |
| 306 | 306 |
| 307 } // namespace dart | 307 } // namespace dart |
| OLD | NEW |