diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2017-06-08 09:03:43 +0200 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2017-06-14 09:57:12 +0200 |
| commit | 8e8e6e472bec908eb9cc63cb3a8c042ba5b93279 (patch) | |
| tree | 648689e0c8a2658d8a57b698bd1d1f6ed5dd39ee /test/expression/parser.py | |
| parent | 97e997810abbcaef5672893941e8f4d8a13f8946 (diff) | |
| download | focaccia-miasm-8e8e6e472bec908eb9cc63cb3a8c042ba5b93279.tar.gz focaccia-miasm-8e8e6e472bec908eb9cc63cb3a8c042ba5b93279.zip | |
Expression: add an Expression parser
Diffstat (limited to 'test/expression/parser.py')
| -rw-r--r-- | test/expression/parser.py | 16 |
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 |