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
85 A B C D INA INB FIRST LAST
86 - - - - --- --- ----- ----
104 A B C D INA INB FIRST LAST
105 - - - - --- --- ----- ----
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
144 /first=FIRST /last=LAST.
146 elif [ $sources = sa ]; then
151 match files $type1='a.sys' /in=INA /$type2=* /in=INB /rename c=D /by a
152 /first=FIRST /last=LAST.
154 elif [ $sources = as ]; then
159 match files $type1=* /in=INA /$type2='b.sys' /in=INB /rename c=D /by a
160 /first=FIRST /last=LAST.
163 activity="internal error"
168 if [ $? -ne 0 ] ; then no_result ; fi
170 activity="run $name.pspp"
171 $SUPERVISOR $PSPP -o raw-ascii -e /dev/null $name.pspp
172 if [ $? -ne 0 ] ; then no_result ; fi
174 activity="check $name output"
175 perl -pi -e 's/^\s*$//g' pspp.list
176 perl -pi -e 's/^\s*$//g' $types.out
177 diff -b -w pspp.list $types.out
178 if [ $? -ne 0 ] ; then fail ; fi
182 # Test parallel match.
184 activity="create $name.pspp"
185 cat > $name.pspp <<EOF
190 match files file='a.sys' /file='b.sys' /rename (a b c=D E F).
193 if [ $? -ne 0 ] ; then no_result ; fi
195 activity="run $name.pspp"
196 $SUPERVISOR $PSPP -o raw-ascii -e /dev/null $name.pspp
197 if [ $? -ne 0 ] ; then no_result ; fi
199 activity="check $name output"
200 perl -pi -e 's/^\s*$//g' pspp.list
201 diff -b -w - pspp.list <<EOF
218 if [ $? -ne 0 ] ; then fail ; fi
220 # Test bug handling TABLE from active file found by John Darrington.
222 activity="create $name.pspp"
223 cat > $name.pspp <<EOF
224 DATA LIST LIST NOTABLE /x * y *.
231 SAVE OUTFILE='bar.sav'.
233 DATA LIST LIST NOTABLE /x * z *.
239 MATCH FILES TABLE=* /FILE='bar.sav' /BY=x.
242 if [ $? -ne 0 ] ; then no_result ; fi
244 activity="run $name.pspp"
245 $SUPERVISOR $PSPP -o raw-ascii -e /dev/null $name.pspp
246 if [ $? -ne 0 ] ; then no_result ; fi
248 activity="check $name output"
249 perl -pi -e 's/^\s*$//g' pspp.list
250 diff -b -w - pspp.list <<EOF | perl -e 's/^\s*$//g'
252 -------- -------- --------
257 if [ $? -ne 0 ] ; then fail ; fi