Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/test/proofpool_tests.cpp
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(add_remove_proof) { | ||||
} | } | ||||
for (auto proof : proofs) { | for (auto proof : proofs) { | ||||
BOOST_CHECK(testPool.removeProof(proof)); | BOOST_CHECK(testPool.removeProof(proof)); | ||||
} | } | ||||
BOOST_CHECK(testPool.pool.empty()); | BOOST_CHECK(testPool.pool.empty()); | ||||
} | } | ||||
BOOST_AUTO_TEST_CASE(get_proof) { | |||||
ProofPool testPool; | |||||
for (size_t i = 0; i < 10; i++) { | |||||
BOOST_CHECK(!testPool.getProof(ProofId(GetRandHash()))); | |||||
} | |||||
for (size_t i = 0; i < 10; i++) { | |||||
auto proof = buildRandomProof(MIN_VALID_PROOF_SCORE); | |||||
BOOST_CHECK_EQUAL(testPool.addProof(proof), | |||||
ProofPool::AddProofStatus::SUCCEED); | |||||
auto retrievedProof = testPool.getProof(proof->getId()); | |||||
BOOST_CHECK_NE(retrievedProof, nullptr); | |||||
BOOST_CHECK_EQUAL(retrievedProof->getId(), proof->getId()); | |||||
} | |||||
} | |||||
BOOST_AUTO_TEST_SUITE_END() | BOOST_AUTO_TEST_SUITE_END() |