aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-06-22 21:30:26 -0400
committerNick Mathewson <nickm@torproject.org>2010-06-22 21:30:26 -0400
commit006e2e8620fa9001c8df24463c06538cf58ce396 (patch)
tree23964dd0db4cec3dbcd6e22f0c70104c21e07a3f /src/test
parente2b117eb806dd517867f99519e2f74a3b2ea0072 (diff)
downloadtor-006e2e8620fa9001c8df24463c06538cf58ce396.tar
tor-006e2e8620fa9001c8df24463c06538cf58ce396.tar.gz
Add a function to return a double in range [0,1).
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_crypto.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index 7aca098bc..b475914b1 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -57,6 +57,7 @@ test_crypto_rng(void)
{
int i, j, allok;
char data1[100], data2[100];
+ double d;
/* Try out RNG. */
test_assert(! crypto_seed_rng(0));
@@ -76,6 +77,9 @@ test_crypto_rng(void)
big = crypto_rand_uint64(U64_LITERAL(5));
if (big >= 5)
allok = 0;
+ d = crypto_rand_double();
+ test_assert(d >= 0);
+ test_assert(d < 1.0);
host = crypto_random_hostname(3,8,"www.",".onion");
if (strcmpstart(host,"www.") ||
strcmpend(host,".onion") ||