Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Apr 2010 16:29:48 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r206167 - head/tools/regression/bin/sh/expansion
Message-ID:  <201004041629.o34GTmWv063692@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sun Apr  4 16:29:48 2010
New Revision: 206167
URL: http://svn.freebsd.org/changeset/base/206167

Log:
  sh: Add test for some associativity in arithmetic.

Added:
  head/tools/regression/bin/sh/expansion/arith4.0   (contents, props changed)

Added: head/tools/regression/bin/sh/expansion/arith4.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bin/sh/expansion/arith4.0	Sun Apr  4 16:29:48 2010	(r206167)
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+failures=0
+
+check() {
+	if [ $(($1)) != $2 ]; then
+		failures=$((failures+1))
+		echo "For $1, expected $2 actual $(($1))"
+	fi
+}
+
+check '20 / 2 / 2' 5
+check '20 - 2 - 2' 16
+unset a b c d
+check "a = b = c = d = 1" 1
+check "a == 1 && b == 1 && c == 1 && d == 1" 1
+check "a += b += c += d" 4
+check "a == 4 && b == 3 && c == 2 && d == 1" 1
+
+exit $((failures != 0))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004041629.o34GTmWv063692>