| Index: tests/HashTest.cpp
|
| diff --git a/tests/HashTest.cpp b/tests/HashTest.cpp
|
| index c9b1bc967bd852bbf848e8c2f166d8e05da70187..70567c7522df8a76521cac98edf182a1969b1e2e 100644
|
| --- a/tests/HashTest.cpp
|
| +++ b/tests/HashTest.cpp
|
| @@ -90,67 +90,3 @@ DEF_TEST(HashSet, r) {
|
| REPORTER_ASSERT(r, set.count() == 0);
|
| }
|
|
|
| -namespace {
|
| -
|
| -class CopyCounter {
|
| -public:
|
| - CopyCounter() : fID(0), fCounter(nullptr) {}
|
| -
|
| - CopyCounter(uint32_t id, uint32_t* counter) : fID(id), fCounter(counter) {}
|
| -
|
| - CopyCounter(const CopyCounter& other)
|
| - : fID(other.fID)
|
| - , fCounter(other.fCounter) {
|
| - SkASSERT(fCounter);
|
| - *fCounter += 1;
|
| - }
|
| -
|
| - void operator=(const CopyCounter& other) {
|
| - fID = other.fID;
|
| - fCounter = other.fCounter;
|
| - *fCounter += 1;
|
| - }
|
| -
|
| - bool operator==(const CopyCounter& other) const {
|
| - return fID == other.fID;
|
| - }
|
| -
|
| -private:
|
| - uint32_t fID;
|
| - uint32_t* fCounter;
|
| -};
|
| -
|
| -struct HashCopyCounter {
|
| - uint32_t operator()(const CopyCounter&) const {
|
| - return 0; // let them collide, what do we care?
|
| - }
|
| -};
|
| -
|
| -}
|
| -
|
| -DEF_TEST(HashSetCopyCounter, r) {
|
| - SkTHashSet<CopyCounter, HashCopyCounter> set;
|
| -
|
| - uint32_t globalCounter = 0;
|
| - CopyCounter copyCounter1(1, &globalCounter);
|
| - CopyCounter copyCounter2(2, &globalCounter);
|
| - REPORTER_ASSERT(r, globalCounter == 0);
|
| -
|
| - set.add(copyCounter1);
|
| - REPORTER_ASSERT(r, globalCounter == 1);
|
| - REPORTER_ASSERT(r, set.contains(copyCounter1));
|
| - REPORTER_ASSERT(r, globalCounter == 1);
|
| - set.add(copyCounter1);
|
| - // We allow copies for same-value adds for now.
|
| - REPORTER_ASSERT(r, globalCounter == 2);
|
| -
|
| - set.add(copyCounter2);
|
| - REPORTER_ASSERT(r, globalCounter == 3);
|
| - REPORTER_ASSERT(r, set.contains(copyCounter1));
|
| - REPORTER_ASSERT(r, set.contains(copyCounter2));
|
| - REPORTER_ASSERT(r, globalCounter == 3);
|
| - set.add(copyCounter1);
|
| - set.add(copyCounter2);
|
| - // We allow copies for same-value adds for now.
|
| - REPORTER_ASSERT(r, globalCounter == 5);
|
| -}
|
|
|