Lines Matching refs:prefixes
29 // Generate a set of random prefixes to share between tests. For
41 // Check that all elements of |prefixes| are in |prefix_set|, and
45 const std::vector<SBPrefix> &prefixes) {
46 // The set can generate the prefixes it believes it has, so that's
48 std::set<SBPrefix> check(prefixes.begin(), prefixes.end());
54 for (size_t i = 0; i < prefixes.size(); ++i) {
55 EXPECT_TRUE(prefix_set->Exists(prefixes[i]));
57 const SBPrefix left_sibling = prefixes[i] - 1;
61 const SBPrefix right_sibling = prefixes[i] + 1;
169 const std::vector<SBPrefix> prefixes(100, 0);
170 safe_browsing::PrefixSet prefix_set(prefixes);
172 EXPECT_TRUE(prefix_set.Exists(prefixes[0]));
175 // Check that |GetPrefixes()| returns the same set of prefixes as
180 EXPECT_EQ(prefixes[0], prefixes_copy[0]);
185 std::vector<SBPrefix> prefixes;
189 prefixes.push_back(0x00000000);
190 prefixes.push_back(0x0000FFFF);
191 prefixes.push_back(0x7FFF0000);
192 prefixes.push_back(0x7FFFFFFF);
193 prefixes.push_back(0x80000000);
194 prefixes.push_back(0x8000FFFF);
195 prefixes.push_back(0xFFFF0000);
196 prefixes.push_back(0xFFFFFFFF);
198 std::sort(prefixes.begin(), prefixes.end());
199 safe_browsing::PrefixSet prefix_set(prefixes);
201 // Check that |GetPrefixes()| returns the same set of prefixes as
205 ASSERT_EQ(prefixes_copy.size(), prefixes.size());
206 EXPECT_TRUE(std::equal(prefixes.begin(), prefixes.end(),
212 std::vector<SBPrefix> prefixes;
220 prefixes.push_back(prefix);
223 std::sort(prefixes.begin(), prefixes.end());
224 safe_browsing::PrefixSet prefix_set(prefixes);
226 // Check that |GetPrefixes()| returns the same set of prefixes as
230 prefixes.erase(std::unique(prefixes.begin(), prefixes.end()), prefixes.end());
231 EXPECT_EQ(prefixes_copy.size(), prefixes.size());
232 EXPECT_TRUE(std::equal(prefixes.begin(), prefixes.end(),
243 std::vector<SBPrefix> prefixes;
250 prefixes.push_back(prefix);
256 prefixes.push_back(prefix);
264 prefixes.push_back(prefix);
265 prefixes.push_back(prefix);
273 prefixes.push_back(prefix);
276 prefixes.push_back(prefix);
280 std::sort(prefixes.begin(), prefixes.end());
281 safe_browsing::PrefixSet prefix_set(prefixes);
283 // Check that |GetPrefixes()| returns the same set of prefixes as
287 prefixes.erase(std::unique(prefixes.begin(), prefixes.end()), prefixes.end());
288 EXPECT_EQ(prefixes_copy.size(), prefixes.size());
289 EXPECT_TRUE(std::equal(prefixes.begin(), prefixes.end(),
299 for (size_t i = 0; i < prefixes.size(); ++i) {
300 EXPECT_TRUE(prefix_set.Exists(prefixes[i]));
302 EXPECT_FALSE(prefix_set.Exists(prefixes[i] - 1));
303 EXPECT_FALSE(prefix_set.Exists(prefixes[i] + 1));
438 std::vector<SBPrefix> prefixes;
440 std::back_inserter(prefixes));
441 safe_browsing::PrefixSet prefix_set(prefixes);
443 EXPECT_EQ(prefixes.size(), prefix_set.GetSize());
445 for (size_t i = 1; i < prefixes.size(); ++i) {
446 const int delta = prefixes[i] - prefixes[i - 1];