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`
14 # ensure that top_srcdir is absolute
15 top_srcdir=`cd $top_srcdir; pwd`
18 STAT_CONFIG_PATH=$top_srcdir/config
19 export STAT_CONFIG_PATH
56 activity="data create"
72 if [ $? -ne 0 ] ; then no_result ; fi
81 if [ $? -ne 0 ] ; then no_result ; fi
120 # Test nonparallel match and table lookup.
121 dla="data list notable file='a.data' /A B C 1-3 (a)."
122 sa="save outfile='a.sys'."
123 dlb="data list notable file='b.data' /A B C 1-3 (a)."
124 sb="save outfile='b.sys'."
125 for types in ff ft; do
127 if [ $types = ff ]; then
132 for sources in ss sa as; do
133 name="$types-$sources"
134 activity="create $name.pspp"
136 if [ $sources = ss ]; then
142 match files $type1='a.sys' /in=INA /$type2='b.sys' /in=INB /rename c=D /by a.
144 elif [ $sources = sa ]; then
149 match files $type1='a.sys' /in=INA /$type2=* /in=INB /rename c=D /by a.
151 elif [ $sources = as ]; then
156 match files $type1=* /in=INA /$type2='b.sys' /in=INB /rename c=D /by a.
159 activity="internal error"
164 if [ $? -ne 0 ] ; then no_result ; fi
166 activity="run $name.pspp"
167 $SUPERVISOR $top_builddir/src/pspp -o raw-ascii $name.pspp >/dev/null 2>&1
168 if [ $? -ne 0 ] ; then no_result ; fi
170 activity="check $name output"
171 perl -pi -e 's/^\s*$//g' pspp.list
172 perl -pi -e 's/^\s*$//g' $types.out
173 diff -b -w pspp.list $types.out
174 if [ $? -ne 0 ] ; then fail ; fi
178 # Test parallel match.
180 activity="create $name.pspp"
181 cat > $name.pspp <<EOF
186 match files file='a.sys' /file='b.sys' /rename (a b c=D E F).
189 if [ $? -ne 0 ] ; then no_result ; fi
191 activity="run $name.pspp"
192 $SUPERVISOR $top_builddir/src/pspp -o raw-ascii $name.pspp >/dev/null 2>&1
193 if [ $? -ne 0 ] ; then no_result ; fi
195 activity="check $name output"
196 perl -pi -e 's/^\s*$//g' pspp.list
197 diff -b -w - pspp.list <<EOF
214 if [ $? -ne 0 ] ; then fail ; fi
216 # Test bug handling TABLE from active file found by John Darrington.
218 activity="create $name.pspp"
219 cat > $name.pspp <<EOF
220 DATA LIST LIST NOTABLE /x * y *.
227 SAVE OUTFILE='bar.sav'.
229 DATA LIST LIST NOTABLE /x * z *.
235 MATCH FILES TABLE=* /FILE='bar.sav' /BY=x.
238 if [ $? -ne 0 ] ; then no_result ; fi
240 activity="run $name.pspp"
241 $SUPERVISOR $top_builddir/src/pspp -o raw-ascii $name.pspp >/dev/null 2>&1
242 if [ $? -ne 0 ] ; then no_result ; fi
244 activity="check $name output"
245 perl -pi -e 's/^\s*$//g' pspp.list
246 diff -b -w - pspp.list <<EOF | perl -e 's/^\s*$//g'
248 -------- -------- --------
253 if [ $? -ne 0 ] ; then fail ; fi