about summary refs log tree commit diff stats
path: root/test/expression/parser.py
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2017-06-17 17:36:16 +0200
committerGitHub <noreply@github.com>2017-06-17 17:36:16 +0200
commit4c1a445b1062cd154ed3fc11ed9887f94c008479 (patch)
tree153131a6e8a00e685ff3e87bc0bda1e85ee64f69 /test/expression/parser.py
parent41c68e939dcea2c56d44da0fdd89b6c2e51ad696 (diff)
parent1b31144531590ba3b1f1645cc4042b070b51704b (diff)
downloadmiasm-4c1a445b1062cd154ed3fc11ed9887f94c008479.tar.gz
miasm-4c1a445b1062cd154ed3fc11ed9887f94c008479.zip
Merge pull request #567 from serpilliere/exec_engine
Exec engine
Diffstat (limited to '')
-rw-r--r--test/expression/parser.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/expression/parser.py b/test/expression/parser.py
new file mode 100644
index 00000000..9c01c8a1
--- /dev/null
+++ b/test/expression/parser.py
@@ -0,0 +1,16 @@
+from miasm2.expression.parser import str_to_expr
+from miasm2.expression.expression import ExprInt, ExprId, ExprSlice, ExprMem, \
+    ExprCond, ExprCompose, ExprOp, ExprAff
+
+for expr_test in [ExprInt(0x12, 32),
+                  ExprId('test', 32),
+                  ExprSlice(ExprInt(0x10, 32), 0, 8),
+                  ExprMem(ExprInt(0x10, 32), 32),
+                  ExprCond(ExprInt(0x10, 32), ExprInt(0x11, 32), ExprInt(0x12, 32)),
+                  ExprCompose(ExprInt(0x10, 16), ExprInt(0x11, 8), ExprInt(0x12, 8)),
+                  ExprInt(0x11, 8) + ExprInt(0x12, 8),
+                  ExprAff(ExprId('EAX', 32),  ExprInt(0x12, 32)),
+                  ]:
+
+    print 'Test: %s' % expr_test
+    assert str_to_expr(repr(expr_test)) == expr_test