Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/test/proof_tests.cpp
Show All 17 Lines | |||||
using namespace avalanche; | using namespace avalanche; | ||||
BOOST_FIXTURE_TEST_SUITE(proof_tests, TestingSetup) | BOOST_FIXTURE_TEST_SUITE(proof_tests, TestingSetup) | ||||
BOOST_AUTO_TEST_CASE(proof_random) { | BOOST_AUTO_TEST_CASE(proof_random) { | ||||
for (int i = 0; i < 1000; i++) { | for (int i = 0; i < 1000; i++) { | ||||
const uint32_t score = InsecureRand32(); | const uint32_t score = InsecureRand32(); | ||||
const Proof p = buildRandomProof(score); | auto p = buildRandomProof(score); | ||||
BOOST_CHECK_EQUAL(p.getScore(), score); | BOOST_CHECK_EQUAL(p->getScore(), score); | ||||
ProofValidationResult expected_state = | ProofValidationResult expected_state = | ||||
hasDustStake(p) ? ProofValidationResult::DUST_THRESOLD | hasDustStake(p) ? ProofValidationResult::DUST_THRESOLD | ||||
: ProofValidationResult::NONE; | : ProofValidationResult::NONE; | ||||
ProofValidationState state; | ProofValidationState state; | ||||
BOOST_CHECK_EQUAL(p.verify(state), | BOOST_CHECK_EQUAL(p->verify(state), | ||||
state.GetResult() == ProofValidationResult::NONE); | state.GetResult() == ProofValidationResult::NONE); | ||||
BOOST_CHECK(state.GetResult() == expected_state); | BOOST_CHECK(state.GetResult() == expected_state); | ||||
} | } | ||||
} | } | ||||
BOOST_AUTO_TEST_CASE(proofbuilder) { | BOOST_AUTO_TEST_CASE(proofbuilder) { | ||||
// Master key. | // Master key. | ||||
auto key = CKey::MakeCompressedKey(); | auto key = CKey::MakeCompressedKey(); | ||||
▲ Show 20 Lines • Show All 1,016 Lines • Show Last 20 Lines |