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
24 if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
25 echo "NOT cleaning $TEMPDIR"
60 activity="data create"
76 if [ $? -ne 0 ] ; then no_result ; fi
85 if [ $? -ne 0 ] ; then no_result ; fi
88 A B C D INA INB FIRST LAST
89 - - - - --- --- ----- ----
107 A B C D INA INB FIRST LAST
108 - - - - --- --- ----- ----
124 # Test nonparallel match and table lookup.
125 dla="data list notable file='a.data' /A B C 1-3 (a)."
126 sa="save outfile='a.sys'."
127 dlb="data list notable file='b.data' /A B C 1-3 (a)."
128 sb="save outfile='b.sys'."
129 for types in ff ft; do
131 if [ $types = ff ]; then
136 for sources in ss sa as; do
137 name="$types-$sources"
138 activity="create $name.pspp"
140 if [ $sources = ss ]; then
146 match files $type1='a.sys' /in=INA /$type2='b.sys' /in=INB /rename c=D /by a
147 /first=FIRST /last=LAST.
149 elif [ $sources = sa ]; then
154 match files $type1='a.sys' /in=INA /$type2=* /in=INB /rename c=D /by a
155 /first=FIRST /last=LAST.
157 elif [ $sources = as ]; then
162 match files $type1=* /in=INA /$type2='b.sys' /in=INB /rename c=D /by a
163 /first=FIRST /last=LAST.
166 activity="internal error"
171 if [ $? -ne 0 ] ; then no_result ; fi
173 activity="run $name.pspp"
174 $SUPERVISOR $PSPP --testing-mode -e /dev/null $name.pspp
175 if [ $? -ne 0 ] ; then no_result ; fi
177 activity="check $name output"
178 perl -pi -e 's/^\s*$//g' pspp.list
179 perl -pi -e 's/^\s*$//g' $types.out
180 diff -b -w pspp.list $types.out
181 if [ $? -ne 0 ] ; then fail ; fi
185 # Test parallel match.
187 activity="create $name.pspp"
188 cat > $name.pspp <<EOF
193 match files file='a.sys' /file='b.sys' /rename (a b c=D E F).
196 if [ $? -ne 0 ] ; then no_result ; fi
198 activity="run $name.pspp"
199 $SUPERVISOR $PSPP --testing-mode -e /dev/null $name.pspp
200 if [ $? -ne 0 ] ; then no_result ; fi
202 activity="check $name output"
203 perl -pi -e 's/^\s*$//g' pspp.list
204 diff -b -w - pspp.list <<EOF
221 if [ $? -ne 0 ] ; then fail ; fi
223 # Test bug handling TABLE from active file found by John Darrington.
225 activity="create $name.pspp"
226 cat > $name.pspp <<EOF
227 DATA LIST LIST NOTABLE /x * y *.
234 SAVE OUTFILE='bar.sav'.
236 DATA LIST LIST NOTABLE /x * z *.
242 MATCH FILES TABLE=* /FILE='bar.sav' /BY=x.
245 if [ $? -ne 0 ] ; then no_result ; fi
247 activity="run $name.pspp"
248 $SUPERVISOR $PSPP --testing-mode -e /dev/null $name.pspp
249 if [ $? -ne 0 ] ; then no_result ; fi
251 activity="check $name output"
252 perl -pi -e 's/^\s*$//g' pspp.list
253 diff -b -w - pspp.list <<EOF | perl -e 's/^\s*$//g'
255 -------- -------- --------
260 if [ $? -ne 0 ] ; then fail ; fi