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
52 activity="data create"
68 if [ $? -ne 0 ] ; then no_result ; fi
77 if [ $? -ne 0 ] ; then no_result ; fi
116 # Test nonparallel match and table lookup.
117 dla="data list notable file='a.data' /A B C 1-3 (a)."
118 sa="save outfile='a.sys'."
119 dlb="data list notable file='b.data' /A B C 1-3 (a)."
120 sb="save outfile='b.sys'."
121 for types in ff ft; do
123 if [ $types = ff ]; then
128 for sources in ss sa as; do
129 name="$types-$sources"
130 activity="create $name.pspp"
132 if [ $sources = ss ]; then
138 match files $type1='a.sys' /in=INA /$type2='b.sys' /in=INB /rename c=D /by a.
140 elif [ $sources = sa ]; then
145 match files $type1='a.sys' /in=INA /$type2=* /in=INB /rename c=D /by a.
147 elif [ $sources = as ]; then
152 match files $type1=* /in=INA /$type2='b.sys' /in=INB /rename c=D /by a.
155 activity="internal error"
160 if [ $? -ne 0 ] ; then no_result ; fi
162 activity="run $name.pspp"
163 $SUPERVISOR $here/../src/pspp -o raw-ascii $name.pspp >/dev/null 2>&1
164 if [ $? -ne 0 ] ; then no_result ; fi
166 activity="check $name output"
167 diff -b -w -B pspp.list $types.out
168 if [ $? -ne 0 ] ; then fail ; fi
172 # Test parallel match.
174 activity="create $name.pspp"
175 cat > $name.pspp <<EOF
180 match files file='a.sys' /file='b.sys' /rename (a b c=D E F).
183 if [ $? -ne 0 ] ; then no_result ; fi
185 activity="run $name.pspp"
186 $SUPERVISOR $here/../src/pspp -o raw-ascii $name.pspp >/dev/null 2>&1
187 if [ $? -ne 0 ] ; then no_result ; fi
189 activity="check $name output"
190 diff -b -w -B - pspp.list <<EOF
207 if [ $? -ne 0 ] ; then fail ; fi
209 # Test bug handling TABLE from active file found by John Darrington.
211 activity="create $name.pspp"
212 cat > $name.pspp <<EOF
213 DATA LIST LIST NOTABLE /x * y *.
220 SAVE OUTFILE='bar.sav'.
222 DATA LIST LIST NOTABLE /x * z *.
228 MATCH FILES TABLE=* /FILE='bar.sav' /BY=x.
231 if [ $? -ne 0 ] ; then no_result ; fi
233 activity="run $name.pspp"
234 $SUPERVISOR $here/../src/pspp -o raw-ascii $name.pspp >/dev/null 2>&1
235 if [ $? -ne 0 ] ; then no_result ; fi
237 activity="check $name output"
238 diff -b -w -B - pspp.list <<EOF
240 -------- -------- --------
245 if [ $? -ne 0 ] ; then fail ; fi