3 # This program tests the DO IF command.
5 TEMPDIR=/tmp/pspp-tst-$$
7 # ensure that top_builddir are absolute
8 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
9 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
10 top_builddir=`cd $top_builddir; pwd`
11 PSPP=$top_builddir/src/ui/terminal/pspp
13 # ensure that top_srcdir is absolute
14 top_srcdir=`cd $top_srcdir; pwd`
16 STAT_CONFIG_PATH=$top_srcdir/config
17 export STAT_CONFIG_PATH
24 if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
25 echo "NOT cleaning $TEMPDIR"
60 activity="generate input and expected output"
67 if test "$a" = "1"; then
69 elif test "$a" = " "; then
71 elif test "$b" = "1"; then
73 elif test "$b" = " "; then
75 elif test "$c" = "1"; then
77 elif test "$c" = " "; then
79 elif test "$d" = "1"; then
81 elif test "$d" = " "; then
89 done) >test1.expected 3>test1.data
90 if [ $? -ne 0 ] ; then no_result ; fi
92 activity="create test1.pspp"
93 cat > test1.pspp <<EOF
94 DATA LIST FILE="test1.data"/A B C D 1-4 ABCD 1-4 (A).
96 PRINT OUTFILE="test1.out"/ABCD 'A'.
98 PRINT OUTFILE="test1.out"/ABCD 'B'.
100 PRINT OUTFILE="test1.out"/ABCD 'C'.
102 PRINT OUTFILE="test1.out"/ABCD 'D'.
104 PRINT OUTFILE="test1.out"/ABCD 'E'.
108 if [ $? -ne 0 ] ; then no_result ; fi
111 $SUPERVISOR $PSPP --testing-mode test1.pspp
112 if [ $? -ne 0 ] ; then no_result ; fi
114 activity="compare test1 results"
115 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
116 diff -u $TEMPDIR/test1.out $TEMPDIR/test1.expected
117 if [ $? -ne 0 ] ; then fail ; fi