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

Side by Side Diff: tests/GrBinHashKeyTest.cpp

Issue 861323002: Remove GrBinHashKey (Closed) Base URL: https://skia.googlesource.com/skia.git@content
Patch Set: Created 5 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
« no previous file with comments | « src/gpu/GrMurmur3HashKey.h ('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
(Empty)
1 /*
2 * Copyright 2010 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 // This is a GPU-backend specific test
9 #if SK_SUPPORT_GPU
10
11 #include "GrMurmur3HashKey.h"
12 #include "GrBinHashKey.h"
13
14 #include "Test.h"
15
16 struct AlignedKey {
17 uint32_t align;
18 char key[8];
19 };
20
21 template<typename KeyType> static void TestHash(skiatest::Reporter* reporter) {
22 AlignedKey a, b;
23 memcpy(&a.key, "abcdABCD", 8);
24 memcpy(&b.key, "abcdBBCD", 8);
25 const uint32_t* testStringA = reinterpret_cast<const uint32_t*>(&a.key);
26 const uint32_t* testStringB = reinterpret_cast<const uint32_t*>(&b.key);
27
28 KeyType keyA;
29 keyA.setKeyData(testStringA);
30 // test copy constructor and comparison
31 KeyType keyA2(keyA);
32 REPORTER_ASSERT(reporter, keyA == keyA2);
33 REPORTER_ASSERT(reporter, keyA.getHash() == keyA2.getHash());
34 // test re-init
35 keyA2.setKeyData(testStringA);
36 REPORTER_ASSERT(reporter, keyA == keyA2);
37 REPORTER_ASSERT(reporter, keyA.getHash() == keyA2.getHash());
38 // test sorting
39 KeyType keyB;
40 keyB.setKeyData(testStringB);
41 REPORTER_ASSERT(reporter, keyA.getHash() != keyB.getHash());
42 }
43
44
45 DEF_TEST(GrBinHashKey, reporter) {
46 enum {
47 kDataLenUsedForKey = 8
48 };
49
50 TestHash<GrBinHashKey<kDataLenUsedForKey> >(reporter);
51 TestHash<GrMurmur3HashKey<kDataLenUsedForKey> >(reporter);
52 }
53
54 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrMurmur3HashKey.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698