creole/asm_test.py

18 lines
415 B
Python
Raw Normal View History

2023-02-07 12:25:52 -05:00
from creole_asm import *
import unittest
class ProgramTest(unittest.TestCase):
def test_oneline(self):
p = Program()
p.parse_asm_line("PUSH r0")
b = p()
self.assertEqual(b, b'\x01\xC2\x80\x00')
def test_large_reg(self):
p = Program(regnum=0x8000000)
p.parse_asm_line("PUSH r134217727")
b = p()
self.assertEqual(b, b'\x01\xFC\x87\xbf\xbf\xbf\xbf\x00')
if __name__ == "__main__":
unittest.main()