2 * Copyright 2010 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 // This is a GPU-backend specific test
11 #include "GrMurmur3HashKey.h"
12 #include "GrBinHashKey.h"
16 template<typename KeyType> static void TestHash(skiatest::Reporter* reporter) {
17 const char* testStringA_ = "abcdABCD";
18 const char* testStringB_ = "abcdBBCD";
19 const uint32_t* testStringA = reinterpret_cast<const uint32_t*>(testStringA_);
20 const uint32_t* testStringB = reinterpret_cast<const uint32_t*>(testStringB_);
23 keyA.setKeyData(testStringA);
24 // test copy constructor and comparison
26 REPORTER_ASSERT(reporter, keyA == keyA2);
27 REPORTER_ASSERT(reporter, keyA.getHash() == keyA2.getHash());
29 keyA2.setKeyData(testStringA);
30 REPORTER_ASSERT(reporter, keyA == keyA2);
31 REPORTER_ASSERT(reporter, keyA.getHash() == keyA2.getHash());
34 keyB.setKeyData(testStringB);
35 REPORTER_ASSERT(reporter, keyA.getHash() != keyB.getHash());
39 DEF_TEST(GrBinHashKey, reporter) {
41 kDataLenUsedForKey = 8
44 TestHash<GrBinHashKey<kDataLenUsedForKey> >(reporter);
45 TestHash<GrMurmur3HashKey<kDataLenUsedForKey> >(reporter);