Lines Matching full:hash
21 static uint32_t Hash(const int& key) { return key; } in Hash() function
25 class Hash : public SkTDynamicHash<Entry, int> { class
27 Hash() : INHERITED() {} in Hash() function in __anon31efb7e40111::Hash
48 Hash hash; in DEF_TEST() local
49 ASSERT(hash.capacity() == 0); in DEF_TEST()
51 hash.add(&a); in DEF_TEST()
52 ASSERT(hash.capacity() == 4); in DEF_TEST()
54 hash.add(&b); in DEF_TEST()
55 ASSERT(hash.capacity() == 4); in DEF_TEST()
57 hash.add(&c); in DEF_TEST()
58 ASSERT(hash.capacity() == 4); in DEF_TEST()
60 hash.add(&d); in DEF_TEST()
61 ASSERT(hash.capacity() == 8); in DEF_TEST()
63 hash.add(&e); in DEF_TEST()
64 ASSERT(hash.capacity() == 8); in DEF_TEST()
66 ASSERT(hash.count() == 5); in DEF_TEST()
76 Hash hash; in DEF_TEST() local
77 ASSERT(hash.capacity() == 0); in DEF_TEST()
79 hash.add(&a); in DEF_TEST()
80 ASSERT(hash.capacity() == 4); in DEF_TEST()
82 hash.remove(a.key); in DEF_TEST()
83 hash.add(&b); in DEF_TEST()
84 ASSERT(hash.capacity() == 4); in DEF_TEST()
86 hash.remove(b.key); in DEF_TEST()
87 hash.add(&c); in DEF_TEST()
88 ASSERT(hash.capacity() == 4); in DEF_TEST()
90 hash.remove(c.key); in DEF_TEST()
91 hash.add(&d); in DEF_TEST()
92 ASSERT(hash.capacity() == 4); in DEF_TEST()
94 hash.remove(d.key); in DEF_TEST()
95 hash.add(&e); in DEF_TEST()
96 ASSERT(hash.capacity() == 4); in DEF_TEST()
98 ASSERT(hash.count() == 1); in DEF_TEST()
102 Hash hash; in DEF_TEST() local
106 ASSERT(hash.count() == 0); in DEF_TEST()
107 hash.add(&a); in DEF_TEST()
108 ASSERT(hash.count() == 1); in DEF_TEST()
109 hash.add(&b); in DEF_TEST()
110 ASSERT(hash.count() == 2); in DEF_TEST()
114 Hash hash; in DEF_TEST() local
121 ASSERT(hash.countCollisions(1) == 0); in DEF_TEST()
122 ASSERT(hash.countCollisions(5) == 0); in DEF_TEST()
123 ASSERT(hash.countCollisions(9) == 0); in DEF_TEST()
126 hash.add(&a); in DEF_TEST()
127 ASSERT(hash.countCollisions(1) == 0); in DEF_TEST()
128 ASSERT(hash.countCollisions(5) == 1); in DEF_TEST()
129 ASSERT(hash.countCollisions(9) == 1); in DEF_TEST()
132 hash.add(&b); in DEF_TEST()
133 ASSERT(hash.countCollisions(1) == 0); in DEF_TEST()
134 ASSERT(hash.countCollisions(5) == 1); in DEF_TEST()
135 ASSERT(hash.countCollisions(9) == 2); in DEF_TEST()
138 ASSERT(hash.find(1) != nullptr); in DEF_TEST()
139 ASSERT(hash.find(1)->value == 2.0); in DEF_TEST()
140 ASSERT(hash.find(5) != nullptr); in DEF_TEST()
141 ASSERT(hash.find(5)->value == 3.0); in DEF_TEST()
143 // These aren't in the hash. in DEF_TEST()
144 ASSERT(hash.find(2) == nullptr); in DEF_TEST()
145 ASSERT(hash.find(9) == nullptr); in DEF_TEST()
149 Hash hash; in DEF_TEST() local
156 hash.add(&a); in DEF_TEST()
157 hash.add(&b); in DEF_TEST()
158 hash.remove(1); in DEF_TEST()
161 ASSERT(hash.find(1) == nullptr); in DEF_TEST()
162 ASSERT(hash.find(5) != nullptr); in DEF_TEST()
163 ASSERT(hash.find(5)->value == 3.0); in DEF_TEST()
166 ASSERT(hash.countCollisions(9) == 0); in DEF_TEST()
167 hash.add(&c); in DEF_TEST()
168 ASSERT(hash.find(9) != nullptr); in DEF_TEST()
169 ASSERT(hash.find(9)->value == 4.0); in DEF_TEST()
170 ASSERT(hash.find(5) != nullptr); in DEF_TEST()
171 ASSERT(hash.find(5)->value == 3.0); in DEF_TEST()
175 Hash hash; in TestIter() local
179 for (T iter(&hash); !iter.done(); ++iter) { in TestIter()
189 hash.add(&a); in TestIter()
190 hash.add(&b); in TestIter()
191 hash.add(&c); in TestIter()
193 // should see all 3 unique keys when iterating over hash in TestIter()
196 for (T iter(&hash); !iter.done(); ++iter) { in TestIter()
199 ASSERT(hash.find(key) != nullptr); in TestIter()
207 // should see 2 unique keys when iterating over hash that aren't 1 in TestIter()
208 hash.remove(1); in TestIter()
211 for (T iter(&hash); !iter.done(); ++iter) { in TestIter()
215 ASSERT(hash.find(key) != nullptr); in TestIter()
223 TestIter<Hash::Iter>(reporter); in DEF_TEST()
224 TestIter<Hash::ConstIter>(reporter); in DEF_TEST()
228 Hash hash; in TestResetOrRewind() local
232 ASSERT(hash.capacity() == 0); in TestResetOrRewind()
233 hash.add(&a); in TestResetOrRewind()
234 hash.add(&b); in TestResetOrRewind()
235 ASSERT(hash.count() == 2); in TestResetOrRewind()
236 ASSERT(hash.capacity() == 4); in TestResetOrRewind()
239 hash.reset(); in TestResetOrRewind()
240 ASSERT(hash.capacity() == 0); in TestResetOrRewind()
242 hash.rewind(); in TestResetOrRewind()
243 ASSERT(hash.capacity() == 4); in TestResetOrRewind()
245 ASSERT(hash.count() == 0); in TestResetOrRewind()
248 hash.add(&a); in TestResetOrRewind()
249 hash.add(&b); in TestResetOrRewind()
250 ASSERT(hash.count() == 2); in TestResetOrRewind()
251 ASSERT(hash.capacity() == 4); in TestResetOrRewind()
253 ASSERT(hash.find(1) != nullptr); in TestResetOrRewind()
254 ASSERT(hash.find(2) != nullptr); in TestResetOrRewind()