xref: /freebsd/bin/sh/tests/expansion/arith4.0 (revision 0a36787e4c1fa0cf77dcf83be0867178476e372b)
1# $FreeBSD$
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))
21