xref: /freebsd/bin/sh/tests/expansion/arith1.0 (revision 7ef62cebc2f965b0f640263e179276928885e33d)
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 "0&&0" 0
13check "1&&0" 0
14check "0&&1" 0
15check "1&&1" 1
16check "2&&2" 1
17check "1&&2" 1
18check "1<<40&&1<<40" 1
19check "1<<40&&4" 1
20
21check "0||0" 0
22check "1||0" 1
23check "0||1" 1
24check "1||1" 1
25check "2||2" 1
26check "1||2" 1
27check "1<<40||1<<40" 1
28check "1<<40||4" 1
29
30exit $((failures != 0))
31