1# $FreeBSD: head/bin/sh/tests/expansion/arith15.0 344902 2019-03-07 22:51:58Z jilles $
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
12XXX=-9223372036854775808
13check "XXX"		-9223372036854775808
14check "XXX - 1" 	9223372036854775807
15check "$XXX - 1"	9223372036854775807
16check "$XXX - 2"	9223372036854775806
17check "0x8000000000000000 == 0x7fffffffffffffff" \
18			0
19
20exit $((failures != 0))
21