Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: courgette/third_party/paged_array_unittest.cc

Issue 1961963003: Move //courgette/third_party to subfolder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes according to comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « courgette/third_party/paged_array.h ('k') | courgette/third_party/qsufsort.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "courgette/third_party/paged_array.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 class PagedArrayTest : public testing::Test {
10 public:
11 // Total allocation of 4GB will fail in 32 bit programs if allocations are
12 // leaked.
13 static const int kIterations = 20;
14 static const int kSize = 200 * 1024 * 1024 / sizeof(int); // 200MB
15 };
16
17 // AddressSanitizer on Windows adds additional memory overhead, which
18 // causes these tests to go OOM and fail.
19 #if !defined(ADDRESS_SANITIZER) || !defined(OS_WIN)
20 TEST_F(PagedArrayTest, TestManyAllocationsDestructorFree) {
21 for (int i = 0; i < kIterations; ++i) {
22 courgette::PagedArray<int> a;
23 EXPECT_TRUE(a.Allocate(kSize));
24 }
25 }
26
27 TEST_F(PagedArrayTest, TestManyAllocationsManualFree) {
28 courgette::PagedArray<int> a;
29 for (int i = 0; i < kIterations; ++i) {
30 EXPECT_TRUE(a.Allocate(kSize));
31 a.clear();
32 }
33 }
34 #endif
35
36 TEST_F(PagedArrayTest, TestAccess) {
37 const int kAccessSize = 3 * 1024 * 1024;
38 courgette::PagedArray<int> a;
39 a.Allocate(kAccessSize);
40 for (int i = 0; i < kAccessSize; ++i) {
41 a[i] = i;
42 }
43 for (int i = 0; i < kAccessSize; ++i) {
44 EXPECT_EQ(i, a[i]);
45 }
46 }
OLDNEW
« no previous file with comments | « courgette/third_party/paged_array.h ('k') | courgette/third_party/qsufsort.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698