about summary refs log tree commit diff stats
path: root/test/arch/mips32/unit/mn_bcc.py
diff options
context:
space:
mode:
authorCamille Mougey <commial@gmail.com>2015-10-28 09:01:03 +0100
committerCamille Mougey <commial@gmail.com>2015-10-28 09:01:03 +0100
commit89b7cc0b3bdcff8ef57dba232c9aae544c3ded35 (patch)
treeeddb33c00193081e0bb616f3f34460858822c304 /test/arch/mips32/unit/mn_bcc.py
parent3f9071a50671bb7a72d68e2dece83795aa9f9728 (diff)
parent1507343ca4b2d437ca51c137ce8be68dd5bcb9da (diff)
downloadmiasm-89b7cc0b3bdcff8ef57dba232c9aae544c3ded35.tar.gz
miasm-89b7cc0b3bdcff8ef57dba232c9aae544c3ded35.zip
Merge pull request #243 from serpilliere/fix_mips_br
Fix mips br
Diffstat (limited to 'test/arch/mips32/unit/mn_bcc.py')
-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]]