about summary refs log tree commit diff stats
path: root/test/core/parse_asm.py
diff options
context:
space:
mode:
authorserpilliere <devnull@localhost>2014-06-03 10:27:56 +0200
committerserpilliere <devnull@localhost>2014-06-03 10:27:56 +0200
commited5c3668cc9f545b52674ad699fc2b0ed1ccb575 (patch)
tree07faf97d7e4d083173a1f7e1bfd249baed2d74f9 /test/core/parse_asm.py
parenta183e1ebd525453710306695daa8c410fd0cb2af (diff)
downloadmiasm-ed5c3668cc9f545b52674ad699fc2b0ed1ccb575.tar.gz
miasm-ed5c3668cc9f545b52674ad699fc2b0ed1ccb575.zip
Miasm v2
* API has changed, so old scripts need updates
* See example for API usage
* Use tcc or llvm for jit emulation
* Go to test and run test_all.py to check install

Enjoy !
Diffstat (limited to 'test/core/parse_asm.py')
-rw-r--r--test/core/parse_asm.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/core/parse_asm.py b/test/core/parse_asm.py
new file mode 100644
index 00000000..c2a6dc72
--- /dev/null
+++ b/test/core/parse_asm.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+
+import unittest
+
+
+class TestParseAsm(unittest.TestCase):
+
+    def test_ParseTxt(self):
+        from miasm2.arch.x86.arch import mn_x86
+        from miasm2.core.parse_asm import parse_txt
+
+        ASM0 = '''
+        ;
+        .LFB0:
+        .LA:
+        .text
+        .data
+        .bss
+        .string
+        .ustring
+        .byte 0 0x0
+        .byte a
+        .comm
+        .split
+        .dontsplit
+        .file
+        .cfi_0
+        label:
+            JMP EAX  ;comment
+        '''
+        ASM1 = '''
+        .XXX
+        '''
+        self.assertTrue(parse_txt(mn_x86, 32, ASM0))
+        self.assertRaises(ValueError, parse_txt, mn_x86, 32, ASM1)
+
+if __name__ == '__main__':
+    testsuite = unittest.TestLoader().loadTestsFromTestCase(TestParseAsm)
+    report = unittest.TextTestRunner(verbosity=2).run(testsuite)
+    exit(len(report.errors + report.failures))