| 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 "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace safe_browsing { |
| 12 |
| 11 // Test various configurations of chunk numbers. | 13 // Test various configurations of chunk numbers. |
| 12 TEST(SafeBrowsingChunkRangeTest, TestChunksToRangeString) { | 14 TEST(SafeBrowsingChunkRangeTest, TestChunksToRangeString) { |
| 13 std::vector<int> chunks; | 15 std::vector<int> chunks; |
| 14 std::string range_string; | 16 std::string range_string; |
| 15 | 17 |
| 16 // Test one chunk range and one single value. | 18 // Test one chunk range and one single value. |
| 17 chunks.push_back(1); | 19 chunks.push_back(1); |
| 18 chunks.push_back(2); | 20 chunks.push_back(2); |
| 19 chunks.push_back(3); | 21 chunks.push_back(3); |
| 20 chunks.push_back(4); | 22 chunks.push_back(4); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 EXPECT_TRUE(IsChunkInRange(7, ranges)); | 158 EXPECT_TRUE(IsChunkInRange(7, ranges)); |
| 157 EXPECT_TRUE(IsChunkInRange(300, ranges)); | 159 EXPECT_TRUE(IsChunkInRange(300, ranges)); |
| 158 EXPECT_TRUE(IsChunkInRange(555, ranges)); | 160 EXPECT_TRUE(IsChunkInRange(555, ranges)); |
| 159 EXPECT_TRUE(IsChunkInRange(1, ranges)); | 161 EXPECT_TRUE(IsChunkInRange(1, ranges)); |
| 160 EXPECT_TRUE(IsChunkInRange(1000, ranges)); | 162 EXPECT_TRUE(IsChunkInRange(1000, ranges)); |
| 161 | 163 |
| 162 EXPECT_FALSE(IsChunkInRange(11, ranges)); | 164 EXPECT_FALSE(IsChunkInRange(11, ranges)); |
| 163 EXPECT_FALSE(IsChunkInRange(990, ranges)); | 165 EXPECT_FALSE(IsChunkInRange(990, ranges)); |
| 164 EXPECT_FALSE(IsChunkInRange(2000, ranges)); | 166 EXPECT_FALSE(IsChunkInRange(2000, ranges)); |
| 165 } | 167 } |
| 168 |
| 169 } // namespace safe_browsing |
| OLD | NEW |