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

Side by Side Diff: tests/ChecksumTest.cpp

Issue 138563004: Move macros from TestClassDef.h to Test.h (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: upload Created 6 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 | « tests/CanvasTest.cpp ('k') | tests/ClampRangeTest.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 2012 Google Inc. 2 * Copyright 2012 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 "SkChecksum.h" 8 #include "SkChecksum.h"
9 #include "SkRandom.h" 9 #include "SkRandom.h"
10 #include "Test.h" 10 #include "Test.h"
11 #include "TestClassDef.h"
12 11
13 12
14 // Murmur3 has an optional third seed argument, so we wrap it to fit a uniform t ype. 13 // Murmur3 has an optional third seed argument, so we wrap it to fit a uniform t ype.
15 static uint32_t murmur_noseed(const uint32_t* d, size_t l) { return SkChecksum:: Murmur3(d, l); } 14 static uint32_t murmur_noseed(const uint32_t* d, size_t l) { return SkChecksum:: Murmur3(d, l); }
16 15
17 #define ASSERT(x) REPORTER_ASSERT(r, x) 16 #define ASSERT(x) REPORTER_ASSERT(r, x)
18 17
19 DEF_TEST(Checksum, r) { 18 DEF_TEST(Checksum, r) {
20 // Algorithms to test. They're currently all uint32_t(const uint32_t*, size _t). 19 // Algorithms to test. They're currently all uint32_t(const uint32_t*, size _t).
21 typedef uint32_t(*algorithmProc)(const uint32_t*, size_t); 20 typedef uint32_t(*algorithmProc)(const uint32_t*, size_t);
(...skipping 22 matching lines...) Expand all
44 for (size_t j = 0; j < SK_ARRAY_COUNT(tweaked); ++j) { 43 for (size_t j = 0; j < SK_ARRAY_COUNT(tweaked); ++j) {
45 const uint32_t saved = tweaked[j]; 44 const uint32_t saved = tweaked[j];
46 tweaked[j] = rand.nextU(); 45 tweaked[j] = rand.nextU();
47 const uint32_t tweakedHash = algorithm(tweaked, kBytes); 46 const uint32_t tweakedHash = algorithm(tweaked, kBytes);
48 ASSERT(tweakedHash != hash); 47 ASSERT(tweakedHash != hash);
49 ASSERT(tweakedHash == algorithm(tweaked, kBytes)); 48 ASSERT(tweakedHash == algorithm(tweaked, kBytes));
50 tweaked[j] = saved; 49 tweaked[j] = saved;
51 } 50 }
52 } 51 }
53 } 52 }
OLDNEW
« no previous file with comments | « tests/CanvasTest.cpp ('k') | tests/ClampRangeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698