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

Side by Side Diff: tests/ChecksumTest.cpp

Issue 2226783002: add missing include (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | 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 * 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 "SkOpts.h" 9 #include "SkOpts.h"
9 #include "SkRandom.h" 10 #include "SkRandom.h"
10 #include "Test.h" 11 #include "Test.h"
11 12
12 DEF_TEST(Checksum, r) { 13 DEF_TEST(Checksum, r) {
13 // Put 128 random bytes into two identical buffers. Any multiple of 4 will do. 14 // Put 128 random bytes into two identical buffers. Any multiple of 4 will do.
14 const size_t kBytes = SkAlign4(128); 15 const size_t kBytes = SkAlign4(128);
15 SkRandom rand; 16 SkRandom rand;
16 uint32_t data[kBytes/4], tweaked[kBytes/4]; 17 uint32_t data[kBytes/4], tweaked[kBytes/4];
17 for (size_t i = 0; i < SK_ARRAY_COUNT(tweaked); ++i) { 18 for (size_t i = 0; i < SK_ARRAY_COUNT(tweaked); ++i) {
(...skipping 16 matching lines...) Expand all
34 REPORTER_ASSERT(r, tweakedHash == SkOpts::hash(tweaked, kBytes)); 35 REPORTER_ASSERT(r, tweakedHash == SkOpts::hash(tweaked, kBytes));
35 tweaked[j] = saved; 36 tweaked[j] = saved;
36 } 37 }
37 } 38 }
38 39
39 DEF_TEST(GoodHash, r) { 40 DEF_TEST(GoodHash, r) {
40 // 4 bytes --> hits SkChecksum::Mix fast path. 41 // 4 bytes --> hits SkChecksum::Mix fast path.
41 REPORTER_ASSERT(r, SkGoodHash()(( int32_t)4) == 614249093); 42 REPORTER_ASSERT(r, SkGoodHash()(( int32_t)4) == 614249093);
42 REPORTER_ASSERT(r, SkGoodHash()((uint32_t)4) == 614249093); 43 REPORTER_ASSERT(r, SkGoodHash()((uint32_t)4) == 614249093);
43 } 44 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698