Lines Matching defs:bv
28 // Check the 'bv' == 's' and that the indexes go in increasing order.
29 // Also check the BV::Iterator
30 template <class BV>
31 static void CheckBV(const BV &bv, const set<uptr> &s) {
32 BV t;
33 t.copyFrom(bv);
35 uptr last_idx = bv.size();
37 for (typename BV::Iterator it(bv); it.hasNext();) {
40 if (last_idx != bv.size())
47 last_idx = bv.size();
50 if (last_idx != bv.size())
58 template <class BV>
59 void Print(const BV &bv) {
60 BV t;
61 t.copyFrom(bv);
76 template <class BV>
78 BV bv, bv1, t_bv;
79 EXPECT_EQ(expected_size, BV::kSize);
80 bv.clear();
81 EXPECT_TRUE(bv.empty());
82 bv.setBit(5);
83 EXPECT_FALSE(bv.empty());
84 EXPECT_FALSE(bv.getBit(4));
85 EXPECT_FALSE(bv.getBit(6));
86 EXPECT_TRUE(bv.getBit(5));
87 bv.clearBit(5);
88 EXPECT_FALSE(bv.getBit(5));
91 bv.clear();
94 uptr bit = ((uptr)my_rand() % bv.size());
95 EXPECT_EQ(bv.getBit(bit), s.count(bit) == 1);
98 EXPECT_EQ(bv.setBit(bit), s.insert(bit).second);
103 EXPECT_EQ(bv.clearBit(bit), old_size > s.size());
106 EXPECT_EQ(bv.getBit(bit), s.count(bit) == 1);
109 vector<uptr>bits(bv.size());
117 bv.clear();
119 uptr n_bits = ((uptr)my_rand() % bv.size()) + 1;
120 uptr n_bits1 = (uptr)my_rand() % (bv.size() / 2);
121 EXPECT_TRUE(n_bits > 0 && n_bits <= bv.size());
122 EXPECT_TRUE(n_bits1 < bv.size() / 2);
124 bv.setBit(bits[i]);
127 CheckBV(bv, s);
129 bv1.setBit(bits[bv.size() / 2 + i]);
130 s1.insert(bits[bv.size() / 2 + i]);
137 EXPECT_EQ(bv.intersectsWith(bv1), !vec.empty());
141 t_bv.copyFrom(bv);
148 t_bv.copyFrom(bv);
157 t_bv.copyFrom(bv);