def test_write(self): self.bv = shellinford.bit_vector() filename = tempfile.mkstemp()[1] self.bv.set(1) self.bv.build() self.bv.write(filename) assert_true(len(open(filename, 'r').read()) > 0) os.remove(filename)
def test_select(self): self.bv = shellinford.bit_vector() self.bv.set(1) self.bv.set(1) self.bv.set(10) self.bv.set(100) self.bv.build() assert_equal(self.bv.select(1), 10)
def test_read(self): self.bv = shellinford.bit_vector() filename = tempfile.mkstemp()[1] self.bv.set(100) self.bv.build() self.bv.write(filename) self.bv.clear() self.bv.read(filename) assert_true(self.bv.get(100)) os.remove(filename)
def test_get(self): self.bv = shellinford.bit_vector() self.bv.set(100) assert_true(self.bv.get(100))
def test_set(self): self.bv = shellinford.bit_vector() self.bv.set(1) assert_equal(self.bv.size(), 2)
def test_size(self): self.bv = shellinford.bit_vector() self.bv.set(1) self.bv.build() assert_equal(self.bv.size(), 2) assert_equal(self.bv.size(True), 1)
def test_clear(self): self.bv = shellinford.bit_vector() self.bv.set(1) self.bv.clear() assert_equal(self.bv.size(), 0)