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

Unified Diff: tests/DynamicHashTest.cpp

Issue 22571010: SkTDynamicHash: support remove() without needing Deleted(). (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: tweaks Created 7 years, 4 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') | tests/ImageCacheTest.cpp » ('j') | 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 4a8c3a01a28d316016eb7091ed6e39c17e052712..2425ea24cabf31e27da94b59ec84c4c08d53636a 100644
--- a/tests/DynamicHashTest.cpp
+++ b/tests/DynamicHashTest.cpp
@@ -36,23 +36,23 @@ static void test_growth(skiatest::Reporter* reporter) {
Entry d = { 4, 5.0 };
Entry e = { 5, 6.0 };
- Hash hash(0);
- ASSERT(hash.capacity() == 1);
+ Hash hash(4);
+ ASSERT(hash.capacity() == 4);
hash.add(&a);
- ASSERT(hash.capacity() == 2);
+ ASSERT(hash.capacity() == 4);
hash.add(&b);
ASSERT(hash.capacity() == 4);
hash.add(&c);
- ASSERT(hash.capacity() == 8);
+ ASSERT(hash.capacity() == 4);
hash.add(&d);
ASSERT(hash.capacity() == 8);
hash.add(&e);
- ASSERT(hash.capacity() == 16);
+ ASSERT(hash.capacity() == 8);
ASSERT(hash.count() == 5);
}
@@ -61,20 +61,12 @@ static void test_add(skiatest::Reporter* reporter) {
Hash hash;
Entry a = { 1, 2.0 };
Entry b = { 2, 3.0 };
- Entry c = { 1, 1.0 };
ASSERT(hash.count() == 0);
hash.add(&a);
ASSERT(hash.count() == 1);
hash.add(&b);
ASSERT(hash.count() == 2);
- hash.add(&c); // Overwrites a.
- ASSERT(hash.count() == 2);
-
- // Make sure the hash didn't modify the entries we inserted when overwriting.
- ASSERT(a.value == 2.0);
- ASSERT(b.value == 3.0);
- ASSERT(c.value == 1.0);
}
static void test_lookup(skiatest::Reporter* reporter) {
« no previous file with comments | « src/core/SkTDynamicHash.h ('k') | tests/ImageCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698