calc++: factor for other extracted tests.

* Makefile.am (TESTS, check_PROGRAMS): Initialize here.
	* examples/local.mk (doc, extexi): Define here.
	* examples/calc++/local.mk: Adjust accordingly.
	* configure.ac: Ask for parallel-tests (for the way the logs
	are handled).
	* examples/calc++/test: As a consequence, always be verbose.
	($prog): New.
	(run): Use it.
	Sort the tests in a more natural order (simplest first).
This commit is contained in:
Akim Demaille
2012-02-16 15:27:03 +01:00
parent aeb57fb68d
commit 2e4986a88d
5 changed files with 26 additions and 23 deletions

View File

@@ -15,11 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
test -z "$VERBOSE" && {
exec > /dev/null 2>&1
set -x
}
me=`basename $0`
# Number of the current test.
@@ -28,6 +23,9 @@ number=1
# Exit status of this script.
exit=true
# The exercised program.
prog=./examples/calc++/calc++
# run EXPECTED-EXIT-STATUS EXPECTED-OUTPUT [PARSER-OPTIONS]
# ---------------------------------------------------------
run ()
@@ -37,7 +35,7 @@ run ()
shift
local out_exp=$1
shift
./examples/calc++/calc++ "$@" input >out_eff
$prog "$@" - <input >out_eff
local sta_eff=$?
local out_eff=`cat out_eff`
if test $sta_eff -eq $sta_exp; then
@@ -56,6 +54,14 @@ run ()
number=`expr $number + 1`
}
cat >input <<EOF
toto := 1
toto
EOF
run 0 1 -s
cat >input <<EOF
a := 1
b := 2
@@ -81,14 +87,7 @@ cat >input <<EOF
a := 1
d := a + b * c
EOF
run 1 '' input
cat >input <<EOF
toto := 1
toto
EOF
run 0 1 -s
run 1 ''
rm input out_eff
$exit