3 # This program tests the CORRELATIONS command
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
8 # ensure that top_srcdir and top_builddir are absolute
9 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
10 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
11 top_srcdir=`cd $top_srcdir; pwd`
12 top_builddir=`cd $top_builddir; pwd`
14 PSPP=$top_builddir/src/ui/terminal/pspp
16 STAT_CONFIG_PATH=$top_srcdir/config
17 export STAT_CONFIG_PATH
25 if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
26 echo "NOT cleaning $TEMPDIR"
60 activity="create program 1"
61 cat << EOF > $TESTFILE
63 data list notable list /foo * bar * wiz * bang *.
76 variables = foo bar wiz bang
88 variables = foo bar wiz bang
93 if [ $? -ne 0 ] ; then no_result ; fi
96 activity="run program 1"
97 $SUPERVISOR $PSPP -o pspp.csv $TESTFILE
98 if [ $? -ne 0 ] ; then no_result ; fi
100 activity="compare results 1"
101 diff -c $TEMPDIR/pspp.csv - << EOF
104 foo,Pearson Correlation,1.000,.802,.890,-.308
105 ,Sig. (2-tailed),,.055,.017,.553
106 bar,Pearson Correlation,.802,1.000,.519,.118
107 ,Sig. (2-tailed),.055,,.291,.824
108 wiz,Pearson Correlation,.890,.519,1.000,-.344
109 ,Sig. (2-tailed),.017,.291,,.505
110 bang,Pearson Correlation,-.308,.118,-.344,1.000
111 ,Sig. (2-tailed),.553,.824,.505,
115 bar,Pearson Correlation,1.000,.497
116 ,Sig. (2-tailed),,.210
117 wiz,Pearson Correlation,.497,1.000
118 ,Sig. (2-tailed),.210,
122 foo,Pearson Correlation,1.000,.805,.883,-.308
123 ,Sig. (2-tailed),,.029,.008,.553
125 bar,Pearson Correlation,.805,1.000,.497,.164
126 ,Sig. (2-tailed),.029,,.210,.725
128 wiz,Pearson Correlation,.883,.497,1.000,-.337
129 ,Sig. (2-tailed),.008,.210,,.460
131 bang,Pearson Correlation,-.308,.164,-.337,1.000
132 ,Sig. (2-tailed),.553,.725,.460,
135 if [ $? -ne 0 ] ; then fail ; fi
138 # Now test that weights are properly handled.
140 activity="create program 2"
141 cat << EOF > $TESTFILE
143 data list notable list /foo * bar * wiz * bang * w *.
156 variables = foo bar wiz bang
157 /statistics=descriptives xprod
161 if [ $? -ne 0 ] ; then no_result ; fi
164 activity="run program 2"
165 $SUPERVISOR $PSPP -o pspp.csv $TESTFILE
166 if [ $? -ne 0 ] ; then no_result ; fi
168 activity="copy results"
169 cp $TEMPDIR/pspp.csv $TEMPDIR/weighted
170 if [ $? -ne 0 ] ; then no_result ; fi
172 activity="create program 3"
173 cat << EOF > $TESTFILE
175 data list notable list /foo * bar * wiz * bang * w *.
191 variables = foo bar wiz bang
192 /statistics=descriptives xprod
196 if [ $? -ne 0 ] ; then no_result ; fi
198 activity="run program 3"
199 $SUPERVISOR $PSPP -o pspp.csv $TESTFILE
200 if [ $? -ne 0 ] ; then no_result ; fi
202 activity="Compare weighted and unweighted results"
203 diff $TEMPDIR/pspp.csv $TEMPDIR/weighted
204 if [ $? -ne 0 ] ; then fail ; fi