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

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

Issue 6300001: Clang: enable -Wbool-conversions and -Wunused-variables on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, undo indent Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « courgette/streams_unittest.cc ('k') | media/audio/audio_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/paged_array.h" 5 #include "courgette/third_party/paged_array.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 class PagedArrayTest : public testing::Test { 9 class PagedArrayTest : public testing::Test {
10 public: 10 public:
11 // Total allocation of 4GB will fail in 32 bit programs if allocations are 11 // Total allocation of 4GB will fail in 32 bit programs if allocations are
12 // leaked. 12 // leaked.
13 static const int kIterations = 20; 13 static const int kIterations = 20;
14 static const int kSize = 200 * 1024 * 1024 / sizeof(int); // 200MB 14 static const int kSize = 200 * 1024 * 1024 / sizeof(int); // 200MB
15 }; 15 };
16 16
17 TEST_F(PagedArrayTest, TestManyAllocationsDestructorFree) { 17 TEST_F(PagedArrayTest, TestManyAllocationsDestructorFree) {
18 for (int i = 0; i < kIterations; ++i) { 18 for (int i = 0; i < kIterations; ++i) {
19 courgette::PagedArray<int> a; 19 courgette::PagedArray<int> a;
20 EXPECT_EQ(true, a.Allocate(kSize)); 20 EXPECT_TRUE(a.Allocate(kSize));
21 } 21 }
22 } 22 }
23 23
24 TEST_F(PagedArrayTest, TestManyAllocationsManualFree) { 24 TEST_F(PagedArrayTest, TestManyAllocationsManualFree) {
25 courgette::PagedArray<int> a; 25 courgette::PagedArray<int> a;
26 for (int i = 0; i < kIterations; ++i) { 26 for (int i = 0; i < kIterations; ++i) {
27 EXPECT_EQ(true, a.Allocate(kSize)); 27 EXPECT_TRUE(a.Allocate(kSize));
28 a.clear(); 28 a.clear();
29 } 29 }
30 } 30 }
31 31
32 TEST_F(PagedArrayTest, TestAccess) { 32 TEST_F(PagedArrayTest, TestAccess) {
33 const int kAccessSize = 3 * 1024 * 1024; 33 const int kAccessSize = 3 * 1024 * 1024;
34 courgette::PagedArray<int> a; 34 courgette::PagedArray<int> a;
35 a.Allocate(kAccessSize); 35 a.Allocate(kAccessSize);
36 for (int i = 0; i < kAccessSize; ++i) { 36 for (int i = 0; i < kAccessSize; ++i) {
37 a[i] = i; 37 a[i] = i;
38 } 38 }
39 for (int i = 0; i < kAccessSize; ++i) { 39 for (int i = 0; i < kAccessSize; ++i) {
40 EXPECT_EQ(i, a[i]); 40 EXPECT_EQ(i, a[i]);
41 } 41 }
42 } 42 }
OLDNEW
« no previous file with comments | « courgette/streams_unittest.cc ('k') | media/audio/audio_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698