summaryrefslogtreecommitdiff
path: root/tests/extmod/urandom_basic.py
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2022-08-18 16:57:45 +1000
committerJim Mussared <jim.mussared@gmail.com>2023-06-08 17:54:24 +1000
commit4216bc7d1351feb8199e4ebbff1a9598aa1c5b02 (patch)
tree5085738ef65ab377c221f290c7fa90ec2acd4d29 /tests/extmod/urandom_basic.py
parent5e50975a6dd9466afafbcd012c00078093fe1f57 (diff)
tests: Replace umodule with module everywhere.
This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'tests/extmod/urandom_basic.py')
-rw-r--r--tests/extmod/urandom_basic.py32
1 files changed, 0 insertions, 32 deletions
diff --git a/tests/extmod/urandom_basic.py b/tests/extmod/urandom_basic.py
deleted file mode 100644
index f7f5a6d69..000000000
--- a/tests/extmod/urandom_basic.py
+++ /dev/null
@@ -1,32 +0,0 @@
-try:
- import urandom as random
-except ImportError:
- try:
- import random
- except ImportError:
- print("SKIP")
- raise SystemExit
-
-# check getrandbits returns a value within the bit range
-for b in (1, 2, 3, 4, 16, 32):
- for i in range(50):
- assert random.getrandbits(b) < (1 << b)
-
-# check that seed(0) gives a non-zero value
-random.seed(0)
-print(random.getrandbits(16) != 0)
-
-# check that PRNG is repeatable
-random.seed(1)
-r = random.getrandbits(16)
-random.seed(1)
-print(random.getrandbits(16) == r)
-
-# check that zero bits works
-print(random.getrandbits(0))
-
-# check that it throws an error for negative bits
-try:
- random.getrandbits(-1)
-except ValueError:
- print("ValueError")