diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2018-10-31 14:25:11 -0700 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2018-12-12 14:22:12 -0800 |
commit | 8d98d426116f0178612f14d1874d331042c4c4b7 (patch) | |
tree | 9ca9e096ec04b5b1332578a06b26a9acc43467ec /src/test/random_tests.cpp | |
parent | 273d02580aa736b7ccea8fce51d90541665fdbd1 (diff) |
Bugfix: randbytes should seed when needed (non reachable issue)
Diffstat (limited to 'src/test/random_tests.cpp')
-rw-r--r-- | src/test/random_tests.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/test/random_tests.cpp b/src/test/random_tests.cpp index 9d69d1247d..1057d09471 100644 --- a/src/test/random_tests.cpp +++ b/src/test/random_tests.cpp @@ -38,11 +38,18 @@ BOOST_AUTO_TEST_CASE(fastrandom_tests) BOOST_CHECK(ctx1.randbytes(50) == ctx2.randbytes(50)); // Check that a nondeterministic ones are not - FastRandomContext ctx3; - FastRandomContext ctx4; - BOOST_CHECK(ctx3.rand64() != ctx4.rand64()); // extremely unlikely to be equal - BOOST_CHECK(ctx3.rand256() != ctx4.rand256()); - BOOST_CHECK(ctx3.randbytes(7) != ctx4.randbytes(7)); + { + FastRandomContext ctx3, ctx4; + BOOST_CHECK(ctx3.rand64() != ctx4.rand64()); // extremely unlikely to be equal + } + { + FastRandomContext ctx3, ctx4; + BOOST_CHECK(ctx3.rand256() != ctx4.rand256()); + } + { + FastRandomContext ctx3, ctx4; + BOOST_CHECK(ctx3.randbytes(7) != ctx4.randbytes(7)); + } } BOOST_AUTO_TEST_CASE(fastrandom_randbits) |