data-out: Convert tests for numeric output formats to Autotest framework.
[pspp-builds.git] / tests / formats / time-in.sh
index da64ff85f7ff9e7fb61b6fe096a36f6651ce607c..0c9a7195c536f2c733eb127b13f177daae695af6 100755 (executable)
@@ -8,7 +8,8 @@ trap 'cd /; rm -rf $TEMPDIR' 0
 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
+: ${PERL:=perl}
 
 # ensure that top_srcdir is absolute
 top_srcdir=`cd $top_srcdir; pwd`
@@ -38,6 +39,44 @@ pass()
 
 cd $TEMPDIR
 
+activity="write PRNG fragment"
+cat > my-rand.pl <<'EOF'
+# This random number generator and the test for it below are drawn
+# from Park and Miller, "Random Number Generators: Good Ones are Hard
+# to Come By", Communications of the ACM 31:10 (October 1988).  It is
+# documented to function properly on systems with a 46-bit or longer
+# real significand, which includes systems that have 64-bit IEEE reals
+# (with 53-bit significand).  The test should catch any systems for
+# which this is not true, in any case.
+
+our ($seed) = 1;
+sub my_rand {
+  my ($modulo) = @_;
+  my ($a) = 16807;
+  my ($m) = 2147483647;
+  my ($tmp) = $a * $seed;
+  $seed = $tmp - $m * int ($tmp / $m);
+  return $seed % $modulo;
+}
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+activity="write PRNG test program"
+cat > test-my-rand.pl <<'EOF'
+#! /usr/bin/perl
+use strict;
+use warnings;
+do 'my-rand.pl';
+my_rand (1) foreach 1...10000;
+our $seed;
+die $seed if $seed != 1043618065;
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+activity="test PRNG"
+$PERL test-my-rand.pl
+if [ $? -ne 0 ] ; then no_result ; fi
+
 activity="write program to generate PSPP syntax and data"
 cat > time-in.pl <<'EOF'
 #! /usr/bin/perl
@@ -45,7 +84,7 @@ cat > time-in.pl <<'EOF'
 use strict;
 use warnings;
 
-our $next = 1;
+do 'my-rand.pl';
 
 my @formats = (["time", "+H:M", "+H:M:S"],
               ["dtime", "+D H:M", "+D H:M:S"]);
