aboutsummaryrefslogtreecommitdiffstats
path: root/asm_test.py
blob: 481875b3b9ef42fd4f4c029f81f0e0339b109ad7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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()