diff options
Diffstat (limited to 'release/src/router/busybox/testsuite/expr')
-rw-r--r-- | release/src/router/busybox/testsuite/expr/expr-big | 16 | ||||
-rw-r--r-- | release/src/router/busybox/testsuite/expr/expr-works | 59 |
2 files changed, 75 insertions, 0 deletions
diff --git a/release/src/router/busybox/testsuite/expr/expr-big b/release/src/router/busybox/testsuite/expr/expr-big new file mode 100644 index 00000000..23dbbb3c --- /dev/null +++ b/release/src/router/busybox/testsuite/expr/expr-big @@ -0,0 +1,16 @@ +# busybox expr + +# 3*1000*1000*1000 overflows 32-bit signed int +res=`busybox expr 0 '<' 3000000000` +[ x"$res" = x1 ] || exit 1 + +# 9223372036854775807 = 2^31-1 +res=`busybox expr 0 '<' 9223372036854775807` +[ x"$res" = x1 ] || exit 1 +# coreutils fails this one! +res=`busybox expr -9223372036854775800 '<' 9223372036854775807` +[ x"$res" = x1 ] || exit 1 + +# This one works only by chance +# res=`busybox expr 0 '<' 9223372036854775808` +# [ x"$res" = x1 ] || exit 1 diff --git a/release/src/router/busybox/testsuite/expr/expr-works b/release/src/router/busybox/testsuite/expr/expr-works new file mode 100644 index 00000000..af49ac4d --- /dev/null +++ b/release/src/router/busybox/testsuite/expr/expr-works @@ -0,0 +1,59 @@ +# busybox expr +busybox expr 1 \| 1 +busybox expr 1 \| 0 +busybox expr 0 \| 1 +busybox expr 1 \& 1 +busybox expr 0 \< 1 +busybox expr 1 \> 0 +busybox expr 0 \<= 1 +busybox expr 1 \<= 1 +busybox expr 1 \>= 0 +busybox expr 1 \>= 1 +busybox expr 1 + 2 +busybox expr 2 - 1 +busybox expr 2 \* 3 +busybox expr 12 / 2 +busybox expr 12 % 5 + + +set +e +busybox expr 0 \| 0 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 1 \& 0 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 0 \& 1 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 0 \& 0 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 1 \< 0 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 0 \> 1 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 1 \<= 0 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 0 \>= 1 +if [ $? != 1 ] ; then + exit 1; +fi; + |