about summary refs log tree commit diff stats
path: root/test/arch/mips32/unit/mn_bcc.py
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2015-10-26 20:39:57 +0100
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2015-10-27 21:25:08 +0100
commitcfb77ea2340ecaa9f15c476e56474f63160e1d69 (patch)
tree020da4c85a6454f3f1ed700a1773a162335dc742 /test/arch/mips32/unit/mn_bcc.py
parent31baf840e8badd6789754379aa28b07c66a80244 (diff)
downloadmiasm-cfb77ea2340ecaa9f15c476e56474f63160e1d69.tar.gz
miasm-cfb77ea2340ecaa9f15c476e56474f63160e1d69.zip
Test/mips/unit: add jcc tests
Diffstat (limited to '')
-rw-r--r--test/arch/mips32/unit/mn_bcc.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/arch/mips32/unit/mn_bcc.py b/test/arch/mips32/unit/mn_bcc.py
new file mode 100644
index 00000000..729f3679
--- /dev/null
+++ b/test/arch/mips32/unit/mn_bcc.py
@@ -0,0 +1,32 @@
+#! /usr/bin/env python
+from asm_test import Asm_Test
+
+
+class Test_BCC(Asm_Test):
+    MYSTRING = "test string"
+    TXT = '''
+    main:
+      ADDIU   A0, V0, mystr
+strlen:
+      LBU     V0, 0(A0)
+      BEQ     V0, ZERO, SKIP
+      ADDU    V1, ZERO, ZERO
+loop:
+      ADDIU   A0, A0, 1
+      LBU     V0, 0(A0)
+      BNE     V0, ZERO, loop
+      ADDIU   V1, V1, 1
+SKIP:
+      JR      RA
+      ADDU    V0, V1, ZERO
+
+    mystr:
+    .string "%s"
+    ''' % MYSTRING
+
+    def check(self):
+        assert(self.myjit.cpu.V0 == len(self.MYSTRING))
+
+
+if __name__ == "__main__":
+    [test()() for test in [Test_BCC]]