3 # This program tests the MATCH FILES procedure
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/match-files.pspp
11 # ensure that top_srcdir is absolute
12 cd $top_srcdir; top_srcdir=`pwd`
15 STAT_CONFIG_PATH=$top_srcdir/config
16 export STAT_CONFIG_PATH
53 activity="data create"
69 if [ $? -ne 0 ] ; then no_result ; fi
78 if [ $? -ne 0 ] ; then no_result ; fi
117 # Test nonparallel match and table lookup.
118 dla="data list notable file='a.data' /A B C 1-3 (a)."
119 sa="save outfile='a.sys'."
120 dlb="data list notable file='b.data' /A B C 1-3 (a)."
121 sb="save outfile='b.sys'."
122 for types in ff ft; do
124 if [ $types = ff ]; then
129 for sources in ss sa as; do
130 name="$types-$sources"
131 activity="create $name.pspp"
133 if [ $sources = ss ]; then
139 match files $type1='a.sys' /in=INA /$type2='b.sys' /in=INB /rename c=D /by a.
141 elif [ $sources = sa ]; then
146 match files $type1='a.sys' /in=INA /$type2=* /in=INB /rename c=D /by a.
148 elif [ $sources = as ]; then
153 match files $type1=* /in=INA /$type2='b.sys' /in=INB /rename c=D /by a.
156 activity="internal error"
161 if [ $? -ne 0 ] ; then no_result ; fi
163 activity="run $name.pspp"
164 $SUPERVISOR $here/../src/pspp -o raw-ascii $name.pspp >/dev/null 2>&1
165 if [ $? -ne 0 ] ; then no_result ; fi
167 activity="check $name output"
168 perl -pi -e 's/^\s*$//g' pspp.list
169 perl -pi -e 's/^\s*$//g' $types.out
170 diff -b -w pspp.list $types.out
171 if [ $? -ne 0 ] ; then fail ; fi
175 # Test parallel match.
177 activity="create $name.pspp"
178 cat > $name.pspp <<EOF
183 match files file='a.sys' /file='b.sys' /rename (a b c=D E F).
186 if [ $? -ne 0 ] ; then no_result ; fi
188 activity="run $name.pspp"
189 $SUPERVISOR $here/../src/pspp -o raw-ascii $name.pspp >/dev/null 2>&1
190 if [ $? -ne 0 ] ; then no_result ; fi
192 activity="check $name output"
193 perl -pi -e 's/^\s*$//g' pspp.list
194 diff -b -w - pspp.list <<EOF
211 if [ $? -ne 0 ] ; then fail ; fi
213 # Test bug handling TABLE from active file found by John Darrington.
215 activity="create $name.pspp"
216 cat > $name.pspp <<EOF
217 DATA LIST LIST NOTABLE /x * y *.
224 SAVE OUTFILE='bar.sav'.
226 DATA LIST LIST NOTABLE /x * z *.
232 MATCH FILES TABLE=* /FILE='bar.sav' /BY=x.
235 if [ $? -ne 0 ] ; then no_result ; fi
237 activity="run $name.pspp"
238 $SUPERVISOR $here/../src/pspp -o raw-ascii $name.pspp >/dev/null 2>&1
239 if [ $? -ne 0 ] ; then no_result ; fi
241 activity="check $name output"
242 perl -pi -e 's/^\s*$//g' pspp.list
243 diff -b -w - pspp.list <<EOF | perl -e 's/^\s*$//g'
245 -------- -------- --------
250 if [ $? -ne 0 ] ; then fail ; fi