Exemple #1
0
 def test_bitvec(self):
     r = Register(32)
     b = BitVecConstant(size=32, value=0)
     r.write(b)
     self.assertIs(r.read(), b)
Exemple #2
0
 def test_rd(self):
     r = Register(32)
     self.assertEqual(r.read(), 0)
Exemple #3
0
 def test_Bool(self):
     r = Register(32)
     b = BoolVariable(name="B")
     r.write(b)
     self.assertIs(r.read(), b)
Exemple #4
0
 def test_bitvec_flag(self):
     r = Register(1)
     b = BitVecConstant(size=32, value=0)
     r.write(b)
     # __nonzero__ (==) currently unimplemented for Bool
     self.assertTrue(isinstance(r.read(), Bool))
Exemple #5
0
 def test_flag_trunc(self):
     r = Register(1)
     r.write(3)
     self.assertEqual(r.read(), True)
Exemple #6
0
 def test_bool_write_nonflag(self):
     r = Register(32)
     r.write(True)
     self.assertEqual(r.read(), True)
Exemple #7
0
 def test_flag(self):
     r = Register(1)
     self.assertEqual(r.read(), False)
Exemple #8
0
 def test_largest_write(self):
     r = Register(32)
     r.write(0xFFFFFFFF)
     self.assertEqual(r.read(), 0xFFFFFFFF)
Exemple #9
0
 def test_truncate(self):
     r = Register(32)
     r.write(2 ** 32)
     self.assertEqual(r.read(), 0)
Exemple #10
0
 def test_basic_write(self):
     r = Register(32)
     r.write(1)
     self.assertEqual(r.read(), 1)
Exemple #11
0
 def test_Bool(self):
     r = Register(32)
     b = Bool()
     r.write(b)
     self.assertIs(r.read(), b)