9ea53f93e7
That way when declaring a test with DEF_TEST() macro, you don't have to uniquify the test name because it might colide with the class it is being testing. For example, if you are testing SkBase64 and do: DEF_TEST(SkBase64, reporter) { } That will generate an error because the macro will declare a function named SkBase64 which colides with the type SkBase64. By adding Test to the function name we avoid this problem. Fixed the entries found with the following command line: $ git grep "Test, r" | grep DEF BUG=None TEST=make tests && out/Debug/tests R=mtklein@google.com Author: tfarina@chromium.org Review URL: https://codereview.chromium.org/345753007
42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
/*
|
|
* Copyright 2010 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
// This is a GPU-backend specific test
|
|
#if SK_SUPPORT_GPU
|
|
|
|
#include "GrBinHashKey.h"
|
|
|
|
#include "Test.h"
|
|
|
|
DEF_TEST(GrBinHashKey, reporter) {
|
|
const char* testStringA_ = "abcdABCD";
|
|
const char* testStringB_ = "abcdBBCD";
|
|
const uint32_t* testStringA = reinterpret_cast<const uint32_t*>(testStringA_);
|
|
const uint32_t* testStringB = reinterpret_cast<const uint32_t*>(testStringB_);
|
|
enum {
|
|
kDataLenUsedForKey = 8
|
|
};
|
|
|
|
GrBinHashKey<kDataLenUsedForKey> keyA;
|
|
keyA.setKeyData(testStringA);
|
|
// test copy constructor and comparison
|
|
GrBinHashKey<kDataLenUsedForKey> keyA2(keyA);
|
|
REPORTER_ASSERT(reporter, keyA == keyA2);
|
|
REPORTER_ASSERT(reporter, keyA.getHash() == keyA2.getHash());
|
|
// test re-init
|
|
keyA2.setKeyData(testStringA);
|
|
REPORTER_ASSERT(reporter, keyA == keyA2);
|
|
REPORTER_ASSERT(reporter, keyA.getHash() == keyA2.getHash());
|
|
// test sorting
|
|
GrBinHashKey<kDataLenUsedForKey> keyB;
|
|
keyB.setKeyData(testStringB);
|
|
REPORTER_ASSERT(reporter, keyA < keyB);
|
|
REPORTER_ASSERT(reporter, keyA.getHash() != keyB.getHash());
|
|
}
|
|
|
|
#endif
|