OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/rappor/bloom_filter.h" | 5 #include "components/rappor/bloom_filter.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "components/rappor/byte_vector_utils.h" | 9 #include "components/rappor/byte_vector_utils.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
9 | 11 |
10 namespace rappor { | 12 namespace rappor { |
11 | 13 |
12 TEST(BloomFilterTest, TinyFilter) { | 14 TEST(BloomFilterTest, TinyFilter) { |
13 BloomFilter filter(1u, 4u, 0u); | 15 BloomFilter filter(1u, 4u, 0u); |
14 | 16 |
15 // Size is 1 and it's initially empty | 17 // Size is 1 and it's initially empty |
16 EXPECT_EQ(1u, filter.bytes().size()); | 18 EXPECT_EQ(1u, filter.bytes().size()); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 EXPECT_EQ(0xa8u, bytes_from_get); | 58 EXPECT_EQ(0xa8u, bytes_from_get); |
57 } | 59 } |
58 | 60 |
59 TEST(BloomFilterTest, GetBloomBitsLarge) { | 61 TEST(BloomFilterTest, GetBloomBitsLarge) { |
60 // Make sure that a 64-bit bloom filter can set the full range of bits. | 62 // Make sure that a 64-bit bloom filter can set the full range of bits. |
61 uint64_t bytes_from_get = internal::GetBloomBits(8u, 1024u, 0u, "Bar"); | 63 uint64_t bytes_from_get = internal::GetBloomBits(8u, 1024u, 0u, "Bar"); |
62 EXPECT_EQ(0xffffffffffffffffu, bytes_from_get); | 64 EXPECT_EQ(0xffffffffffffffffu, bytes_from_get); |
63 } | 65 } |
64 | 66 |
65 } // namespace rappor | 67 } // namespace rappor |
OLD | NEW |