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

Side by Side Diff: tests/SmallAllocatorTest.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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 | « tests/SkpSkGrTest.cpp ('k') | tests/StreamTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google, Inc 2 * Copyright 2014 Google, Inc
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkSmallAllocator.h" 8 #include "SkSmallAllocator.h"
9 #include "SkTypes.h" 9 #include "SkTypes.h"
10 #include "Test.h" 10 #include "Test.h"
(...skipping 14 matching lines...) Expand all
25 static int kCount; 25 static int kCount;
26 }; 26 };
27 27
28 int CountingClass::kCount; 28 int CountingClass::kCount;
29 29
30 template<uint32_t kMaxObjects, size_t kBytes> void test_allocator(skiatest::Repo rter* reporter) { 30 template<uint32_t kMaxObjects, size_t kBytes> void test_allocator(skiatest::Repo rter* reporter) {
31 { 31 {
32 SkSmallAllocator<kMaxObjects, kBytes> alloc; 32 SkSmallAllocator<kMaxObjects, kBytes> alloc;
33 for (uint32_t i = 0; i < kMaxObjects; ++i) { 33 for (uint32_t i = 0; i < kMaxObjects; ++i) {
34 CountingClass* c = alloc.template createT<CountingClass>(); 34 CountingClass* c = alloc.template createT<CountingClass>();
35 REPORTER_ASSERT(reporter, c != NULL); 35 REPORTER_ASSERT(reporter, c != nullptr);
36 REPORTER_ASSERT(reporter, CountingClass::GetCount() == static_cast<i nt>(i+1)); 36 REPORTER_ASSERT(reporter, CountingClass::GetCount() == static_cast<i nt>(i+1));
37 } 37 }
38 } 38 }
39 REPORTER_ASSERT(reporter, CountingClass::GetCount() == 0); 39 REPORTER_ASSERT(reporter, CountingClass::GetCount() == 0);
40 } 40 }
41 41
42 // Tests that ensure that the destructor is called, whether the objects 42 // Tests that ensure that the destructor is called, whether the objects
43 // were created in fStorage or on the heap. 43 // were created in fStorage or on the heap.
44 DEF_TEST(SmallAllocator_destructor, reporter) { 44 DEF_TEST(SmallAllocator_destructor, reporter) {
45 // Four times as many bytes as objects will never require any heap 45 // Four times as many bytes as objects will never require any heap
(...skipping 25 matching lines...) Expand all
71 private: 71 private:
72 Dummy* fDummy; 72 Dummy* fDummy;
73 }; 73 };
74 74
75 // Test that using a createT with a constructor taking a pointer as a 75 // Test that using a createT with a constructor taking a pointer as a
76 // parameter works as expected. 76 // parameter works as expected.
77 DEF_TEST(SmallAllocator_pointer, reporter) { 77 DEF_TEST(SmallAllocator_pointer, reporter) {
78 SkSmallAllocator<1, 8> alloc; 78 SkSmallAllocator<1, 8> alloc;
79 Dummy d; 79 Dummy d;
80 DummyContainer* container = alloc.createT<DummyContainer>(&d); 80 DummyContainer* container = alloc.createT<DummyContainer>(&d);
81 REPORTER_ASSERT(reporter, container != NULL); 81 REPORTER_ASSERT(reporter, container != nullptr);
82 REPORTER_ASSERT(reporter, container->getDummy() == &d); 82 REPORTER_ASSERT(reporter, container->getDummy() == &d);
83 } 83 }
OLDNEW
« no previous file with comments | « tests/SkpSkGrTest.cpp ('k') | tests/StreamTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698