]>
Commit | Line | Data |
---|---|---|
deb63bfb | 1 | # $FreeBSD: head/bin/sh/tests/expansion/arith4.0 206167 2010-04-04 16:29:48Z jilles $ |
71aad674 A |
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)) |