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

Side by Side Diff: tests/Writer32Test.cpp

Issue 100113004: Use DEFINE_TESTCLASS_SHORT macro in tests. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years 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/WArrayTest.cpp ('k') | tests/XfermodeTest.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
2 /* 1 /*
3 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
4 * 3 *
5 * 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
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
8 7
9 8 #include "Test.h"
10 9 #include "TestClassDef.h"
11 #include "SkRandom.h" 10 #include "SkRandom.h"
12 #include "SkReader32.h" 11 #include "SkReader32.h"
13 #include "SkWriter32.h" 12 #include "SkWriter32.h"
14 #include "Test.h"
15 13
16 static void check_contents(skiatest::Reporter* reporter, const SkWriter32& write r, 14 static void check_contents(skiatest::Reporter* reporter, const SkWriter32& write r,
17 const void* expected, size_t size) { 15 const void* expected, size_t size) {
18 SkAutoSMalloc<256> storage(size); 16 SkAutoSMalloc<256> storage(size);
19 REPORTER_ASSERT(reporter, writer.bytesWritten() == size); 17 REPORTER_ASSERT(reporter, writer.bytesWritten() == size);
20 writer.flatten(storage.get()); 18 writer.flatten(storage.get());
21 REPORTER_ASSERT(reporter, !memcmp(storage.get(), expected, size)); 19 REPORTER_ASSERT(reporter, !memcmp(storage.get(), expected, size));
22 } 20 }
23 21
24 22
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 REPORTER_ASSERT(reporter, memcmp(readPtr, originalData.get(), len) == 0) ; 179 REPORTER_ASSERT(reporter, memcmp(readPtr, originalData.get(), len) == 0) ;
182 // Ensure that the rest is padded with zeroes. 180 // Ensure that the rest is padded with zeroes.
183 const char* stop = readPtr + SkAlign4(len); 181 const char* stop = readPtr + SkAlign4(len);
184 readPtr += len; 182 readPtr += len;
185 while (readPtr < stop) { 183 while (readPtr < stop) {
186 REPORTER_ASSERT(reporter, *readPtr++ == 0); 184 REPORTER_ASSERT(reporter, *readPtr++ == 0);
187 } 185 }
188 } 186 }
189 } 187 }
190 188
191 static void Tests(skiatest::Reporter* reporter) { 189 DEF_TEST(Writer32, reporter) {
192 // dynamic allocator 190 // dynamic allocator
193 { 191 {
194 SkWriter32 writer(256 * 4); 192 SkWriter32 writer(256 * 4);
195 test1(reporter, &writer); 193 test1(reporter, &writer);
196 194
197 writer.reset(); 195 writer.reset();
198 test2(reporter, &writer); 196 test2(reporter, &writer);
199 197
200 writer.reset(); 198 writer.reset();
201 testWritePad(reporter, &writer); 199 testWritePad(reporter, &writer);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 243
246 writer.reset(); 244 writer.reset();
247 testWritePad(reporter, &writer); 245 testWritePad(reporter, &writer);
248 } 246 }
249 247
250 test_reserve(reporter); 248 test_reserve(reporter);
251 test_string_null(reporter); 249 test_string_null(reporter);
252 test_ptr(reporter); 250 test_ptr(reporter);
253 test_rewind(reporter); 251 test_rewind(reporter);
254 } 252 }
255
256 #include "TestClassDef.h"
257 DEFINE_TESTCLASS("Writer32", Writer32Class, Tests)
OLDNEW
« no previous file with comments | « tests/WArrayTest.cpp ('k') | tests/XfermodeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698