aboutsummaryrefslogtreecommitdiffstats
path: root/asm_test.py
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2023-02-07 17:25:52 +0000
committerGravatar Peter McGoron 2023-02-07 17:25:52 +0000
commit96e8eb95b001d6dde82b40065f3a2ed40096d41a (patch)
tree35dbe0ace916106caf3bc43bbc3f7e40780ee002 /asm_test.py
parentasm.py: rename (diff)
assembler: refactor and start tests
Diffstat (limited to 'asm_test.py')
-rw-r--r--asm_test.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/asm_test.py b/asm_test.py
new file mode 100644
index 0000000..481875b
--- /dev/null
+++ b/asm_test.py
@@ -0,0 +1,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()