xref: /freebsd/bin/sh/tests/expansion/arith4.0 (revision 43a5ec4eb41567cc92586503212743d89686d78f)
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