Lines Matching refs:map
13 // Tests use of const foreach(). map.count() is of course the better way to do this.
14 static int count(const SkTHashMap<int, double>& map) {
16 map.foreach([&n](int, double) { n++; });
21 SkTHashMap<int, double> map;
23 map.set(3, 4.0);
24 REPORTER_ASSERT(r, map.count() == 1);
26 REPORTER_ASSERT(r, map.approxBytesUsed() > 0);
28 double* found = map.find(3);
32 map.foreach([](int key, double* d){ *d = -key; });
33 REPORTER_ASSERT(r, count(map) == 1);
35 found = map.find(3);
39 REPORTER_ASSERT(r, !map.find(2));
44 map.set(i, 2.0*i);
47 double* found = map.find(i);
52 REPORTER_ASSERT(r, !map.find(i));
55 REPORTER_ASSERT(r, map.count() == N);
58 map.remove(i);
61 double* found = map.find(i);
64 REPORTER_ASSERT(r, map.count() == N/2);
66 map.reset();
67 REPORTER_ASSERT(r, map.count() == 0);