def test_bit_or(self):
     function = BoolFunction(examples.bit_or)
     for a in range(2):
         for b in range(2):
             result = function.simulate(BitVec(1, a), BitVec(1, b))
             tmp = BitVec(1, a) | BitVec(1, b)
             self.assertEqual(result, [bool(tmp[0])])
 def test_bit_xor_2bit(self):
     function = BoolFunction(examples.bit_xor_2bit)
     for a in range(4):
         for b in range(4):
             result = function.simulate(BitVec(2, a), BitVec(2, b))
             tmp = BitVec(2, a) ^ BitVec(2, b)
             self.assertEqual(result, [bool(tmp[0]), bool(tmp[1])])
 def test_bit_not_2bit(self):
     function = BoolFunction(examples.bit_not_2bit)
     for a in range(4):
         tmp = BitVec(2, a)
         result = function.simulate(tmp)
         self.assertEqual(result, [not tmp[0], not tmp[1]])
 def test_bit_not(self):
     function = BoolFunction(examples.bit_not)
     result = function.simulate(BitVec(1, '0'))
     self.assertEqual(result, [True])
     result = function.simulate(BitVec(1, '1'))
     self.assertEqual(result, [False])
 def test_id_2bit(self):
     function = BoolFunction(examples.identity_2bit)
     for a in range(4):
         tmp = BitVec(2, a)
         result = function.simulate(tmp)
         self.assertEqual(result, [bool(tmp[0]), bool(tmp[1])])
 def test_id(self):
     function = BoolFunction(examples.identity)
     result = function.simulate(BitVec(1, '0'))
     self.assertEqual(result, [False])
     result = function.simulate(BitVec(1, '1'))
     self.assertEqual(result, [True])
 def test_constant_2bit(self):
     function = BoolFunction(examples.constant_2bit)
     result = function.simulate()
     self.assertEqual(result, [False, True])