Beispiel #1
0
 def test_number_label_bin_offset(self):
     parser = AddressParser()
     parser.labels = {'foo': 0xC000}
     self.assertEqual(0xC003, parser.number('foo+%00000011'))
     self.assertEqual(0xBFFD, parser.number('foo-%00000011'))
     self.assertEqual(0xC003, parser.number('foo + %00000011'))
     self.assertEqual(0xBFFD, parser.number('foo - %00000011'))
Beispiel #2
0
 def test_number_bad_label_with_offset(self):
     parser = AddressParser()
     try:
         parser.number('bad_label+3')
         self.fail()
     except KeyError as exc:
         self.assertEqual('Label not found: bad_label', exc.args[0])
Beispiel #3
0
 def test_number_bad_label_syntax(self):
     parser = AddressParser()
     parser.labels = {'foo': 0xFFFF}
     try:
         parser.number('#$foo')
         self.fail()
     except KeyError as exc:
         self.assertEqual('Label not found: #$foo', exc.args[0])
Beispiel #4
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'))
Beispiel #5
0
 def test_number_label(self):
     parser = AddressParser()
     parser.labels = {'foo': 0xC000}
     self.assertEqual(0xC000, parser.number('foo'))
Beispiel #6
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'))
Beispiel #7
0
 def test_number_bin_literal(self):
     parser = AddressParser()
     self.assertEqual(129, parser.number('%10000001'))
Beispiel #8
0
 def test_number_dec_literal(self):
     parser = AddressParser()
     self.assertEqual(49152, parser.number('+49152'))
Beispiel #9
0
 def test_number_hex_literal(self):
     parser = AddressParser()
     self.assertEqual(49152, parser.number('$c000'))