|
|
@ -80,7 +80,7 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
VersionBitsTester& TestStateSinceHeight(int height) {
|
|
|
|
VersionBitsTester& TestStateSinceHeight(int height) {
|
|
|
|
for (int i = 0; i < CHECKERS; i++) {
|
|
|
|
for (int i = 0; i < CHECKERS; i++) {
|
|
|
|
if ((insecure_rand() & ((1 << i) - 1)) == 0) {
|
|
|
|
if (insecure_randbits(i) == 0) {
|
|
|
|
BOOST_CHECK_MESSAGE(checker[i].GetStateSinceHeightFor(vpblock.empty() ? NULL : vpblock.back()) == height, strprintf("Test %i for StateSinceHeight", num));
|
|
|
|
BOOST_CHECK_MESSAGE(checker[i].GetStateSinceHeightFor(vpblock.empty() ? NULL : vpblock.back()) == height, strprintf("Test %i for StateSinceHeight", num));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -90,7 +90,7 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
VersionBitsTester& TestDefined() {
|
|
|
|
VersionBitsTester& TestDefined() {
|
|
|
|
for (int i = 0; i < CHECKERS; i++) {
|
|
|
|
for (int i = 0; i < CHECKERS; i++) {
|
|
|
|
if ((insecure_rand() & ((1 << i) - 1)) == 0) {
|
|
|
|
if (insecure_randbits(i) == 0) {
|
|
|
|
BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_DEFINED, strprintf("Test %i for DEFINED", num));
|
|
|
|
BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_DEFINED, strprintf("Test %i for DEFINED", num));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -100,7 +100,7 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
VersionBitsTester& TestStarted() {
|
|
|
|
VersionBitsTester& TestStarted() {
|
|
|
|
for (int i = 0; i < CHECKERS; i++) {
|
|
|
|
for (int i = 0; i < CHECKERS; i++) {
|
|
|
|
if ((insecure_rand() & ((1 << i) - 1)) == 0) {
|
|
|
|
if (insecure_randbits(i) == 0) {
|
|
|
|
BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_STARTED, strprintf("Test %i for STARTED", num));
|
|
|
|
BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_STARTED, strprintf("Test %i for STARTED", num));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -110,7 +110,7 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
VersionBitsTester& TestLockedIn() {
|
|
|
|
VersionBitsTester& TestLockedIn() {
|
|
|
|
for (int i = 0; i < CHECKERS; i++) {
|
|
|
|
for (int i = 0; i < CHECKERS; i++) {
|
|
|
|
if ((insecure_rand() & ((1 << i) - 1)) == 0) {
|
|
|
|
if (insecure_randbits(i) == 0) {
|
|
|
|
BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_LOCKED_IN, strprintf("Test %i for LOCKED_IN", num));
|
|
|
|
BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_LOCKED_IN, strprintf("Test %i for LOCKED_IN", num));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -120,7 +120,7 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
VersionBitsTester& TestActive() {
|
|
|
|
VersionBitsTester& TestActive() {
|
|
|
|
for (int i = 0; i < CHECKERS; i++) {
|
|
|
|
for (int i = 0; i < CHECKERS; i++) {
|
|
|
|
if ((insecure_rand() & ((1 << i) - 1)) == 0) {
|
|
|
|
if (insecure_randbits(i) == 0) {
|
|
|
|
BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_ACTIVE, strprintf("Test %i for ACTIVE", num));
|
|
|
|
BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_ACTIVE, strprintf("Test %i for ACTIVE", num));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -130,7 +130,7 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
VersionBitsTester& TestFailed() {
|
|
|
|
VersionBitsTester& TestFailed() {
|
|
|
|
for (int i = 0; i < CHECKERS; i++) {
|
|
|
|
for (int i = 0; i < CHECKERS; i++) {
|
|
|
|
if ((insecure_rand() & ((1 << i) - 1)) == 0) {
|
|
|
|
if (insecure_randbits(i) == 0) {
|
|
|
|
BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_FAILED, strprintf("Test %i for FAILED", num));
|
|
|
|
BOOST_CHECK_MESSAGE(checker[i].GetStateFor(vpblock.empty() ? NULL : vpblock.back()) == THRESHOLD_FAILED, strprintf("Test %i for FAILED", num));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|