OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Test program to convert lists of integers into ranges, and vice versa. | 5 // Test program to convert lists of integers into ranges, and vice versa. |
6 | 6 |
7 #include "chrome/browser/safe_browsing/chunk_range.h" | 7 #include "chrome/browser/safe_browsing/chunk_range.h" |
8 | 8 |
| 9 #include <stddef.h> |
| 10 |
9 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
10 | 12 |
11 namespace safe_browsing { | 13 namespace safe_browsing { |
12 | 14 |
13 // Test various configurations of chunk numbers. | 15 // Test various configurations of chunk numbers. |
14 TEST(SafeBrowsingChunkRangeTest, TestChunksToRangeString) { | 16 TEST(SafeBrowsingChunkRangeTest, TestChunksToRangeString) { |
15 std::vector<int> chunks; | 17 std::vector<int> chunks; |
16 std::string range_string; | 18 std::string range_string; |
17 | 19 |
18 // Test one chunk range and one single value. | 20 // Test one chunk range and one single value. |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 EXPECT_TRUE(IsChunkInRange(555, ranges)); | 162 EXPECT_TRUE(IsChunkInRange(555, ranges)); |
161 EXPECT_TRUE(IsChunkInRange(1, ranges)); | 163 EXPECT_TRUE(IsChunkInRange(1, ranges)); |
162 EXPECT_TRUE(IsChunkInRange(1000, ranges)); | 164 EXPECT_TRUE(IsChunkInRange(1000, ranges)); |
163 | 165 |
164 EXPECT_FALSE(IsChunkInRange(11, ranges)); | 166 EXPECT_FALSE(IsChunkInRange(11, ranges)); |
165 EXPECT_FALSE(IsChunkInRange(990, ranges)); | 167 EXPECT_FALSE(IsChunkInRange(990, ranges)); |
166 EXPECT_FALSE(IsChunkInRange(2000, ranges)); | 168 EXPECT_FALSE(IsChunkInRange(2000, ranges)); |
167 } | 169 } |
168 | 170 |
169 } // namespace safe_browsing | 171 } // namespace safe_browsing |
OLD | NEW |