3 # This program tests the SAMPLE function
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
10 # ensure that top_srcdir is absolute
11 cd $top_srcdir; top_srcdir=`pwd`
13 STAT_CONFIG_PATH=$top_srcdir/config
14 export STAT_CONFIG_PATH
52 activity="create program"
53 cat > $TEMPDIR/sample.stat <<EOF
56 data list notable /A 1-2.
72 if [ $? -ne 0 ] ; then no_result ; fi
75 activity="run program"
76 $SUPERVISOR $here/../src/pspp -o raw-ascii --testing-mode $TEMPDIR/sample.stat
77 if [ $? -ne 0 ] ; then no_result ; fi
79 activity="create head"
80 grep -v '^\ *$' $TEMPDIR/pspp.list | head -2 > $TEMPDIR/head
81 if [ $? -ne 0 ] ; then no_result ; fi
83 activity="extract data"
84 grep '[0-9][0-9]*' $TEMPDIR/pspp.list > $TEMPDIR/data
85 if [ $? -ne 0 ] ; then no_result ; fi
88 activity="compare head"
89 perl -pi -e 's/^\s*$//g' $TEMPDIR/head
90 diff -b $TEMPDIR/head - << EOF |perl -e 's/^\s*$//g'
94 if [ $? -ne 0 ] ; then fail ; fi
96 activity="compare data"
97 diff -w $TEMPDIR/data - << EOF > $TEMPDIR/diffs
110 if [ $? -eq 0 ] ; then fail ; fi
112 # Check that there was nothing added
113 grep '^<' $TEMPDIR/diffs
115 if [ $? -eq 0 ] ; then fail ; fi