File indexing completed on 2024-12-22 04:04:06
0001 #! /bin/sh 0002 0003 # Copyright (C) 2001-2019 Peter Selinger. 0004 # This file is part of Potrace. It is free software and it is covered 0005 # by the GNU General Public License. See the file COPYING for details. 0006 0007 echo "Checking mkbitmap..." >& 2 0008 0009 # because of floating point inaccuracies, we cannot check that the 0010 # output is identical to its reference; instead, we compare pixmaps 0011 # and allow for small differences. 0012 0013 if test -z "$srcdir"; then 0014 srcdir=. 0015 fi 0016 0017 . "$srcdir/missing.sh" 0018 0019 NAME=`basename "$0"` 0020 0021 MKBITMAP="${CHECK_MKBITMAP:-../src/mkbitmap$EXEEXT}" 0022 DATADIR="$srcdir/data" 0023 PGMDIFF="./pgmdiff$EXEEXT" 0024 TMPDIR="${TEMPDIR:-/tmp}" 0025 TMP1=`mktemp "$TMPDIR/$NAME-1.XXXXXX"` 0026 DATA="$DATADIR/data2.ppm" 0027 REFDATA1="$DATADIR/data2-out1.pbm" 0028 REFDATA2="$DATADIR/data2-out2.pbm" 0029 0030 action () { 0031 "$@" 0032 if test $? -ne 0; then 0033 echo "$NAME: test failed" >& 2 0034 echo "Failed command: $LINE: $@" >& 2 0035 exit 1 0036 fi 0037 } 0038 0039 actiondiff () { 0040 D=`action "$PGMDIFF" "$1" "$2"` 0041 # check return value because subshell can't exit 0042 if test $? -ne 0; then 0043 exit 1; 0044 fi 0045 echo "Difference: $D" >& 2 0046 if test "$D" -gt "$3"; then 0047 echo "$NAME: test failed" >& 2 0048 echo "Failed command: $LINE: $PGMDIFF $1 $2" >& 2 0049 exit 1; 0050 fi 0051 } 0052 0053 # keep track of line numbers 0054 alias action="LINE=\$LINENO; action" 0055 alias actiondiff="LINE=\$LINENO; actiondiff" 0056 0057 action $MKBITMAP -f2 -s2 -t.48 -o "$TMP1" "$DATA" 0058 actiondiff "$TMP1" "$REFDATA1" 50 0059 0060 action $MKBITMAP -f1 -s2 -t.54 -1 -i -o "$TMP1" "$DATA" 0061 actiondiff "$TMP1" "$REFDATA2" 50 0062 0063 action rm -f "$TMP1" 0064 0065 echo "$NAME: test succeeded" >& 2 0066 exit 0