diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2017-05-23 15:28:45 -0700 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2017-06-05 12:45:44 -0700 |
commit | efee1db21a652019e0ab18fffc233d91bb7f1816 (patch) | |
tree | 32b2fc3ecb73daa71075df246975fb5e2dae7590 /src/test/prevector_tests.cpp | |
parent | 1119927df03c94f9306e4d92f55d147b900522fb (diff) |
scripted-diff: use insecure_rand256/randrange more
-BEGIN VERIFY SCRIPT-
sed -i "s/\<GetRandHash(/insecure_rand256(/" src/test/*_tests.cpp
sed -i "s/\<GetRand(/insecure_randrange(/" src/test/*_tests.cpp src/test/test_bitcoin.cpp
sed -i 's/\<insecure_rand() % \([0-9]\+\)/insecure_randrange(\1)/g' src/test/*_tests.cpp
-END VERIFY SCRIPT-
Diffstat (limited to 'src/test/prevector_tests.cpp')
-rw-r--r-- | src/test/prevector_tests.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/test/prevector_tests.cpp b/src/test/prevector_tests.cpp index 45bcac6837..28f72a9b91 100644 --- a/src/test/prevector_tests.cpp +++ b/src/test/prevector_tests.cpp @@ -206,14 +206,14 @@ BOOST_AUTO_TEST_CASE(PrevectorTestInt) test.erase(insecure_rand() % test.size()); } if (((r >> 4) % 8) == 2) { - int new_size = std::max<int>(0, std::min<int>(30, test.size() + (insecure_rand() % 5) - 2)); + int new_size = std::max<int>(0, std::min<int>(30, test.size() + (insecure_randrange(5)) - 2)); test.resize(new_size); } if (((r >> 7) % 8) == 3) { - test.insert(insecure_rand() % (test.size() + 1), 1 + (insecure_rand() % 2), insecure_rand()); + test.insert(insecure_rand() % (test.size() + 1), 1 + (insecure_randrange(2)), insecure_rand()); } if (((r >> 10) % 8) == 4) { - int del = std::min<int>(test.size(), 1 + (insecure_rand() % 2)); + int del = std::min<int>(test.size(), 1 + (insecure_randrange(2))); int beg = insecure_rand() % (test.size() + 1 - del); test.erase(beg, beg + del); } @@ -225,20 +225,20 @@ BOOST_AUTO_TEST_CASE(PrevectorTestInt) } if (((r >> 21) % 32) == 7) { int values[4]; - int num = 1 + (insecure_rand() % 4); + int num = 1 + (insecure_randrange(4)); for (int k = 0; k < num; k++) { values[k] = insecure_rand(); } test.insert_range(insecure_rand() % (test.size() + 1), values, values + num); } if (((r >> 26) % 32) == 8) { - int del = std::min<int>(test.size(), 1 + (insecure_rand() % 4)); + int del = std::min<int>(test.size(), 1 + (insecure_randrange(4))); int beg = insecure_rand() % (test.size() + 1 - del); test.erase(beg, beg + del); } r = insecure_rand(); if (r % 32 == 9) { - test.reserve(insecure_rand() % 32); + test.reserve(insecure_randrange(32)); } if ((r >> 5) % 64 == 10) { test.shrink_to_fit(); @@ -250,7 +250,7 @@ BOOST_AUTO_TEST_CASE(PrevectorTestInt) test.clear(); } if (((r >> 21) % 512) == 12) { - test.assign(insecure_rand() % 32, insecure_rand()); + test.assign(insecure_randrange(32), insecure_rand()); } if (((r >> 15) % 8) == 3) { test.swap(); |