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

Side by Side Diff: tests/Writer32Test.cpp

Issue 23576015: Change old PRG to be SkLCGRandom; change new one to SkRandom (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix some spurious SkMWCRandoms Created 7 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 | 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 REPORTER_ASSERT(reporter, reader.eof()); 146 REPORTER_ASSERT(reporter, reader.eof());
147 } 147 }
148 148
149 static void testWritePad(skiatest::Reporter* reporter, SkWriter32* writer) { 149 static void testWritePad(skiatest::Reporter* reporter, SkWriter32* writer) {
150 // Create some random data to write. 150 // Create some random data to write.
151 const size_t dataSize = 10<<2; 151 const size_t dataSize = 10<<2;
152 SkASSERT(SkIsAlign4(dataSize)); 152 SkASSERT(SkIsAlign4(dataSize));
153 153
154 SkAutoMalloc originalData(dataSize); 154 SkAutoMalloc originalData(dataSize);
155 { 155 {
156 SkMWCRandom rand(0); 156 SkRandom rand(0);
157 uint32_t* ptr = static_cast<uint32_t*>(originalData.get()); 157 uint32_t* ptr = static_cast<uint32_t*>(originalData.get());
158 uint32_t* stop = ptr + (dataSize>>2); 158 uint32_t* stop = ptr + (dataSize>>2);
159 while (ptr < stop) { 159 while (ptr < stop) {
160 *ptr++ = rand.nextU(); 160 *ptr++ = rand.nextU();
161 } 161 }
162 162
163 // Write the random data to the writer at different lengths for 163 // Write the random data to the writer at different lengths for
164 // different alignments. 164 // different alignments.
165 for (size_t len = 0; len < dataSize; len++) { 165 for (size_t len = 0; len < dataSize; len++) {
166 writer->writePad(originalData.get(), len); 166 writer->writePad(originalData.get(), len);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } 248 }
249 249
250 test_reserve(reporter); 250 test_reserve(reporter);
251 test_string_null(reporter); 251 test_string_null(reporter);
252 test_ptr(reporter); 252 test_ptr(reporter);
253 test_rewind(reporter); 253 test_rewind(reporter);
254 } 254 }
255 255
256 #include "TestClassDef.h" 256 #include "TestClassDef.h"
257 DEFINE_TESTCLASS("Writer32", Writer32Class, Tests) 257 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