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 --testing-mode -o raw-ascii $TESTFILE
98 if [ $? -ne 0 ] ; then no_result ; fi
100 activity="compare results 1"
101 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
102 diff -b $TEMPDIR/pspp.list - << EOF
103 1.1 CORRELATIONS. Correlations
104 #========================#=====#=====#=====#=====#
105 # #foo |bar |wiz |bang #
106 #----+-------------------#-----+-----+-----+-----#
107 #foo |Pearson Correlation#1.000| .802| .890|-.308#
108 # |Sig. (2-tailed) # | .055| .017| .553#
109 #----+-------------------#-----+-----+-----+-----#
110 #bar |Pearson Correlation# .802|1.000| .519| .118#
111 # |Sig. (2-tailed) # .055| | .291| .824#
112 #----+-------------------#-----+-----+-----+-----#
113 #wiz |Pearson Correlation# .890| .519|1.000|-.344#
114 # |Sig. (2-tailed) # .017| .291| | .505#
115 #----+-------------------#-----+-----+-----+-----#
116 #bang|Pearson Correlation#-.308| .118|-.344|1.000#
117 # |Sig. (2-tailed) # .553| .824| .505| #
118 #====#===================#=====#=====#=====#=====#
119 2.1 CORRELATIONS. Correlations
120 #=======================#=====#=====#
122 #---+-------------------#-----+-----#
123 #bar|Pearson Correlation#1.000| .497#
124 # |Sig. (2-tailed) # | .210#
125 #---+-------------------#-----+-----#
126 #wiz|Pearson Correlation# .497|1.000#
127 # |Sig. (2-tailed) # .210| #
128 #===#===================#=====#=====#
129 3.1 CORRELATIONS. Correlations
130 #========================#=====#=====#=====#=====#
131 # #foo |bar |wiz |bang #
132 #----+-------------------#-----+-----+-----+-----#
133 #foo |Pearson Correlation#1.000| .805| .883|-.308#
134 # |Sig. (2-tailed) # | .029| .008| .553#
136 #----+-------------------#-----+-----+-----+-----#
137 #bar |Pearson Correlation# .805|1.000| .497| .164#
138 # |Sig. (2-tailed) # .029| | .210| .725#
140 #----+-------------------#-----+-----+-----+-----#
141 #wiz |Pearson Correlation# .883| .497|1.000|-.337#
142 # |Sig. (2-tailed) # .008| .210| | .460#
144 #----+-------------------#-----+-----+-----+-----#
145 #bang|Pearson Correlation#-.308| .164|-.337|1.000#
146 # |Sig. (2-tailed) # .553| .725| .460| #
148 #====#===================#=====#=====#=====#=====#
150 if [ $? -ne 0 ] ; then fail ; fi
153 # Now test that weights are properly handled.
155 activity="create program 2"
156 cat << EOF > $TESTFILE
158 data list notable list /foo * bar * wiz * bang * w *.
171 variables = foo bar wiz bang
172 /statistics=descriptives xprod
176 if [ $? -ne 0 ] ; then no_result ; fi
179 activity="run program 2"
180 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
181 if [ $? -ne 0 ] ; then no_result ; fi
183 activity="copy results"
184 cp $TEMPDIR/pspp.list $TEMPDIR/weighted
185 if [ $? -ne 0 ] ; then no_result ; fi
187 activity="create program 3"
188 cat << EOF > $TESTFILE
190 data list notable list /foo * bar * wiz * bang * w *.
206 variables = foo bar wiz bang
207 /statistics=descriptives xprod
211 if [ $? -ne 0 ] ; then no_result ; fi
213 activity="run program 3"
214 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
215 if [ $? -ne 0 ] ; then no_result ; fi
217 activity="Compare weighted and unweighted results"
218 diff $TEMPDIR/pspp.list $TEMPDIR/weighted
219 if [ $? -ne 0 ] ; then fail ; fi