aboutsummaryrefslogtreecommitdiff
path: root/tests/test_core.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_core.py')
-rw-r--r--tests/test_core.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/test_core.py b/tests/test_core.py
index 32b3f143..4141606b 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -3552,8 +3552,13 @@ ok
def test_rand(self):
src = r'''#include <stdlib.h>
#include <stdio.h>
+#include <assert.h>
int main()
{
+ // we need RAND_MAX to be a bitmask (power of 2 minus 1). this assertions guarantees
+ // if RAND_MAX changes the test failure will focus attention on that issue here.
+ assert(RAND_MAX == 0x7fffffff);
+
srand(0xdeadbeef);
for(int i = 0; i < 10; ++i)
printf("%d\n", rand());