]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - tools/regression/bin/sh/expansion/arith4.0
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / tools / regression / bin / sh / expansion / arith4.0
1 # $FreeBSD$
2
3 failures=0
4
5 check() {
6         if [ $(($1)) != $2 ]; then
7                 failures=$((failures+1))
8                 echo "For $1, expected $2 actual $(($1))"
9         fi
10 }
11
12 check '20 / 2 / 2' 5
13 check '20 - 2 - 2' 16
14 unset a b c d
15 check "a = b = c = d = 1" 1
16 check "a == 1 && b == 1 && c == 1 && d == 1" 1
17 check "a += b += c += d" 4
18 check "a == 4 && b == 3 && c == 2 && d == 1" 1
19
20 exit $((failures != 0))