aboutsummaryrefslogtreecommitdiffstats
path: root/asm/test.py
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2023-02-11 21:24:48 +0000
committerGravatar Peter McGoron 2023-02-11 21:24:48 +0000
commitb425e26ea3ff2df3f6b98b475ae870900efaf2e6 (patch)
treed134435547ee287f23b237b4be0c14bd353d87a7 /asm/test.py
parentrename idiv to sdiv (diff)
jump tests
Diffstat (limited to 'asm/test.py')
-rw-r--r--asm/test.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/asm/test.py b/asm/test.py
index 4b6471c..00e9e5e 100644
--- a/asm/test.py
+++ b/asm/test.py
@@ -309,6 +309,22 @@ class DivTest(unittest.TestCase):
self.assertEqual(cm.exception.i, 2)
self.assertEqual(cm.exception.opcode, 5)
+class LabelTest(unittest.TestCase):
+ def test_simple_loop(self):
+ p = Program()
+ p.parse_lines([
+ "add r0 10 0",
+ "add r1 20 0",
+ "CLB l0",
+ "add r0 r0 -1",
+ "add r1 r1 1",
+ "jg l0 r0 0"
+ ])
+ ex = ffi.Environment(p())
+ self.assertEqual(ex(), ffi.RunRet.STOP)
+ self.assertEqual(ex.getreg(0), 0)
+ self.assertEqual(ex.getreg(1), 30)
+
class ProgramTest(unittest.TestCase):
def test_exec_simple_reg(self):
p = Program()