OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "courgette/third_party/bsdiff/paged_array.h" | 5 #include "courgette/third_party/bsdiff/paged_array.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <iterator> | 10 #include <iterator> |
11 #include <random> | 11 #include <random> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
| 18 #if !defined(ADDRESS_SANITIZER) || !defined(OS_WIN) |
18 // Total allocation of 4GB will fail in 32 bit programs if allocations are | 19 // Total allocation of 4GB will fail in 32 bit programs if allocations are |
19 // leaked. | 20 // leaked. |
20 const int kIterations = 20; | 21 const int kIterations = 20; |
21 const int kSizeBig = 200 * 1024 * 1024 / sizeof(int); // 200MB | 22 const int kSizeBig = 200 * 1024 * 1024 / sizeof(int); // 200MB |
| 23 #endif |
22 | 24 |
23 const size_t kLogBlockSizeSmall = 10; | 25 const size_t kLogBlockSizeSmall = 10; |
24 const size_t kBlockSizeSmall = 1 << kLogBlockSizeSmall; | 26 const size_t kBlockSizeSmall = 1 << kLogBlockSizeSmall; |
25 const size_t kSizeList[] = {1, | 27 const size_t kSizeList[] = {1, |
26 16, | 28 16, |
27 123, | 29 123, |
28 kBlockSizeSmall, | 30 kBlockSizeSmall, |
29 kBlockSizeSmall + 1, | 31 kBlockSizeSmall + 1, |
30 123 * kBlockSizeSmall + 567}; | 32 123 * kBlockSizeSmall + 567}; |
31 | 33 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 for (size_t i = 0; i < size; ++i) { | 239 for (size_t i = 0; i < size; ++i) { |
238 v[i] = pseudo_rand_gen(); | 240 v[i] = pseudo_rand_gen(); |
239 a[i] = v[i]; | 241 a[i] = v[i]; |
240 } | 242 } |
241 std::sort(v.begin(), v.end()); | 243 std::sort(v.begin(), v.end()); |
242 std::sort(a.begin(), a.end()); | 244 std::sort(a.begin(), a.end()); |
243 for (size_t i = 0; i < size; ++i) | 245 for (size_t i = 0; i < size; ++i) |
244 EXPECT_EQ(v[i], a[i]); | 246 EXPECT_EQ(v[i], a[i]); |
245 } | 247 } |
246 } | 248 } |
OLD | NEW |