Add scratch file handles.
[pspp-builds.git] / tests / command / examine.sh
index 55c80a8a914436e76d59cd8f74e1d64d96fcbcc7..4ce0257afffe9bbbf491d74cbfd02f74f2d7c83a 100755 (executable)
@@ -3,17 +3,20 @@
 # This program tests  the EXAMINE command.
 
 TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
 
 here=`pwd`;
 
 # ensure that top_srcdir is absolute
 cd $top_srcdir; top_srcdir=`pwd`
 
-export STAT_CONFIG_PATH=$top_srcdir/config
+STAT_CONFIG_PATH=$top_srcdir/config
+export STAT_CONFIG_PATH
 
 
 cleanup()
 {
+     cd /
      rm -rf $TEMPDIR
 }
 
@@ -46,8 +49,8 @@ mkdir -p $TEMPDIR
 cd $TEMPDIR
 
 activity="create program"
-cat > $TEMPDIR/out.stat <<EOF
-DATA LIST LIST /quality * w * brand * .
+cat > $TESTFILE <<EOF
+DATA LIST LIST /QUALITY * W * BRAND * .
 BEGIN DATA
 3  1  1
 2  2  1
@@ -85,14 +88,15 @@ if [ $? -ne 0 ] ; then no_result ; fi
 
 
 activity="run program"
-$SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
+$SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
 if [ $? -ne 0 ] ; then no_result ; fi
 
 # NOTE:  In the following data: Only the extreme values have been checked
 # The descriptives have been blindly pasted.
 activity="compare results"
-diff $TEMPDIR/pspp.list - << EOF
-1.1 DATA LIST.  Reading free-form data from the command file.
+perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
+diff -b  $TEMPDIR/pspp.list - << EOF
+1.1 DATA LIST.  Reading free-form data from INLINE.
 +--------+------+
 |Variable|Format|
 #========#======#
@@ -100,7 +104,6 @@ diff $TEMPDIR/pspp.list - << EOF
 |W       |F8.0  |
 |BRAND   |F8.0  |
 +--------+------+
-
 Case#  QUALITY        W    BRAND
 ----- -------- -------- --------
     1     3.00     1.00     1.00 
@@ -119,7 +122,6 @@ Case#  QUALITY        W    BRAND
    14     5.00     3.00     3.00 
    15     3.00     1.00     3.00 
    16     6.00     1.00     3.00 
-
 2.1 EXAMINE.  Case Processing Summary
 #===============#===============================#
 #               #             Cases             #
@@ -130,7 +132,6 @@ Case#  QUALITY        W    BRAND
 #===============#==#=======#=#=======#==#=======#
 #Breaking Strain#24|   100%|0|     0%|24|   100%#
 #===============#==#=======#=#=======#==#=======#
-
 2.2 EXAMINE.  Extreme Values
 #=======================#===========#=====#
 #                       #Case Number|Value#
@@ -143,7 +144,6 @@ Case#  QUALITY        W    BRAND
 #                      2#          3| 1.00#
 #                      3#          3| 1.00#
 #=======================#===========#=====#
-
 2.3 EXAMINE.  Descriptives
 #==========================================================#=========#==========#
 #                                                          #Statistic|Std. Error#
@@ -162,7 +162,6 @@ Case#  QUALITY        W    BRAND
 #               Skewness                                   #   .059  |   .472   #
 #               Kurtosis                                   #  -.358  |   .918   #
 #==========================================================#=========#==========#
-
 2.4 EXAMINE.  Case Processing Summary
 #===========================#=============================#
 #                           #            Cases            #
@@ -175,7 +174,6 @@ Case#  QUALITY        W    BRAND
 #               Bloggs      #8|   100%|0|     0%|8|   100%#
 #               Charlies    #8|   100%|0|     0%|8|   100%#
 #===========================#=#=======#=#=======#=#=======#
-
 2.5 EXAMINE.  Extreme Values
 #===================================#===========#=====#
 #               Manufacturer        #Case Number|Value#
@@ -204,7 +202,6 @@ Case#  QUALITY        W    BRAND
 #                                  2#         13| 4.00#
 #                                  3#         13| 4.00#
 #===================================#===========#=====#
-
 2.6 EXAMINE.  Descriptives
 #======================================================================#=========#==========#
 #               Manufacturer                                           #Statistic|Std. Error#
@@ -251,7 +248,6 @@ Case#  QUALITY        W    BRAND
 #                           Skewness                                   #   .304  |   .752   #
 #                           Kurtosis                                   #   .146  |   1.481  #
 #======================================================================#=========#==========#
-
 EOF
 if [ $? -ne 0 ] ; then fail ; fi