diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-02-07 08:18:08 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-02-14 09:26:40 -0500 |
commit | 3f28b98220a49730b8c58c45e42598ad2bada47b (patch) | |
tree | cd4e52c04078434eaeed736aa751bf55a2c594a2 /src/test/test_crypto_rng.c | |
parent | acbde10fce5d688d70b5a4bfb3a736da838bb4cc (diff) | |
download | tor-3f28b98220a49730b8c58c45e42598ad2bada47b.tar.gz tor-3f28b98220a49730b8c58c45e42598ad2bada47b.zip |
Add test for crypto_fast_rng_get_double().
Diffstat (limited to 'src/test/test_crypto_rng.c')
-rw-r--r-- | src/test/test_crypto_rng.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/test/test_crypto_rng.c b/src/test/test_crypto_rng.c index 0513d2a807..075c876b8a 100644 --- a/src/test/test_crypto_rng.c +++ b/src/test/test_crypto_rng.c @@ -207,6 +207,10 @@ test_crypto_rng_fast(void *arg) uint64_t u64 = crypto_fast_rng_get_uint64(rng, UINT64_C(1)<<40); tt_u64_op(u64, OP_GE, 0); tt_u64_op(u64, OP_LT, UINT64_C(1)<<40); + + double d = crypto_fast_rng_get_double(rng); + tt_assert(d >= 0.0); + tt_assert(d < 1.0); } /* All values should have come up once. */ |