t/t-rand.py: Set the correct refernce seed value for `dsarand'. 1.3.x
authorMark Wooding <mdw@distorted.org.uk>
Tue, 7 Apr 2020 23:40:52 +0000 (00:40 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 7 Apr 2020 23:57:00 +0000 (00:57 +0100)
The number of steps taken is different on 32- and 64-bit platforms, with
no especially easy way to calculate it in a principled way.  Just use a
stupid case analysis to get the right answer.

t/t-rand.py

index d8d7b00..a45c1d5 100644 (file)
@@ -121,7 +121,10 @@ class TestRandomGenerator (U.TestCase):
     n = C.MP.loadb(seed)
     rng = C.DSARand(seed)
     me.check_rand(rng)
-    me.assertEqual(rng.seed, (n + 153 + 3).storeb(16))
+    if T.MAXFIXNUM == (1 << 31) - 1: steps = 153 + 3
+    elif T.MAXFIXNUM == (1 << 63) - 1: steps = 153
+    else: steps = None
+    if steps is not None: me.assertEqual(rng.seed, (n + steps).storeb(16))
 
   def test_bbs(me):
     ev = T.EventRecorder()