Exemplo n.º 1
0
 def test_number_label_offset_default_radix(self):
     parser = AddressParser()
     parser.labels = {'foo': 0xC000}
     parser.radix = 16
     self.assertEqual(0xC010, parser.number('foo+10'))
     self.assertEqual(0xBFF0, parser.number('foo-10'))
     self.assertEqual(0xC010, parser.number('foo + 10'))
     self.assertEqual(0xBFF0, parser.number('foo - 10'))
     parser.radix = 10
     self.assertEqual(0xC00A, parser.number('foo+10'))
     self.assertEqual(0xBFF6, parser.number('foo-10'))
     self.assertEqual(0xC00A, parser.number('foo + 10'))
     self.assertEqual(0xBFF6, parser.number('foo - 10'))
Exemplo n.º 2
0
 def test_number_default_radix(self):
     parser = AddressParser()
     parser.radix = 10
     self.assertEqual(10, parser.number('10'))
     parser.radix = 16
     self.assertEqual(16, parser.number('10'))