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 diff -b -w -B pspp.list $types.out
169 if [ $? -ne 0 ] ; then fail ; fi
173 # Test parallel match.
175 activity="create $name.pspp"
176 cat > $name.pspp <<EOF
181 match files file='a.sys' /file='b.sys' /rename (a b c=D E F).
184 if [ $? -ne 0 ] ; then no_result ; fi
186 activity="run $name.pspp"
187 $SUPERVISOR $here/../src/pspp -o raw-ascii $name.pspp >/dev/null 2>&1
188 if [ $? -ne 0 ] ; then no_result ; fi
190 activity="check $name output"
191 diff -b -w -B - pspp.list <<EOF
208 if [ $? -ne 0 ] ; then fail ; fi
210 # Test bug handling TABLE from active file found by John Darrington.
212 activity="create $name.pspp"
213 cat > $name.pspp <<EOF
214 DATA LIST LIST NOTABLE /x * y *.
221 SAVE OUTFILE='bar.sav'.
223 DATA LIST LIST NOTABLE /x * z *.
229 MATCH FILES TABLE=* /FILE='bar.sav' /BY=x.
232 if [ $? -ne 0 ] ; then no_result ; fi
234 activity="run $name.pspp"
235 $SUPERVISOR $here/../src/pspp -o raw-ascii $name.pspp >/dev/null 2>&1
236 if [ $? -ne 0 ] ; then no_result ; fi
238 activity="check $name output"
239 diff -b -w -B - pspp.list <<EOF
241 -------- -------- --------
246 if [ $? -ne 0 ] ; then fail ; fi