示例#1
0
 def test_constant(self):
     mock_obj = MockObject('PAGE_SIZE',
                           int_type('int', 4, True),
                           value=4096)
     prog = mock_program(objects=[mock_obj])
     self.assertEqual(prog['PAGE_SIZE'],
                      Object(prog, int_type('int', 4, True), value=4096))
     self.assertEqual(prog.object('PAGE_SIZE', FindObjectFlags.CONSTANT),
                      prog['PAGE_SIZE'])
     self.assertTrue('PAGE_SIZE' in prog)
示例#2
0
 def test_variable(self):
     mock_obj = MockObject("counter", int_type("int", 4, True), address=0xFFFF0000)
     prog = mock_program(objects=[mock_obj])
     self.assertEqual(
         prog["counter"], Object(prog, int_type("int", 4, True), address=0xFFFF0000)
     )
     self.assertEqual(
         prog.object("counter", FindObjectFlags.VARIABLE), prog["counter"]
     )
     self.assertTrue("counter" in prog)
示例#3
0
 def test_variable(self):
     mock_obj = MockObject('counter',
                           int_type('int', 4, True),
                           address=0xffff0000)
     prog = mock_program(objects=[mock_obj])
     self.assertEqual(
         prog['counter'],
         Object(prog, int_type('int', 4, True), address=0xffff0000))
     self.assertEqual(prog.object('counter', FindObjectFlags.VARIABLE),
                      prog['counter'])
     self.assertTrue('counter' in prog)
示例#4
0
 def test_function(self):
     mock_obj = MockObject(
         "func", function_type(void_type(), (), False), address=0xFFFF0000
     )
     prog = mock_program(objects=[mock_obj])
     self.assertEqual(
         prog["func"],
         Object(prog, function_type(void_type(), (), False), address=0xFFFF0000),
     )
     self.assertEqual(prog.object("func", FindObjectFlags.FUNCTION), prog["func"])
     self.assertTrue("func" in prog)
示例#5
0
 def test_constant(self):
     self.objects.append(
         MockObject("PAGE_SIZE", self.prog.int_type("int", 4, True), value=4096)
     )
     self.assertIdentical(
         self.prog["PAGE_SIZE"],
         Object(self.prog, self.prog.int_type("int", 4, True), value=4096),
     )
     self.assertIdentical(
         self.prog.object("PAGE_SIZE", FindObjectFlags.CONSTANT),
         self.prog["PAGE_SIZE"],
     )
     self.assertTrue("PAGE_SIZE" in self.prog)
示例#6
0
 def test_function(self):
     mock_obj = MockObject('func',
                           function_type(void_type(), (), False),
                           address=0xffff0000)
     prog = mock_program(objects=[mock_obj])
     self.assertEqual(
         prog['func'],
         Object(prog,
                function_type(void_type(), (), False),
                address=0xffff0000))
     self.assertEqual(prog.object('func', FindObjectFlags.FUNCTION),
                      prog['func'])
     self.assertTrue('func' in prog)
示例#7
0
 def test_variable(self):
     self.objects.append(
         MockObject(
             "counter", self.prog.int_type("int", 4, True), address=0xFFFF0000
         )
     )
     self.assertIdentical(
         self.prog["counter"],
         Object(self.prog, self.prog.int_type("int", 4, True), address=0xFFFF0000),
     )
     self.assertIdentical(
         self.prog.object("counter", FindObjectFlags.VARIABLE), self.prog["counter"]
     )
     self.assertTrue("counter" in self.prog)
示例#8
0
 def test_function(self):
     self.objects.append(
         MockObject(
             "func",
             self.prog.function_type(self.prog.void_type(), (), False),
             address=0xFFFF0000,
         ))
     self.assertEqual(
         self.prog["func"],
         Object(
             self.prog,
             self.prog.function_type(self.prog.void_type(), (), False),
             address=0xFFFF0000,
         ),
     )
     self.assertEqual(self.prog.object("func", FindObjectFlags.FUNCTION),
                      self.prog["func"])
     self.assertTrue("func" in self.prog)