Sys::Syslog patch to allow unix domain sockets
[p5sagit/p5-mst-13.2.git] / t / op / rand.t
index 9e4d692..c779f9d 100755 (executable)
@@ -74,13 +74,13 @@ sub bits ($) {
     # reason that the diagnostic message might get the
     # wrong value is that Config.pm is incorrect.)
     #
-    if ($max <= 0) {   # Just in case...
+    if ($max <= 0 or $max >= (1 << $randbits)) {       # Just in case...
        print "not ok 1\n";
        print "# This perl was compiled with randbits=$randbits\n";
        print "# which is _way_ off. Or maybe your system rand is broken,\n";
        print "# or your C compiler can't multiply, or maybe Martians\n";
        print "# have taken over your computer. For starters, see about\n";
-       print "# trying a better value for randbits.\n";
+       print "# trying a better value for randbits, probably smaller.\n";
        # If that isn't the problem, we'll have
        # to put d_martians into Config.pm 
        print "# Skipping remaining tests until randbits is fixed.\n";
@@ -210,7 +210,7 @@ sub bits ($) {
 {
     srand;             # These three lines are for test 7
     my $time = time;   # It's just faster to do them here.
-    my $rand = rand;
+    my $rand = join ", ", rand, rand, rand;
 
     # Hints for TEST 5
     # 
@@ -251,7 +251,7 @@ sub bits ($) {
     #
     while ($time == time) { }  # Wait for new second, just in case.
     srand;
-    if (rand == $rand) {
+    if ((join ", ", rand, rand, rand) eq $rand) {
        print "not ok 7\n";
        print "# srand without args isn't varying.\n";
     } else {
@@ -329,7 +329,10 @@ AUTOSRAND:
 
     my($pid, $first);
     for (1..5) {
-       $pid = open PERL, "./perl -e 'print rand'|";
+       my $PERL = (($^O eq 'VMS') ? "MCR $^X"
+                   : ($^O eq 'MSWin32') ? '.\perl'
+                   : './perl');
+       $pid = open PERL, qq[$PERL -e "print rand"|];
        die "Couldn't pipe from perl: $!" unless defined $pid;
        if (defined $first) {
            if ($first ne <PERL>) {