aboutsummaryrefslogtreecommitdiff
path: root/src/test/prevector_tests.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2017-06-07 12:03:17 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2017-06-07 12:08:39 -0700
commite945848582160b23fa0bc6f797e2bd8ac676ee0e (patch)
tree8f21846a56c3ee99978f9a64514ae8be2fa378ae /src/test/prevector_tests.cpp
parent2fcd9cc86bfce944e3312e9a24685403250f3bdc (diff)
scripted-diff: Use new naming style for insecure_rand* functions
-BEGIN VERIFY SCRIPT- sed -i 's/\<insecure_randbits(/InsecureRandBits(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp sed -i 's/\<insecure_randbool(/InsecureRandBool(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp sed -i 's/\<insecure_randrange(/InsecureRandRange(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp sed -i 's/\<insecure_randbytes(/InsecureRandBytes(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp sed -i 's/\<insecure_rand256(/InsecureRand256(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp sed -i 's/\<insecure_rand(/InsecureRand32(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp sed -i 's/\<seed_insecure_rand(/SeedInsecureRand(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp -END VERIFY SCRIPT-
Diffstat (limited to 'src/test/prevector_tests.cpp')
-rw-r--r--src/test/prevector_tests.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/test/prevector_tests.cpp b/src/test/prevector_tests.cpp
index 5d9d187268..354fed1c1d 100644
--- a/src/test/prevector_tests.cpp
+++ b/src/test/prevector_tests.cpp
@@ -187,7 +187,7 @@ public:
}
prevector_tester() {
- seed_insecure_rand();
+ SeedInsecureRand();
rand_seed = insecure_rand_seed;
rand_cache = insecure_rand_ctx;
}
@@ -198,65 +198,65 @@ BOOST_AUTO_TEST_CASE(PrevectorTestInt)
for (int j = 0; j < 64; j++) {
prevector_tester<8, int> test;
for (int i = 0; i < 2048; i++) {
- if (insecure_randbits(2) == 0) {
- test.insert(insecure_randrange(test.size() + 1), insecure_rand());
+ if (InsecureRandBits(2) == 0) {
+ test.insert(InsecureRandRange(test.size() + 1), InsecureRand32());
}
- if (test.size() > 0 && insecure_randbits(2) == 1) {
- test.erase(insecure_randrange(test.size()));
+ if (test.size() > 0 && InsecureRandBits(2) == 1) {
+ test.erase(InsecureRandRange(test.size()));
}
- if (insecure_randbits(3) == 2) {
- int new_size = std::max<int>(0, std::min<int>(30, test.size() + (insecure_randrange(5)) - 2));
+ if (InsecureRandBits(3) == 2) {
+ int new_size = std::max<int>(0, std::min<int>(30, test.size() + (InsecureRandRange(5)) - 2));
test.resize(new_size);
}
- if (insecure_randbits(3) == 3) {
- test.insert(insecure_randrange(test.size() + 1), 1 + insecure_randbool(), insecure_rand());
+ if (InsecureRandBits(3) == 3) {
+ test.insert(InsecureRandRange(test.size() + 1), 1 + InsecureRandBool(), InsecureRand32());
}
- if (insecure_randbits(3) == 4) {
- int del = std::min<int>(test.size(), 1 + (insecure_randbool()));
- int beg = insecure_randrange(test.size() + 1 - del);
+ if (InsecureRandBits(3) == 4) {
+ int del = std::min<int>(test.size(), 1 + (InsecureRandBool()));
+ int beg = InsecureRandRange(test.size() + 1 - del);
test.erase(beg, beg + del);
}
- if (insecure_randbits(4) == 5) {
- test.push_back(insecure_rand());
+ if (InsecureRandBits(4) == 5) {
+ test.push_back(InsecureRand32());
}
- if (test.size() > 0 && insecure_randbits(4) == 6) {
+ if (test.size() > 0 && InsecureRandBits(4) == 6) {
test.pop_back();
}
- if (insecure_randbits(5) == 7) {
+ if (InsecureRandBits(5) == 7) {
int values[4];
- int num = 1 + (insecure_randbits(2));
+ int num = 1 + (InsecureRandBits(2));
for (int k = 0; k < num; k++) {
- values[k] = insecure_rand();
+ values[k] = InsecureRand32();
}
- test.insert_range(insecure_randrange(test.size() + 1), values, values + num);
+ test.insert_range(InsecureRandRange(test.size() + 1), values, values + num);
}
- if (insecure_randbits(5) == 8) {
- int del = std::min<int>(test.size(), 1 + (insecure_randbits(2)));
- int beg = insecure_randrange(test.size() + 1 - del);
+ if (InsecureRandBits(5) == 8) {
+ int del = std::min<int>(test.size(), 1 + (InsecureRandBits(2)));
+ int beg = InsecureRandRange(test.size() + 1 - del);
test.erase(beg, beg + del);
}
- if (insecure_randbits(5) == 9) {
- test.reserve(insecure_randbits(5));
+ if (InsecureRandBits(5) == 9) {
+ test.reserve(InsecureRandBits(5));
}
- if (insecure_randbits(6) == 10) {
+ if (InsecureRandBits(6) == 10) {
test.shrink_to_fit();
}
if (test.size() > 0) {
- test.update(insecure_randrange(test.size()), insecure_rand());
+ test.update(InsecureRandRange(test.size()), InsecureRand32());
}
- if (insecure_randbits(10) == 11) {
+ if (InsecureRandBits(10) == 11) {
test.clear();
}
- if (insecure_randbits(9) == 12) {
- test.assign(insecure_randbits(5), insecure_rand());
+ if (InsecureRandBits(9) == 12) {
+ test.assign(InsecureRandBits(5), InsecureRand32());
}
- if (insecure_randbits(3) == 3) {
+ if (InsecureRandBits(3) == 3) {
test.swap();
}
- if (insecure_randbits(4) == 8) {
+ if (InsecureRandBits(4) == 8) {
test.copy();
}
- if (insecure_randbits(5) == 18) {
+ if (InsecureRandBits(5) == 18) {
test.move();
}
}