aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-11-30 14:10:36 -0600
committerRob Landley <rob@landley.net>2014-11-30 14:10:36 -0600
commitde211e0288bd2cd8e27ab23252ec2e4077b3d589 (patch)
tree1ef7853c632fbe4cafcc2f602ece8c63d6a3f36d
parenta92f4e1e2097fac6a5d35fc519861e92b39fbc8b (diff)
downloadtoybox-de211e0288bd2cd8e27ab23252ec2e4077b3d589.tar.gz
Tests for operator priority groupings.
-rw-r--r--tests/expr.test9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/expr.test b/tests/expr.test
index cce7d9d0..1c038a5c 100644
--- a/tests/expr.test
+++ b/tests/expr.test
@@ -8,3 +8,12 @@ testing "expr string" "expr astring" "astring\n" "" ""
testing "expr 1 + 3" "expr 1 + 3" "4\n" "" ""
testing "expr 5 + 6 * 3" "expr 5 + 6 \* 3" "23\n" "" ""
testing "expr ( 5 + 6 ) * 3" "expr \( 5 + 6 \) \* 3" "33\n" "" ""
+testing "expr * / same priority" "expr 4 \* 3 / 2" "6\n" "" ""
+testing "expr / * same priority" "expr 3 / 2 \* 4" "4\n" "" ""
+testing "expr & before |" "expr 0 \| 1 \& 0" "0\n" "" ""
+testing "expr | after &" "expr 1 \| 0 \& 0" "1\n" "" ""
+testing "expr | & same priority" "expr 0 \& 0 \| 1" "1\n" "" ""
+testing "expr % * same priority" "expr 3 % 2 \* 4" "4\n" "" ""
+testing "expr * % same priority" "expr 3 \* 2 % 4" "2\n" "" ""
+testing "expr = > same priority" "expr 0 = 2 \> 3" "0\n" "" ""
+testing "expr > = same priority" "expr 3 \> 2 = 1" "1\n" "" ""