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

Unified Diff: tests/DynamicHashTest.cpp

Issue 136403004: Allocate memory in SkTDynamicHash on first use. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add missing this Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkTDynamicHash.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/DynamicHashTest.cpp
diff --git a/tests/DynamicHashTest.cpp b/tests/DynamicHashTest.cpp
index 5e92ace308cd55a4697319bed19464b59c665868..d881738219b6526b889663bf05b7bf5b25d65f18 100644
--- a/tests/DynamicHashTest.cpp
+++ b/tests/DynamicHashTest.cpp
@@ -23,7 +23,6 @@ bool AreEqual(const Entry& entry, const int& key) { return entry.key == key; }
class Hash : public SkTDynamicHash<Entry, int, GetKey, GetHash, AreEqual> {
public:
Hash() : INHERITED() {}
- Hash(int capacity) : INHERITED(capacity) {}
// Promote protected methods to public for this test.
int capacity() const { return this->INHERITED::capacity(); }
@@ -44,8 +43,8 @@ static void test_growth(skiatest::Reporter* reporter) {
Entry d = { 4, 5.0 };
Entry e = { 5, 6.0 };
- Hash hash(4);
- ASSERT(hash.capacity() == 4);
+ Hash hash;
+ ASSERT(hash.capacity() == 0);
hash.add(&a);
ASSERT(hash.capacity() == 4);
@@ -78,8 +77,7 @@ static void test_add(skiatest::Reporter* reporter) {
}
static void test_lookup(skiatest::Reporter* reporter) {
- Hash hash(4);
- ASSERT(hash.capacity() == 4);
+ Hash hash;
// These collide.
Entry a = { 1, 2.0 };
@@ -114,8 +112,7 @@ static void test_lookup(skiatest::Reporter* reporter) {
}
static void test_remove(skiatest::Reporter* reporter) {
- Hash hash(4);
- ASSERT(hash.capacity() == 4);
+ Hash hash;
// These collide.
Entry a = { 1, 2.0 };
« no previous file with comments | « src/core/SkTDynamicHash.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698