3 # This program tests the count transformation
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
25 if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
26 echo "NOT cleaning $TEMPDIR"
61 activity="Create File 1"
63 title 'Test COUNT transformation'.
65 * we're going to count the 2s 4s and 1s in the data
66 data list /V1 to V2 1-4(a).
72 1104 ---- this is not '4', but '04' (v1 and v2 are string format )
76 count C=v1 to v2('2',' 4','1').
79 if [ $? -ne 0 ] ; then no_result ; fi
83 $SUPERVISOR $PSPP --testing-mode $TESTFILE
84 if [ $? -ne 0 ] ; then no_result ; fi
87 activity="compare results 1"
88 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
89 diff -b $TEMPDIR/pspp.list - <<EOF
90 1.1 DATA LIST. Reading 1 record from INLINE.
91 +--------+------+-------+------+
92 |Variable|Record|Columns|Format|
93 #========#======#=======#======#
96 +--------+------+-------+------+
107 if [ $? -ne 0 ] ; then no_result ; fi
112 activity="Create file 2"
113 cat > $TESTFILE <<EOF
114 data list list /x * y *.
127 if [ $? -ne 0 ] ; then no_result ; fi
130 activity="Run pspp 2"
131 $SUPERVISOR $PSPP --testing-mode $TESTFILE
132 if [ $? -ne 0 ] ; then no_result ; fi
135 activity="compare results"
136 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
137 diff -b $TEMPDIR/pspp.list - <<EOF
138 1.1 DATA LIST. Reading free-form data from INLINE.
146 -------- -------- --------
153 if [ $? -ne 0 ] ; then fail ; fi