# # # ProLinga-Calc # # Copyright (C) 2002-2008 Xobas Software # All rights reserved. # # This file is part of ProLinga-Calc. # # ProLinga-Calc is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # ProLinga-Calc is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with ProLinga-Calc. If not, see . # # More information is available at the following addresses: # # Website : http://www.prolinga.org # # Email : prolinga-list@prolinga.org # # # Common definitions if test -z "$srcdir"; then srcdir=`echo "$0" | sed 's,[^/]*$,,'` test "$srcdir" = "$0" && srcdir=. test -z "$srcdir" && srcdir=. test "${VERBOSE+set}" != set && VERBOSE=1 fi . $srcdir/defs ############################################################################### ### MODIFY SECTION ############################################################################### # This is the test script. cat <<\EOF > $progname.in_1 2+3 EOF # This is the test script. cat <<\EOF > $progname.in_2 9.12+7 EOF # This is the test script. cat <<\EOF > $progname.in_3 9012.2987+88123.847739 EOF # This is the output we should expect to see. cat <<\EOF >$progname.ok 5 16.12 97136.14644 EOF # This is the error we should expect to see (in case of expected failure). cat <<\EOF >$progname.errok EOF ############################################################################### ### END MODIFY SECTION ############################################################################### # Run the test saving stderr to a file, and showing stdout if VERBOSE == 1 #$RUNCALC `cat in.calc` 2> err | tee -i out >&2 $RUNCALC `cat $progname.in_1` > $progname.out 2>> $progname.err $RUNCALC `cat $progname.in_2` >> $progname.out 2>> $progname.err $RUNCALC `cat $progname.in_3` >> $progname.out 2>> $progname.err # Test against expected output. if ${CMP} -s $progname.out $progname.ok; then : else echo "==============================================================================" >&2 echo "$progname : UNEXPECTED RESULT!" >&2 echo "Result:" >&2 cat $progname.out >&2 echo "Expected result:" >&2 cat $progname.ok >&2 echo "==============================================================================" >&2 exit 1 fi # Munge error output to remove leading directories, `lt-' or trailing `.exe'. sed -e "s,^[^:]*[lt-]*src[.ex]*:,sic:," $progname.err >$progname.sederr && mv $progname.sederr $progname.err # Show stderr if doesn't match expected output if VERBOSE == 1. if "$CMP" -s $progname.err $progname.errok; then : else echo "================================================================================" >&2 echo "$progname UNEXPECTED ERROR MESSAGE!" >&2 echo "Error Message:" >&2 cat $progname.err >&2 echo "Expected Error Message:" >&2 cat $progname.errok >&2 echo "================================================================================" >&2 exit 1 fi