utils/t/bits-testgen.py: Set the `SEED' from the command-line correctly.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 4 Oct 2019 17:27:28 +0000 (18:27 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 8 Oct 2019 10:27:36 +0000 (11:27 +0100)
This never stood a chance before, because `arg' always returned the
script path.  Now that's fixed, instead `int' complains that the hex
number it's being given isn't acceptable.  I can't fix this by
explicitly passing a radix of 0 because that doesn't allow an existing
integer object.  So we have this circumlocution.

utils/t/bits-testgen.py

index 810b519..05e4baf 100644 (file)
@@ -18,7 +18,9 @@ def arg(default = None):
   else: return default
 
 R.seed(None)
-SEED = int(arg(R.randrange(0, 1 << 32)))
+seed = arg()
+if seed is None: SEED = R.randrange(0, 1 << 32)
+else: SEED = int(seed, 0)
 R.seed(SEED)
 
 print '### Test vectors for 64-bit arithmetic macros'