3 # This program tests the SAMPLE function
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
8 # ensure that top_builddir are absolute
9 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
10 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
11 top_builddir=`cd $top_builddir; pwd`
12 PSPP=$top_builddir/src/ui/terminal/pspp
14 # ensure that top_srcdir is absolute
15 top_srcdir=`cd $top_srcdir; pwd`
17 STAT_CONFIG_PATH=$top_srcdir/config
18 export STAT_CONFIG_PATH
56 activity="create program"
57 cat > $TEMPDIR/sample.stat <<EOF
60 data list notable /A 1-2.
76 if [ $? -ne 0 ] ; then no_result ; fi
79 activity="run program"
80 $SUPERVISOR $PSPP -o raw-ascii --testing-mode $TEMPDIR/sample.stat
81 if [ $? -ne 0 ] ; then no_result ; fi
83 activity="create head"
84 grep -v '^\ *$' $TEMPDIR/pspp.list | head -2 > $TEMPDIR/head
85 if [ $? -ne 0 ] ; then no_result ; fi
87 activity="extract data"
88 grep '[0-9][0-9]*' $TEMPDIR/pspp.list > $TEMPDIR/data
89 if [ $? -ne 0 ] ; then no_result ; fi
92 activity="compare head"
93 perl -pi -e 's/^\s*$//g' $TEMPDIR/head
94 diff -b $TEMPDIR/head - << EOF
98 if [ $? -ne 0 ] ; then fail ; fi
100 activity="compare data"
101 diff -w $TEMPDIR/data - << EOF > $TEMPDIR/diffs
114 if [ $? -eq 0 ] ; then fail ; fi
116 # Check that there was nothing added
117 grep '^<' $TEMPDIR/diffs
119 if [ $? -eq 0 ] ; then fail ; fi