Home | History | Annotate | Download | only in disk_cache

Lines Matching refs:map

19   disk_cache::Bitmap map;
20 EXPECT_EQ(0, map.Size());
21 EXPECT_EQ(0, map.ArraySize());
22 EXPECT_TRUE(NULL == map.GetMap());
59 disk_cache::Bitmap map(kSize, true);
61 map.Toggle(i);
63 map.Toggle(i);
65 EXPECT_EQ((i % 3 == 0) && (i % 9 != 0), map.Get(i));
72 disk_cache::Bitmap map(kSize1, true);
73 map.Resize(kSize1, true);
74 EXPECT_EQ(kSize1, map.Size());
75 EXPECT_FALSE(map.Get(0));
76 EXPECT_FALSE(map.Get(kSize1 - 1));
78 map.Resize(kSize2, true);
79 EXPECT_FALSE(map.Get(kSize1 - 1));
80 EXPECT_FALSE(map.Get(kSize1));
81 EXPECT_FALSE(map.Get(kSize2 - 1));
82 EXPECT_EQ(kSize2, map.Size());
84 map.Resize(kSize3, true);
85 EXPECT_FALSE(map.Get(kSize3 - 1));
86 EXPECT_EQ(kSize3, map.Size());
89 TEST(BitmapTest, Map) {
125 disk_cache::Bitmap map(kMapSize * 8, true);
126 EXPECT_EQ(0, memcmp(zeros, map.GetMap(), kMapSize));
127 map.SetAll(true);
128 EXPECT_EQ(0, memcmp(ones, map.GetMap(), kMapSize));
129 map.SetAll(false);
130 EXPECT_EQ(0, memcmp(zeros, map.GetMap(), kMapSize));
131 map.SetAll(true);
132 map.Clear();
133 EXPECT_EQ(0, memcmp(zeros, map.GetMap(), kMapSize));
138 disk_cache::Bitmap map(100, true);
139 EXPECT_FALSE(map.TestRange(0, 100, true));
140 map.Set(50, true);
141 EXPECT_TRUE(map.TestRange(0, 100, true));
143 map.SetAll(false);
144 EXPECT_FALSE(map.TestRange(0, 1, true));
145 EXPECT_FALSE(map.TestRange(30, 31, true));
146 EXPECT_FALSE(map.TestRange(98, 99, true));
147 EXPECT_FALSE(map.TestRange(99, 100, true));
148 EXPECT_FALSE(map.TestRange(0, 100, true));
150 EXPECT_TRUE(map.TestRange(0, 1, false));
151 EXPECT_TRUE(map.TestRange(31, 32, false));
152 EXPECT_TRUE(map.TestRange(32, 33, false));
153 EXPECT_TRUE(map.TestRange(99, 100, false));
154 EXPECT_TRUE(map.TestRange(0, 32, false));
156 map.SetRange(11, 21, true);
158 EXPECT_EQ(map.Get(i), (i >= 11) && (i < 21));
160 EXPECT_TRUE(map.TestRange(0, 32, true));
161 EXPECT_TRUE(map.TestRange(0, 100, true));
162 EXPECT_TRUE(map.TestRange(11, 21, true));
163 EXPECT_TRUE(map.TestRange(15, 16, true));
164 EXPECT_TRUE(map.TestRange(5, 12, true));
165 EXPECT_TRUE(map.TestRange(5, 11, false));
166 EXPECT_TRUE(map.TestRange(20, 60, true));
167 EXPECT_TRUE(map.TestRange(21, 60, false));
169 map.SetAll(true);
170 EXPECT_FALSE(map.TestRange(0, 100, false));
172 map.SetRange(70, 99, false);
173 EXPECT_TRUE(map.TestRange(69, 99, false));
174 EXPECT_TRUE(map.TestRange(70, 100, false));
175 EXPECT_FALSE(map.TestRange(70, 99, true));
181 disk_cache::Bitmap map(500, true);
183 map.Set(i, (i % 27) == 0);
186 for (int index = 111; map.FindNextSetBitBeforeLimit(&index, 278);
196 disk_cache::Bitmap map(256, true);
198 map.Set(i, (i % 32) == 0);
201 EXPECT_FALSE(map.FindNextSetBitBeforeLimit(&index, i + 32));
206 // Test FindNextSetBit. Check all bits in map. Should find multiples
208 disk_cache::Bitmap map(100, true);
210 map.Set(i, (i % 7) == 0);
213 for (int index = 0; map.FindNextSetBit(&index); ++index) {
222 disk_cache::Bitmap map(100, false);
223 map.SetAll(true);
225 map.Set(i, (i % 7) != 0);
228 for (int index = 0; map.FindNextBit(&index, 100, false); ++index) {