]> git.saurik.com Git - apple/shell_cmds.git/blob - sh/tests/expansion/arith1.0
shell_cmds-207.11.1.tar.gz
[apple/shell_cmds.git] / sh / tests / expansion / arith1.0
1 # $FreeBSD: head/bin/sh/tests/expansion/arith1.0 201259 2009-12-30 15:59:40Z jilles $
2
3 failures=0
4
5 check() {
6 if [ $(($1)) != $2 ]; then
7 failures=$((failures+1))
8 echo "For $1, expected $2 actual $(($1))"
9 fi
10 }
11
12 check "0&&0" 0
13 check "1&&0" 0
14 check "0&&1" 0
15 check "1&&1" 1
16 check "2&&2" 1
17 check "1&&2" 1
18 check "1<<40&&1<<40" 1
19 check "1<<40&&4" 1
20
21 check "0||0" 0
22 check "1||0" 1
23 check "0||1" 1
24 check "1||1" 1
25 check "2||2" 1
26 check "1||2" 1
27 check "1<<40||1<<40" 1
28 check "1<<40||4" 1
29
30 exit $((failures != 0))