]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add test for crypto_fast_rng_get_double().
authorNick Mathewson <nickm@torproject.org>
Thu, 7 Feb 2019 13:18:08 +0000 (08:18 -0500)
committerNick Mathewson <nickm@torproject.org>
Thu, 14 Feb 2019 14:26:40 +0000 (09:26 -0500)
src/test/test_crypto_rng.c

index 0513d2a80737c59ab8c36a3dcf6e098e9c550c86..075c876b8a270682df26b0f5740af67f4509fd9f 100644 (file)
@@ -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. */