]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - bin/sh/tests/expansion/arith1.0
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / bin / sh / tests / expansion / arith1.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 "0&&0" 0
13 check "1&&0" 0
14 check "0&&1" 0
15 check "1&&1" 1
16 check "2&&2" 1
17 check "1&&2" 1
18 check "1<<40&&1<<40" 1
19 check "1<<40&&4" 1
20
21 check "0||0" 0
22 check "1||0" 1
23 check "0||1" 1
24 check "1||1" 1
25 check "2||2" 1
26 check "1||2" 1
27 check "1<<40||1<<40" 1
28 check "1<<40||4" 1
29
30 exit $((failures != 0))