Beispiel #1
0
 def test_deserialize(self):
     h = HyperLogLog(4)
     h.digest(FakeHash(123))
     h.digest(FakeHash(33))
     h.digest(FakeHash(12))
     h.digest(FakeHash(0xfffffff1))
     buf = bytearray(h.bytesize())
     h.serialize(buf)
     hd = HyperLogLog.deserialize(buf)
     self.assertEqual(hd.p, h.p)
     self.assertEqual(hd.m, h.m)
     self.assertTrue(all(i == j for i, j in zip(h.reg, hd.reg)))
Beispiel #2
0
 def test_deserialize(self):
     h = HyperLogLog(4)
     h.digest(FakeHash(123))
     h.digest(FakeHash(33))
     h.digest(FakeHash(12))
     h.digest(FakeHash(0xfffffffffffffff1))
     buf = bytearray(h.bytesize())
     h.serialize(buf)
     hd = HyperLogLog.deserialize(buf)
     self.assertEqual(hd.p, h.p)
     self.assertEqual(hd.m, h.m)
     self.assertTrue(all(i == j for i, j in zip(h.reg, hd.reg)))
Beispiel #3
0
 def test_serialize(self):
     h = HyperLogLog(4)
     buf = bytearray(h.bytesize())
     h.serialize(buf)
     self.assertEqual(h.p, struct.unpack_from('B', buf, 0)[0])
Beispiel #4
0
 def test_serialize(self):
     h = HyperLogLog(4)
     buf = bytearray(h.bytesize())
     h.serialize(buf)
     self.assertEqual(h.p, struct.unpack_from('B', buf, 0)[0])