data-out: Convert tests for date formats to Autotest framework.
[pspp-builds.git] / tests / formats / float-format.sh
index 4ce1f39156b2220beb17891a9a209789c2e91723..5fbc28b091c8fc969e735d86dc459eaa2222bbf3 100755 (executable)
@@ -8,7 +8,7 @@ TEMPDIR=/tmp/pspp-tst-$$
 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
 top_builddir=`cd $top_builddir; pwd`
-PSPP=$top_builddir/src/ui/terminal/pspp
+PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT
 
 # ensure that top_srcdir is absolute
 top_srcdir=`cd $top_srcdir; pwd`
@@ -19,6 +19,10 @@ export STAT_CONFIG_PATH
 
 cleanup()
 {
+     if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
+       echo "NOT cleaning $TEMPDIR" 
+       return ; 
+     fi
      cd /
      rm -rf $TEMPDIR
 }
@@ -51,12 +55,10 @@ mkdir -p $TEMPDIR
 
 cd $TEMPDIR
 activity="create test program"
-sed -n \
-    -e 's/#.*//' \
+sed -e 's/#.*//' \
     -e 's/^[   ]*//' \
     -e 's/[    ]*$//' \
-    -e '/^$/d' \
-    -e 's/^\(.*\)$/DEBUG FLOAT FORMAT \1./p' \
+    -e 's/^\(..*\)$/DEBUG FLOAT FORMAT \1./' \
     > $TEMPDIR/float-format.pspp <<'EOF'
 # Each of the tests below checks that conversion between
 # floating-point formats works correctly.  Comparisons that use ==
@@ -78,7 +80,6 @@ sed -n \
 
 # IEEE special values.
  0 == isb(x'00000000')
--0 == isb(x'80000000')
 x('Infinity') == isb(x'7f800000')
 x('-Infinity') == isb(x'ff800000')
 x('NaN:') => isb(x'7f800001')          # NaN requires nonzero fraction.
@@ -122,7 +123,7 @@ x('.446c3b15f9926688p168') => idb(x'4a511b0ec57e649a')
              0.5 == zs(x'40800000') == isb(x'3f000000')
        x('.4p-4') == zs(x'3f400000') == isb(x'3c800000')
                0 == zs(x'00000000') == isb(x'00000000')
-              -0 == zs(x'80000000') == isb(x'80000000')
+                    zs(x'80000000') == isb(x'80000000')
              -15 == zs(x'c1f00000') == isb(x'c1700000')
 # x('.ffffffp252') == zs(x'7fffffff')
       x('.3b4p8') == zs(x'423b4000')
@@ -148,7 +149,7 @@ EOF
 if [ $? -ne 0 ] ; then no_result ; fi
 
 activity="run program"
-$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TEMPDIR/float-format.pspp
+$SUPERVISOR $PSPP --testing-mode -o pspp.csv $TEMPDIR/float-format.pspp
 if [ $? -ne 0 ] ; then fail ; fi
 
 pass