mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-08 19:53:27 +01:00
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-
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user