xref: /freebsd/bin/sh/tests/expansion/arith9.0 (revision 069ac184)
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 "0 ? 44 : 51" 51
12check "1 ? 68 : 30" 68
13check "2 ? 1 : -5" 1
14check "0 ? 4 : 0 ? 5 : 6" 6
15check "0 ? 4 : 1 ? 5 : 6" 5
16check "1 ? 4 : 0 ? 5 : 6" 4
17check "1 ? 4 : 1 ? 5 : 6" 4
18
19exit $((failures != 0))
20