xref: /freebsd/bin/sh/tests/expansion/arith4.0 (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1
2failures=0
3
4check() {
5	if [ $(($1)) != $2 ]; then
6		failures=$((failures+1))
7		echo "For $1, expected $2 actual $(($1))"
8	fi
9}
10
11check '20 / 2 / 2' 5
12check '20 - 2 - 2' 16
13unset a b c d
14check "a = b = c = d = 1" 1
15check "a == 1 && b == 1 && c == 1 && d == 1" 1
16check "a += b += c += d" 4
17check "a == 4 && b == 3 && c == 2 && d == 1" 1
18
19exit $((failures != 0))
20