]> git.saurik.com Git - apple/shell_cmds.git/blob - sh/tests/expansion/arith4.0
610dad89e4dc6c3d956b8004b8387678d181a501
[apple/shell_cmds.git] / sh / tests / expansion / arith4.0
1 # $FreeBSD$
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 '20 / 2 / 2' 5
13 check '20 - 2 - 2' 16
14 unset a b c d
15 check "a = b = c = d = 1" 1
16 check "a == 1 && b == 1 && c == 1 && d == 1" 1
17 check "a += b += c += d" 4
18 check "a == 4 && b == 3 && c == 2 && d == 1" 1
19
20 exit $((failures != 0))