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
55 activity="Create File 1"
57 title 'Test COUNT transformation'.
59 * we're going to count the 2s 4s and 1s in the data
60 data list /V1 to V2 1-4(a).
66 1104 ---- this is not '4', but '04' (v1 and v2 are string format )
70 count C=v1 to v2('2',' 4','1').
73 if [ $? -ne 0 ] ; then no_result ; fi
77 $SUPERVISOR $PSPP -o raw-ascii $TESTFILE
78 if [ $? -ne 0 ] ; then no_result ; fi
81 activity="compare results 1"
82 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
83 diff -b $TEMPDIR/pspp.list - <<EOF
84 1.1 DATA LIST. Reading 1 record from INLINE.
85 +--------+------+-------+------+
86 |Variable|Record|Columns|Format|
87 #========#======#=======#======#
90 +--------+------+-------+------+
101 if [ $? -ne 0 ] ; then no_result ; fi
106 activity="Create file 2"
107 cat > $TESTFILE <<EOF
108 data list list /x * y *.
121 if [ $? -ne 0 ] ; then no_result ; fi
124 activity="Run pspp 2"
125 $SUPERVISOR $PSPP -o raw-ascii $TESTFILE
126 if [ $? -ne 0 ] ; then no_result ; fi
129 activity="compare results"
130 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
131 diff -b $TEMPDIR/pspp.list - <<EOF
132 1.1 DATA LIST. Reading free-form data from INLINE.
140 -------- -------- --------
147 if [ $? -ne 0 ] ; then fail ; fi