Fixed blank replacement
[pspp] / tests / command / trimmed-mean.sh
index 8b84a31c47c24d9bb38f916d54518910c6cdc819..0d65db5ef03e81dda3f76b984f8224868fdee23b 100755 (executable)
@@ -4,17 +4,20 @@
 # where the data is weighted towards the centre
 
 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
 }
 
@@ -48,8 +51,8 @@ cd $TEMPDIR
 
 
 activity="create program"
-cat > $TEMPDIR/out.stat <<EOF
-DATA LIST LIST /x * c *.
+cat > $TESTFILE <<EOF
+DATA LIST LIST /X * C *.
 BEGIN DATA.
 1 1
 2 49
@@ -67,12 +70,13 @@ 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
 
 
 activity="compare results"
-diff $TEMPDIR/pspp.list - << EOF
+perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
+diff -b  $TEMPDIR/pspp.list - << EOF
 1.1 DATA LIST.  Reading free-form data from the command file.
 +--------+------+
 |Variable|Format|
@@ -80,7 +84,6 @@ diff $TEMPDIR/pspp.list - << EOF
 |X       |F8.0  |
 |C       |F8.0  |
 +--------+------+
-
 2.1 EXAMINE.  Case Processing Summary
 #=#===============================#
 # #             Cases             #
@@ -91,7 +94,6 @@ diff $TEMPDIR/pspp.list - << EOF
 #=#==#=======#=#=======#==#=======#
 #X#52|   100%|0|     0%|52|   100%#
 #=#==#=======#=#=======#==#=======#
-
 2.2 EXAMINE.  Descriptives
 #============================================#=========#==========#
 #                                            #Statistic|Std. Error#
@@ -110,7 +112,6 @@ diff $TEMPDIR/pspp.list - << EOF
 # Skewness                                   #  1.194  |   .330   #
 # Kurtosis                                   #  15.732 |   .650   #
 #============================================#=========#==========#
-
 EOF
 if [ $? -ne 0 ] ; then fail ; fi