diff options
Diffstat (limited to 'lib/sanitizer_common/tests/sanitizer_bitvector_test.cc')
-rw-r--r-- | lib/sanitizer_common/tests/sanitizer_bitvector_test.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/sanitizer_common/tests/sanitizer_bitvector_test.cc b/lib/sanitizer_common/tests/sanitizer_bitvector_test.cc index d2d1a98ea..1637fa89d 100644 --- a/lib/sanitizer_common/tests/sanitizer_bitvector_test.cc +++ b/lib/sanitizer_common/tests/sanitizer_bitvector_test.cc @@ -26,12 +26,25 @@ using namespace std; // Check the 'bv' == 's' and that the indexes go in increasing order. +// Also check the BV::Iterator template <class BV> static void CheckBV(const BV &bv, const set<uptr> &s) { BV t; t.copyFrom(bv); set<uptr> t_s(s); uptr last_idx = bv.size(); + uptr count = 0; + for (typename BV::Iterator it(bv); it.hasNext();) { + uptr idx = it.next(); + count++; + if (last_idx != bv.size()) + EXPECT_LT(last_idx, idx); + last_idx = idx; + EXPECT_TRUE(s.count(idx)); + } + EXPECT_EQ(count, s.size()); + + last_idx = bv.size(); while (!t.empty()) { uptr idx = t.getAndClearFirstOne(); if (last_idx != bv.size()) |