OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google 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 ASSERT_TRUE(map.begin() == begin); | 48 ASSERT_TRUE(map.begin() == begin); |
49 ASSERT_TRUE(begin != map.end()); | 49 ASSERT_TRUE(begin != map.end()); |
50 ASSERT_TRUE(map.end() != begin); | 50 ASSERT_TRUE(map.end() != begin); |
51 ASSERT_FALSE(begin != map.begin()); | 51 ASSERT_FALSE(begin != map.begin()); |
52 ASSERT_FALSE(map.begin() != begin); | 52 ASSERT_FALSE(map.begin() != begin); |
53 ASSERT_FALSE(begin == map.end()); | 53 ASSERT_FALSE(begin == map.end()); |
54 ASSERT_FALSE(map.end() == begin); | 54 ASSERT_FALSE(map.end() == begin); |
55 } | 55 } |
56 | 56 |
57 struct TestDoubleHashTraits : HashTraits<double> { | 57 struct TestDoubleHashTraits : HashTraits<double> { |
58 static const int minimumTableSize = 8; | 58 static const unsigned minimumTableSize = 8; |
59 }; | 59 }; |
60 | 60 |
61 typedef HashMap<double, int64_t, DefaultHash<double>::Hash, TestDoubleHashTraits
> DoubleHashMap; | 61 typedef HashMap<double, int64_t, DefaultHash<double>::Hash, TestDoubleHashTraits
> DoubleHashMap; |
62 | 62 |
63 static int bucketForKey(double key) | 63 static int bucketForKey(double key) |
64 { | 64 { |
65 return DefaultHash<double>::Hash::hash(key) & (TestDoubleHashTraits::minimum
TableSize - 1); | 65 return DefaultHash<double>::Hash::hash(key) & (TestDoubleHashTraits::minimum
TableSize - 1); |
66 } | 66 } |
67 | 67 |
68 TEST(WTF, DoubleHashCollisions) | 68 TEST(WTF, DoubleHashCollisions) |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 ASSERT_EQ(1, map.get(ptr)); | 155 ASSERT_EQ(1, map.get(ptr)); |
156 | 156 |
157 ptr.clear(); | 157 ptr.clear(); |
158 ASSERT_FALSE(isDeleted); | 158 ASSERT_FALSE(isDeleted); |
159 | 159 |
160 map.clear(); | 160 map.clear(); |
161 ASSERT_TRUE(isDeleted); | 161 ASSERT_TRUE(isDeleted); |
162 } | 162 } |
163 | 163 |
164 } // namespace | 164 } // namespace |
OLD | NEW |