Exemplo n.º 1
0
    def test_bitstring_xor(self):
        bs1 = Bitstring.init_random(1000)

        bs2 = Bitstring.init_ones(1000)
        bs3 = bs1.copy()
        bs3.xor(bs2)
        self.assertEqual(1000, bs1.distance_to(bs3))

        bs2 = Bitstring.init_zeros(1000)
        bs3 = bs1.copy()
        bs3.xor(bs2)
        self.assertEqual(0, bs1.distance_to(bs3))
Exemplo n.º 2
0
 def test_bitstring_init_zeros(self):
     bs1 = Bitstring.init_zeros(1000)
     cnt0 = bs1.to_binary().count('0')
     self.assertEqual(1000, cnt0)