Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/test/processor_tests.cpp
- This file was moved from src/avalanche/test/avalanche_tests.cpp.
// Copyright (c) 2018-2020 The Bitcoin developers | // Copyright (c) 2018-2020 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <avalanche/avalanche.h> | #include <avalanche/processor.h> | ||||
#include <config.h> | #include <config.h> | ||||
#include <net_processing.h> // For PeerLogicValidation | #include <net_processing.h> // For PeerLogicValidation | ||||
#include <util/time.h> | #include <util/time.h> | ||||
#include <test/util/setup_common.h> | #include <test/util/setup_common.h> | ||||
#include <boost/test/unit_test.hpp> | #include <boost/test/unit_test.hpp> | ||||
Show All 22 Lines | void ClearNodes() { | ||||
LOCK(cs_vNodes); | LOCK(cs_vNodes); | ||||
for (CNode *node : vNodes) { | for (CNode *node : vNodes) { | ||||
delete node; | delete node; | ||||
} | } | ||||
vNodes.clear(); | vNodes.clear(); | ||||
} | } | ||||
}; | }; | ||||
BOOST_FIXTURE_TEST_SUITE(avalanche_tests, TestChain100Setup) | BOOST_FIXTURE_TEST_SUITE(processor_tests, TestChain100Setup) | ||||
#define REGISTER_VOTE_AND_CHECK(vr, vote, state, finalized, confidence) \ | #define REGISTER_VOTE_AND_CHECK(vr, vote, state, finalized, confidence) \ | ||||
vr.registerVote(NO_NODE, vote); \ | vr.registerVote(NO_NODE, vote); \ | ||||
BOOST_CHECK_EQUAL(vr.isAccepted(), state); \ | BOOST_CHECK_EQUAL(vr.isAccepted(), state); \ | ||||
BOOST_CHECK_EQUAL(vr.hasFinalized(), finalized); \ | BOOST_CHECK_EQUAL(vr.hasFinalized(), finalized); \ | ||||
BOOST_CHECK_EQUAL(vr.getConfidence(), confidence); | BOOST_CHECK_EQUAL(vr.getConfidence(), confidence); | ||||
BOOST_AUTO_TEST_CASE(vote_record) { | BOOST_AUTO_TEST_CASE(vote_record) { | ||||
▲ Show 20 Lines • Show All 911 Lines • Show Last 20 Lines |