diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-02-01 16:49:00 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-02-01 16:49:00 -0800 |
commit | 737de35442186143b8801e4755f69b63c59fab0b (patch) | |
tree | e3155341d71703e80b00c4b55f1019ad8cf30d9b /tests/test_core.py | |
parent | f5c957b2893744f061adbcf2a911cb693025a613 (diff) |
make sure RAND_MAX is a proper value
Diffstat (limited to 'tests/test_core.py')
-rw-r--r-- | tests/test_core.py | 5 |
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()); |