aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-04-21 06:53:56 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-21 06:53:56 -0700
commit33d73c39dd3cca7594b3ad4304143872d5f7f570 (patch)
tree7b5cd5a03661a34c120fe4bd10f0ae26ae78d1db /tests
parentbc227140ffea6eb15e2e8b147eb6d8ec6228d95a (diff)
SkTHash: remove()
Diffstat (limited to 'tests')
-rw-r--r--tests/HashTest.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/HashTest.cpp b/tests/HashTest.cpp
index d2acafe08b..c1bdf884d8 100644
--- a/tests/HashTest.cpp
+++ b/tests/HashTest.cpp
@@ -52,6 +52,15 @@ DEF_TEST(HashMap, r) {
REPORTER_ASSERT(r, map.count() == N);
+ for (int i = 0; i < N/2; i++) {
+ map.remove(i);
+ }
+ for (int i = 0; i < N; i++) {
+ double* found = map.find(i);
+ REPORTER_ASSERT(r, (found == nullptr) == (i < N/2));
+ }
+ REPORTER_ASSERT(r, map.count() == N/2);
+
map.reset();
REPORTER_ASSERT(r, map.count() == 0);
}
@@ -71,6 +80,10 @@ DEF_TEST(HashSet, r) {
REPORTER_ASSERT(r, set.find(SkString("Hello")));
REPORTER_ASSERT(r, *set.find(SkString("Hello")) == SkString("Hello"));
+ set.remove(SkString("Hello"));
+ REPORTER_ASSERT(r, !set.contains(SkString("Hello")));
+ REPORTER_ASSERT(r, set.count() == 1);
+
set.reset();
REPORTER_ASSERT(r, set.count() == 0);
}