3 # This program tests the INPUT PROGRAM command, specifically all of
4 # the examples given in the user manual.
6 TEMPDIR=/tmp/pspp-tst-$$
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
25 if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
26 echo "NOT cleaning $TEMPDIR"
61 activity="create a.data"
67 if [ $? -ne 0 ] ; then no_result ; fi
69 activity="create b.data"
77 if [ $? -ne 0 ] ; then no_result ; fi
79 activity="create test1.pspp"
80 cat > test1.pspp <<EOF
82 DATA LIST NOTABLE FILE='a.data'/X 1-10.
83 DATA LIST NOTABLE FILE='b.data'/Y 1-10.
87 if [ $? -ne 0 ] ; then no_result ; fi
90 $SUPERVISOR $PSPP -o pspp.csv test1.pspp
91 if [ $? -ne 0 ] ; then no_result ; fi
93 activity="compare test1 results"
94 diff -c $TEMPDIR/pspp.csv - << EOF
101 if [ $? -ne 0 ] ; then fail ; fi
103 activity="create test2.pspp"
104 cat > test2.pspp <<EOF
109 DATA LIST NOTABLE END=#A FILE='a.data'/X 1-10.
112 DATA LIST NOTABLE END=#B FILE='b.data'/Y 1-10.
121 if [ $? -ne 0 ] ; then no_result ; fi
124 $SUPERVISOR $PSPP -o pspp.csv test2.pspp
125 if [ $? -ne 0 ] ; then no_result ; fi
127 activity="compare test2 results"
128 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.csv
129 diff -c $TEMPDIR/pspp.csv - << EOF
138 if [ $? -ne 0 ] ; then fail ; fi
140 activity="create test3.pspp"
141 cat > test3.pspp <<EOF
146 DATA LIST NOTABLE END=#B FILE='b.data'/X 1-10.
153 DATA LIST NOTABLE END=#A FILE='a.data'/X 1-10.
161 if [ $? -ne 0 ] ; then no_result ; fi
164 $SUPERVISOR $PSPP -o pspp.csv test3.pspp
165 if [ $? -ne 0 ] ; then no_result ; fi
167 activity="compare test3 results"
168 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.csv
169 diff -c $TEMPDIR/pspp.csv - << EOF
181 if [ $? -ne 0 ] ; then fail ; fi
183 activity="create test4.pspp"
184 cat > test4.pspp <<EOF
189 DATA LIST NOTABLE END=#EOF FILE='a.data'/X 1-10.
197 DATA LIST NOTABLE END=#EOF FILE='b.data'/X 1-10.
207 if [ $? -ne 0 ] ; then no_result ; fi
210 $SUPERVISOR $PSPP -o pspp.csv test4.pspp
211 if [ $? -ne 0 ] ; then no_result ; fi
213 activity="compare test4 results"
214 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.csv
215 diff -c $TEMPDIR/pspp.csv - << EOF
227 if [ $? -ne 0 ] ; then fail ; fi
229 # This example differs slightly from the one in the manual in that
230 # it doesn't generate random variates. There's already a test that
231 # checks that random variates are predictable, so we don't need
233 activity="create test5.pspp"
234 cat > test5.pspp <<EOF
242 LIST/FORMAT=NUMBERED.
244 if [ $? -ne 0 ] ; then no_result ; fi
247 $SUPERVISOR $PSPP -o pspp.csv test5.pspp
248 if [ $? -ne 0 ] ; then no_result ; fi
250 activity="compare test5 results"
251 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.csv
252 diff -c $TEMPDIR/pspp.csv - << EOF
306 if [ $? -ne 0 ] ; then fail ; fi