3 # This program tests the MATCH FILES procedure
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/match-files.pspp
9 # ensure that top_builddir are absolute
10 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
11 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
12 top_builddir=`cd $top_builddir; pwd`
13 PSPP=$top_builddir/src/ui/terminal/pspp
15 # ensure that top_srcdir is absolute
16 top_srcdir=`cd $top_srcdir; pwd`
19 STAT_CONFIG_PATH=$top_srcdir/config
20 export STAT_CONFIG_PATH
57 activity="data create"
73 if [ $? -ne 0 ] ; then no_result ; fi
82 if [ $? -ne 0 ] ; then no_result ; fi
121 # Test nonparallel match and table lookup.
122 dla="data list notable file='a.data' /A B C 1-3 (a)."
123 sa="save outfile='a.sys'."
124 dlb="data list notable file='b.data' /A B C 1-3 (a)."
125 sb="save outfile='b.sys'."
126 for types in ff ft; do
128 if [ $types = ff ]; then
133 for sources in ss sa as; do
134 name="$types-$sources"
135 activity="create $name.pspp"
137 if [ $sources = ss ]; then
143 match files $type1='a.sys' /in=INA /$type2='b.sys' /in=INB /rename c=D /by a.
145 elif [ $sources = sa ]; then
150 match files $type1='a.sys' /in=INA /$type2=* /in=INB /rename c=D /by a.
152 elif [ $sources = as ]; then
157 match files $type1=* /in=INA /$type2='b.sys' /in=INB /rename c=D /by a.
160 activity="internal error"
165 if [ $? -ne 0 ] ; then no_result ; fi
167 activity="run $name.pspp"
168 $SUPERVISOR $PSPP -o raw-ascii $name.pspp >/dev/null 2>&1
169 if [ $? -ne 0 ] ; then no_result ; fi
171 activity="check $name output"
172 perl -pi -e 's/^\s*$//g' pspp.list
173 perl -pi -e 's/^\s*$//g' $types.out
174 diff -b -w pspp.list $types.out
175 if [ $? -ne 0 ] ; then fail ; fi
179 # Test parallel match.
181 activity="create $name.pspp"
182 cat > $name.pspp <<EOF
187 match files file='a.sys' /file='b.sys' /rename (a b c=D E F).
190 if [ $? -ne 0 ] ; then no_result ; fi
192 activity="run $name.pspp"
193 $SUPERVISOR $PSPP -o raw-ascii $name.pspp >/dev/null 2>&1
194 if [ $? -ne 0 ] ; then no_result ; fi
196 activity="check $name output"
197 perl -pi -e 's/^\s*$//g' pspp.list
198 diff -b -w - pspp.list <<EOF
215 if [ $? -ne 0 ] ; then fail ; fi
217 # Test bug handling TABLE from active file found by John Darrington.
219 activity="create $name.pspp"
220 cat > $name.pspp <<EOF
221 DATA LIST LIST NOTABLE /x * y *.
228 SAVE OUTFILE='bar.sav'.
230 DATA LIST LIST NOTABLE /x * z *.
236 MATCH FILES TABLE=* /FILE='bar.sav' /BY=x.
239 if [ $? -ne 0 ] ; then no_result ; fi
241 activity="run $name.pspp"
242 $SUPERVISOR $PSPP -o raw-ascii $name.pspp >/dev/null 2>&1
243 if [ $? -ne 0 ] ; then no_result ; fi
245 activity="check $name output"
246 perl -pi -e 's/^\s*$//g' pspp.list
247 diff -b -w - pspp.list <<EOF | perl -e 's/^\s*$//g'
249 -------- -------- --------
254 if [ $? -ne 0 ] ; then fail ; fi