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

Side by Side Diff: tests/Writer32Test.cpp

Issue 12334131: Change random number generator for tests to SkMWCRandom (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Rebase to latest Created 7 years, 9 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 | « tests/UtilsTest.cpp ('k') | no next file » | 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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 10
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 REPORTER_ASSERT(reporter, reader.eof()); 127 REPORTER_ASSERT(reporter, reader.eof());
128 } 128 }
129 129
130 static void testWritePad(skiatest::Reporter* reporter, SkWriter32* writer) { 130 static void testWritePad(skiatest::Reporter* reporter, SkWriter32* writer) {
131 // Create some random data to write. 131 // Create some random data to write.
132 const size_t dataSize = 10<<2; 132 const size_t dataSize = 10<<2;
133 SkASSERT(SkIsAlign4(dataSize)); 133 SkASSERT(SkIsAlign4(dataSize));
134 134
135 SkAutoMalloc originalData(dataSize); 135 SkAutoMalloc originalData(dataSize);
136 { 136 {
137 SkRandom rand(0); 137 SkMWCRandom rand(0);
138 uint32_t* ptr = static_cast<uint32_t*>(originalData.get()); 138 uint32_t* ptr = static_cast<uint32_t*>(originalData.get());
139 uint32_t* stop = ptr + (dataSize>>2); 139 uint32_t* stop = ptr + (dataSize>>2);
140 while (ptr < stop) { 140 while (ptr < stop) {
141 *ptr++ = rand.nextU(); 141 *ptr++ = rand.nextU();
142 } 142 }
143 143
144 // Write the random data to the writer at different lengths for 144 // Write the random data to the writer at different lengths for
145 // different alignments. 145 // different alignments.
146 for (size_t len = 0; len < dataSize; len++) { 146 for (size_t len = 0; len < dataSize; len++) {
147 writer->writePad(originalData.get(), len); 147 writer->writePad(originalData.get(), len);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 writer.reset(); 222 writer.reset();
223 testWritePad(reporter, &writer); 223 testWritePad(reporter, &writer);
224 } 224 }
225 225
226 test_ptr(reporter); 226 test_ptr(reporter);
227 test_rewind(reporter); 227 test_rewind(reporter);
228 } 228 }
229 229
230 #include "TestClassDef.h" 230 #include "TestClassDef.h"
231 DEFINE_TESTCLASS("Writer32", Writer32Class, Tests) 231 DEFINE_TESTCLASS("Writer32", Writer32Class, Tests)
OLDNEW
« no previous file with comments | « tests/UtilsTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698