@@ -123,12 +162,6 @@ sub print_time_with_template {
 sub pick {
    return $_[int (my_rand ($#_ + 1))];
 }
-
-sub my_rand {
-    my ($modulo) = @_;
-    $next = ($next * 1103515245 + 12345) % (2**32);
-    return int ($next / 65536) % $modulo;
-}
 EOF
 if [ $? -ne 0 ] ; then no_result ; fi
 
@@ -137,7 +170,7 @@ $PERL time-in.pl
 if [ $? -ne 0 ] ; then no_result ; fi
 
 activity="run program"
-$SUPERVISOR $PSPP --testing-mode time-in.pspp
+$SUPERVISOR $PSPP -o pspp.csv time-in.pspp
 if [ $? -ne 0 ] ; then no_result ; fi
 
 activity="compare time.out output"
@@ -152,147 +185,147 @@ diff -u time.out - <<EOF
               .00
               .00
               .00
-        103800.00
        -103800.00
         103800.00
         103800.00
-        103800.00
+       -103800.00
         103800.00
        -103800.00
         103800.00
+        103800.00
        -103800.00
         103800.00
         477060.00
         477060.00
-       -477060.00
         477060.00
         477060.00
+       -477060.00
+        477060.00
         477060.00
         477060.00
-       -477060.00
         477060.00
        -477060.00
-        -46020.00
-         46020.00
          46020.00
         -46020.00
-         46020.00
+        -46020.00
         -46020.00
          46020.00
          46020.00
         -46020.00
          46020.00
-        264360.00
-        264360.00
-        264360.00
-        264360.00
+         46020.00
+        -46020.00
         264360.00
         264360.00
        -264360.00
        -264360.00
         264360.00
+       -264360.00
         264360.00
+       -264360.00
+       -264360.00
+       -264360.00
+        161880.00
         161880.00
-       -161880.00
-       -161880.00
         161880.00
         161880.00
         161880.00
+       -161880.00
         161880.00
         161880.00
         161880.00
        -161880.00
-      -1064160.00
        1064160.00
        1064160.00
        1064160.00
        1064160.00
        1064160.00
-      -1064160.00
        1064160.00
       -1064160.00
        1064160.00
-      -4549380.00
+       1064160.00
+       1064160.00
       -4549380.00
        4549380.00
-      -4549380.00
        4549380.00
        4549380.00
-      -4549380.00
+       4549380.00
+       4549380.00
        4549380.00
       -4549380.00
-      -4549380.00
+       4549380.00
+       4549380.00
+        620700.00
        -620700.00
         620700.00
         620700.00
+       -620700.00
         620700.00
        -620700.00
        -620700.00
         620700.00
         620700.00
-        620700.00
-       -620700.00
-         24540.00
          24540.00
-        -24540.00
-        -24540.00
-        -24540.00
-        -24540.00
         -24540.00
          24540.00
-        -24540.00
          24540.00
+         24540.00
+         24540.00
+         24540.00
+         24540.00
+         24540.00
+         24540.00
+      -1738620.00
+       1738620.00
        1738620.00
        1738620.00
        1738620.00
        1738620.00
-      -1738620.00
        1738620.00
        1738620.00
        1738620.00
-      -1738620.00
        1738620.00
       48012300.00
+     -48012300.00
+     -48012300.00
+      48012300.00
+      48012300.00
       48012300.00
       48012300.00
       48012300.00
-     -48012300.00
       48012300.00
-     -48012300.00
-     -48012300.00
-     -48012300.00
       48012300.00
       10445400.00
+     -10445400.00
+     -10445400.00
       10445400.00
       10445400.00
       10445400.00
      -10445400.00
       10445400.00
-     -10445400.00
       10445400.00
      -10445400.00
-      10445400.00
          15900.00
          15900.00
         -15900.00
          15900.00
+        -15900.00
+        -15900.00
          15900.00
          15900.00
          15900.00
-        -15900.00
          15900.00
-        -15900.00
         283740.00
        -283740.00
         283740.00
         283740.00
-       -283740.00
-       -283740.00
+        283740.00
        -283740.00
         283740.00
         283740.00
        -283740.00
-       -442620.00
+        283740.00
+        442620.00
         442620.00
         442620.00
         442620.00
@@ -302,46 +335,46 @@ diff -u time.out - <<EOF
         442620.00
         442620.00
        -442620.00
-        -60300.00
          60300.00
          60300.00
-        -60300.00
-        -60300.00
+         60300.00
+         60300.00
+         60300.00
         -60300.00
         -60300.00
          60300.00
         -60300.00
-         60300.00
-       -163800.00
+        -60300.00
         163800.00
        -163800.00
-        163800.00
-        163800.00
+       -163800.00
        -163800.00
         163800.00
         163800.00
         163800.00
         163800.00
-        945000.00
+       -163800.00
+        163800.00
         945000.00
        -945000.00
        -945000.00
-        945000.00
        -945000.00
         945000.00
         945000.00
         945000.00
+       -945000.00
+        945000.00
         945000.00
       -1907760.00
+       1907760.00
       -1907760.00
        1907760.00
+      -1907760.00
        1907760.00
        1907760.00
-      -1907760.00
-      -1907760.00
-      -1907760.00
        1907760.00
        1907760.00
+      -1907760.00
               .00
               .00
               .00
@@ -353,195 +386,195 @@ diff -u time.out - <<EOF
               .00
               .00
         103839.00
-        103839.00
+        103838.68
        -103838.70
-       -103839.00
-        103839.00
-        103839.00
        -103838.68
-        103839.00
-       -103838.70
+        103838.70
         103838.68
+       -103839.00
+        103838.68
+        103838.70
+       -103839.00
+        477095.82
         477096.00
         477096.00
-        477096.00
-       -477096.00
-       -477096.00
-       -477096.00
-       -477096.00
-        477095.80
-        477095.80
+        477095.82
+        477095.82
+        477095.82
         477095.80
-         46073.41
-         46073.00
+       -477095.80
+        477095.82
+       -477095.82
         -46073.00
-         46073.41
-         46073.41
-         46073.40
+        -46073.40
          46073.00
-        -46073.41
-         46073.41
          46073.40
-       -264361.00
-        264361.00
+         46073.40
+         46073.00
+        -46073.00
+         46073.00
+         46073.00
+         46073.00
+        264360.69
        -264360.70
+        264361.00
         264360.70
+        264360.69
         264360.70
-       -264361.00
-        264360.70
+        264361.00
         264360.70
        -264361.00
         264361.00
-        161891.20
-        161891.19
-        161891.00
-        161891.19
         161891.00
+       -161891.20
+       -161891.00
         161891.00
+       -161891.00
         161891.20
-        161891.00
-        161891.19
+       -161891.20
+       -161891.20
         161891.20
+       -161891.19
       -1064166.00
-       1064166.00
-       1064166.00
        1064165.98
-      -1064165.98
+      -1064166.00
       -1064166.00
       -1064165.98
        1064166.00
-       1064165.98
        1064166.00
+      -1064166.00
+      -1064165.98
+       1064166.00
+       4549429.00
        4549429.27
-      -4549429.00
-       4549429.30
-      -4549429.00
+       4549429.27
+      -4549429.30
        4549429.00
+      -4549429.00
        4549429.00
-      -4549429.27
        4549429.27
        4549429.00
-       4549429.00
-       -620709.24
-       -620709.00
+       4549429.30
         620709.00
-        620709.20
-       -620709.00
-       -620709.20
-        620709.24
        -620709.24
+        620709.24
+        620709.24
         620709.24
         620709.20
-        -24567.90
+       -620709.24
+        620709.20
+        620709.24
+        620709.24
+         24567.90
          24567.89
+         24567.90
          24568.00
+         24567.90
          24568.00
-        -24568.00
          24568.00
         -24567.90
-         24568.00
          24567.90
          24568.00
-      -1738673.00
-       1738672.60
-      -1738672.60
-       1738672.60
        1738672.56
        1738673.00
+      -1738672.60
+      -1738672.56
+       1738673.00
        1738673.00
        1738673.00
-      -1738673.00
-       1738672.56
-     -48012344.00
-      48012344.00
-      48012344.00
-     -48012344.12
+       1738672.60
+      -1738672.56
+       1738672.60
      -48012344.10
+      48012344.12
+     -48012344.10
+     -48012344.00
+     -48012344.00
       48012344.00
+     -48012344.00
+     -48012344.00
+     -48012344.00
       48012344.00
-      48012344.10
-      48012344.00
-      48012344.12
-     -10445457.30
+      10445457.27
       10445457.00
       10445457.30
       10445457.00
       10445457.27
-     -10445457.00
       10445457.00
-     -10445457.27
-      10445457.30
       10445457.27
+      10445457.00
+      10445457.00
+     -10445457.30
+        -15909.98
+         15910.00
         -15910.00
          15910.00
+        -15909.98
          15910.00
         -15909.98
          15909.98
-         15909.98
-        -15910.00
-        -15909.98
          15910.00
-         15910.00
-       -283767.00
-        283767.00
+         15909.98
        -283767.00
         283767.20
-        283767.24
-       -283767.00
-       -283767.00
         283767.20
         283767.00
-       -283767.20
-        442672.13
-       -442672.13
-        442672.10
+       -283767.00
+        283767.00
+        283767.24
+        283767.00
+        283767.24
+        283767.00
+       -442672.00
+        442672.13
+        442672.00
+        442672.13
+        442672.00
+        442672.00
         442672.00
-        442672.10
         442672.00
        -442672.00
-       -442672.10
         442672.13
-       -442672.13
-         60344.40
-         60344.40
-         60344.40
-         60344.40
-        -60344.35
-         60344.35
-        -60344.35
+        -60344.40
+        -60344.00
          60344.00
+         60344.35
          60344.00
+         60344.40
+         60344.40
+        -60344.00
          60344.00
-        163857.32
-       -163857.30
-        163857.30
-       -163857.32
+         60344.40
         163857.00
-        163857.32
-       -163857.32
         163857.00
-        163857.32
+        163857.00
+        163857.00
+        163857.30
+       -163857.30
+        163857.30
+       -163857.00
        -163857.00
+        163857.30
+        945004.30
         945004.00
+        945004.27
         945004.30
         945004.30
         945004.00
-        945004.00
         945004.30
         945004.00
-        945004.27
-       -945004.00
         945004.00
+        945004.00
+       1907811.00
+       1907811.00
       -1907811.00
+       1907811.18
        1907811.20
        1907811.00
       -1907811.00
-       1907811.00
        1907811.18
-       1907811.20
-      -1907811.20
       -1907811.00
-       1907811.20
+      -1907811.00
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
 
@@ -560,13 +593,14 @@ diff -u dtime.out - <<EOF
         103800.00
         103800.00
        -103800.00
-       -103800.00
-        103800.00
-        103800.00
         103800.00
         103800.00
+       -103800.00
         103800.00
+       -103800.00
         103800.00
+       -103800.00
+        477060.00
         477060.00
         477060.00
         477060.00
@@ -576,29 +610,27 @@ diff -u dtime.out - <<EOF
        -477060.00
        -477060.00
         477060.00
-        477060.00
-        -46020.00
-         46020.00
-         46020.00
          46020.00
          46020.00
          46020.00
          46020.00
+        -46020.00
+        -46020.00
         -46020.00
          46020.00
          46020.00
-       -264360.00
-       -264360.00
-        264360.00
-       -264360.00
+         46020.00
         264360.00
         264360.00
        -264360.00
         264360.00
         264360.00
         264360.00
-        161880.00
-        161880.00
+        264360.00
+       -264360.00
+       -264360.00
+       -264360.00
+       -161880.00
        -161880.00
         161880.00
         161880.00
@@ -607,27 +639,27 @@ diff -u dtime.out - <<EOF
         161880.00
        -161880.00
         161880.00
-      -1064160.00
-      -1064160.00
+       -161880.00
+       1064160.00
        1064160.00
-      -1064160.00
-      -1064160.00
        1064160.00
        1064160.00
        1064160.00
        1064160.00
       -1064160.00
-       4549380.00
+       1064160.00
+       1064160.00
+       1064160.00
       -4549380.00
        4549380.00
+      -4549380.00
+      -4549380.00
+      -4549380.00
        4549380.00
        4549380.00
        4549380.00
        4549380.00
        4549380.00
-      -4549380.00
-      -4549380.00
-       -620700.00
        -620700.00
         620700.00
         620700.00
@@ -636,38 +668,39 @@ diff -u dtime.out - <<EOF
         620700.00
         620700.00
        -620700.00
+        620700.00
         620700.00
         -24540.00
          24540.00
          24540.00
-        -24540.00
          24540.00
         -24540.00
          24540.00
          24540.00
         -24540.00
          24540.00
-      -1738620.00
+        -24540.00
        1738620.00
        1738620.00
        1738620.00
       -1738620.00
+      -1738620.00
       -1738620.00
        1738620.00
        1738620.00
        1738620.00
        1738620.00
       48012300.00
-     -48012300.00
-      48012300.00
-      48012300.00
-     -48012300.00
       48012300.00
       48012300.00
       48012300.00
       48012300.00
+     -48012300.00
+     -48012300.00
       48012300.00
-      10445400.00
+     -48012300.00
+     -48012300.00
+     -10445400.00
       10445400.00
      -10445400.00
       10445400.00
@@ -682,71 +715,71 @@ diff -u dtime.out - <<EOF
          15900.00
          15900.00
          15900.00
-         15900.00
         -15900.00
          15900.00
          15900.00
-        -15900.00
+         15900.00
+         15900.00
+       -283740.00
         283740.00
+       -283740.00
        -283740.00
         283740.00
         283740.00
         283740.00
-       -283740.00
         283740.00
         283740.00
        -283740.00
-        283740.00
-        442620.00
-        442620.00
-        442620.00
-        442620.00
-        442620.00
         442620.00
+       -442620.00
+       -442620.00
         442620.00
         442620.00
+       -442620.00
+       -442620.00
+       -442620.00
         442620.00
         442620.00
          60300.00
-         60300.00
-        -60300.00
         -60300.00
          60300.00
-        -60300.00
-        -60300.00
          60300.00
-        -60300.00
-        -60300.00
-        163800.00
-       -163800.00
-        163800.00
+         60300.00
+         60300.00
+         60300.00
+         60300.00
+         60300.00
+         60300.00
         163800.00
         163800.00
+       -163800.00
         163800.00
+       -163800.00
+       -163800.00
+       -163800.00
         163800.00
         163800.00
        -163800.00
-        163800.00
-       -945000.00
-       -945000.00
         945000.00
         945000.00
         945000.00
         945000.00
+       -945000.00
         945000.00
         945000.00
         945000.00
         945000.00
+       -945000.00
+      -1907760.00
        1907760.00
        1907760.00
        1907760.00
+      -1907760.00
+      -1907760.00
+      -1907760.00
        1907760.00
-       1907760.00
-       1907760.00
-       1907760.00
-       1907760.00
-       1907760.00
-       1907760.00
+      -1907760.00
+      -1907760.00
               .00
               .00
               .00
@@ -757,196 +790,196 @@ diff -u dtime.out - <<EOF
               .00
               .00
               .00
-       -103839.00
         103838.70
-        103839.00
         103838.70
         103839.00
         103838.68
-       -103838.68
         103838.70
-        103838.68
+        103839.00
         103838.70
-       -477096.00
-        477096.00
+       -103839.00
+        103839.00
+        103839.00
+        477095.80
+        477095.80
+       -477095.80
+        477095.82
+        477095.82
         477095.82
-        477096.00
        -477095.82
-       -477096.00
         477095.82
-        477095.80
         477096.00
-        477095.82
-         46073.00
-         46073.40
-        -46073.40
+       -477096.00
+        -46073.00
          46073.00
-         46073.41
         -46073.00
+         46073.41
          46073.00
+         46073.40
          46073.00
+         46073.41
+         46073.41
         -46073.00
-        -46073.00
-        264361.00
         264360.70
-        264361.00
         264360.70
-       -264361.00
         264360.69
-        264360.70
+        264361.00
+       -264360.70
         264360.69
        -264360.70
-       -264360.69
-        161891.20
-        161891.00
-        161891.20
-        161891.00
-       -161891.00
+        264360.69
+       -264361.00
+        264360.69
         161891.00
+       -161891.20
+       -161891.19
+        161891.19
         161891.00
+        161891.20
+        161891.20
         161891.00
         161891.00
-        161891.19
-      -1064166.00
+        161891.20
       -1064165.98
+       1064166.00
+       1064166.00
        1064166.00
        1064165.98
-      -1064166.00
-       1064165.98
-      -1064166.00
        1064166.00
-      -1064166.00
        1064166.00
-       4549429.00
+      -1064165.98
+       1064165.98
+      -1064166.00
+       4549429.27
+       4549429.27
+       4549429.27
        4549429.27
        4549429.00
        4549429.27
+      -4549429.27
+       4549429.00
        4549429.27
-       4549429.30
        4549429.27
-      -4549429.00
-       4549429.30
-       4549429.30
-        620709.24
-        620709.00
        -620709.00
-        620709.24
-       -620709.00
-       -620709.24
-       -620709.24
         620709.20
+        620709.00
+       -620709.20
+       -620709.24
        -620709.00
+        620709.00
         620709.24
-         24567.89
+       -620709.24
+        620709.00
+        -24567.89
          24567.90
+         24568.00
          24567.89
          24568.00
          24568.00
-        -24567.89
          24567.90
-         24567.90
-        -24567.90
         -24568.00
-       1738672.60
-       1738673.00
+        -24567.89
+        -24568.00
+       1738672.56
       -1738672.56
+       1738672.56
       -1738672.60
+      -1738673.00
+       1738672.56
        1738673.00
       -1738672.60
-      -1738673.00
-      -1738672.56
        1738672.60
        1738672.56
-     -48012344.00
-     -48012344.10
-      48012344.10
       48012344.00
+     -48012344.12
+     -48012344.00
       48012344.12
-     -48012344.10
-      48012344.00
+     -48012344.12
+     -48012344.00
       48012344.12
-      48012344.00
-     -48012344.10
-      10445457.00
-      10445457.27
-     -10445457.00
+     -48012344.00
+     -48012344.00
+     -48012344.00
      -10445457.00
       10445457.00
+      10445457.00
+      10445457.00
      -10445457.00
-      10445457.27
      -10445457.00
       10445457.00
-     -10445457.27
+      10445457.00
+      10445457.00
+     -10445457.30
         -15909.98
-        -15910.00
-        -15910.00
-        -15910.00
          15910.00
+        -15909.98
          15910.00
          15910.00
+        -15910.00
+        -15910.00
+        -15910.00
+        -15910.00
          15909.98
-         15910.00
-         15910.00
-       -283767.00
-       -283767.00
-        283767.00
-        283767.24
        -283767.24
-       -283767.24
-       -283767.24
-        283767.00
-        283767.00
+        283767.20
+        283767.24
+        283767.24
         283767.00
+        283767.20
+        283767.20
+        283767.24
+       -283767.00
+        283767.24
+        442672.13
        -442672.13
-       -442672.00
-        442672.00
         442672.00
+        442672.13
         442672.10
-       -442672.00
         442672.00
-        442672.13
-        442672.13
         442672.00
-         60344.35
-         60344.40
+       -442672.10
+        442672.00
+       -442672.10
+        -60344.35
          60344.00
          60344.00
-         60344.35
         -60344.00
+         60344.00
+         60344.35
+         60344.00
+         60344.35
          60344.00
          60344.00
-        -60344.35
-        -60344.00
-        163857.00
-        163857.00
        -163857.00
-        163857.00
-        163857.30
-        163857.00
        -163857.00
         163857.32
         163857.00
+       -163857.30
+       -163857.00
+        163857.30
         163857.00
-        945004.27
-        945004.30
-       -945004.30
+        163857.00
+       -163857.00
+       -945004.00
        -945004.30
-        945004.00
-        945004.00
+        945004.27
+        945004.27
+       -945004.27
+       -945004.27
+       -945004.00
+       -945004.27
+       -945004.00
         945004.30
-       -945004.30
-        945004.00
-        945004.00
        1907811.00
-      -1907811.20
+       1907811.00
+       1907811.00
+       1907811.00
+       1907811.20
+       1907811.18
        1907811.18
-      -1907811.00
        1907811.18
        1907811.18
-      -1907811.00
-      -1907811.00
        1907811.00
-       1907811.20
 EOF
 if [ $? -ne 0 ] ; then fail ; fi