about summary refs log tree commit diff stats
path: root/test/expression/simplifications.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/expression/simplifications.py')
-rw-r--r--test/expression/simplifications.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/expression/simplifications.py b/test/expression/simplifications.py
index 5bca3fa9..263479b7 100644
--- a/test/expression/simplifications.py
+++ b/test/expression/simplifications.py
@@ -101,6 +101,10 @@ i3 = ExprInt(3, 32)
 im1 = ExprInt(-1, 32)
 im2 = ExprInt(-2, 32)
 
+bi0 = ExprInt(0, 1)
+bi1 = ExprInt(1, 1)
+
+
 icustom = ExprInt(0x12345678, 32)
 cc = ExprCond(a, b, c)
 
@@ -692,6 +696,33 @@ to_test = [
 
     (a8.zeroExtend(32)[2:5], a8[2:5]),
 
+
+    (
+        ExprCond(a + b, a, b),
+        ExprCond(ExprOp(TOK_EQUAL, a, -b), b, a)
+    ),
+
+    (
+        ExprCond(a + i1, a, b),
+        ExprCond(ExprOp(TOK_EQUAL, a, im1), b, a)
+    ),
+
+
+    (
+        ExprCond(ExprOp(TOK_EQUAL, a, i1), bi1, bi0),
+        ExprOp(TOK_EQUAL, a, i1)
+    ),
+
+    (
+        ExprCond(ExprOp(TOK_INF_SIGNED, a, i1), bi1, bi0),
+        ExprOp(TOK_INF_SIGNED, a, i1)
+    ),
+
+    (
+        ExprOp(TOK_INF_EQUAL_UNSIGNED, a, i0),
+        ExprOp(TOK_EQUAL, a, i0)
+    ),
+
 ]
 
 for e_input, e_check in to_test: