]> git.saurik.com Git - apple/shell_cmds.git/blame - sh/tests/expansion/arith4.0
shell_cmds-207.11.1.tar.gz
[apple/shell_cmds.git] / sh / tests / expansion / arith4.0
CommitLineData
deb63bfb 1# $FreeBSD: head/bin/sh/tests/expansion/arith4.0 206167 2010-04-04 16:29:48Z jilles $
71aad674
A
2
3failures=0
4
5check() {
6 if [ $(($1)) != $2 ]; then
7 failures=$((failures+1))
8 echo "For $1, expected $2 actual $(($1))"
9 fi
10}
11
12check '20 / 2 / 2' 5
13check '20 - 2 - 2' 16
14unset a b c d
15check "a = b = c = d = 1" 1
16check "a == 1 && b == 1 && c == 1 && d == 1" 1
17check "a += b += c += d" 4
18check "a == 4 && b == 3 && c == 2 && d == 1" 1
19
20exit $((failures != 0))