Changeset View
Changeset View
Standalone View
Standalone View
src/test/policyestimator_tests.cpp
// Copyright (c) 2011-2016 The Bitcoin Core developers | // Copyright (c) 2011-2016 The Bitcoin Core 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 "policy/fees.h" | #include "policy/fees.h" | ||||
#include "policy/policy.h" | #include "policy/policy.h" | ||||
#include "txmempool.h" | #include "txmempool.h" | ||||
#include "uint256.h" | #include "uint256.h" | ||||
#include "util.h" | #include "util.h" | ||||
#include "test/test_bitcoin.h" | #include "test/test_bitcoin.h" | ||||
#include <boost/test/unit_test.hpp> | #include <boost/test/unit_test.hpp> | ||||
BOOST_FIXTURE_TEST_SUITE(policyestimator_tests, BasicTestingSetup) | BOOST_FIXTURE_TEST_SUITE(policyestimator_tests, BasicTestingSetup) | ||||
BOOST_AUTO_TEST_CASE(test_MempoolFeeEstimator) { | |||||
MempoolFeeEstimator estimator; | |||||
estimator.addFee(CFeeRate(5 * SATOSHI)); | |||||
estimator.addFee(CFeeRate(4 * SATOSHI)); | |||||
estimator.addFee(CFeeRate(1 * SATOSHI)); | |||||
estimator.addFee(CFeeRate(2 * SATOSHI)); | |||||
estimator.addFee(CFeeRate(3 * SATOSHI)); | |||||
BOOST_CHECK_MESSAGE( | |||||
estimator.estimateMedian() == CFeeRate(3 * SATOSHI), | |||||
"Median is incorrect: " << estimator.estimateMedian().ToString()); | |||||
estimator.addFee(CFeeRate(4 * SATOSHI)); | |||||
estimator.addFee(CFeeRate(5 * SATOSHI)); | |||||
estimator.addFee(CFeeRate(3 * SATOSHI)); | |||||
estimator.addFee(CFeeRate(3 * SATOSHI)); | |||||
BOOST_CHECK_MESSAGE( | |||||
estimator.estimateMedian() == CFeeRate(3 * SATOSHI), | |||||
"Median is incorrect: " << estimator.estimateMedian().ToString()); | |||||
} | |||||
BOOST_AUTO_TEST_CASE(MempoolMinimumFeeEstimate) { | BOOST_AUTO_TEST_CASE(MempoolMinimumFeeEstimate) { | ||||
CTxMemPool mpool; | CTxMemPool mpool; | ||||
TestMemPoolEntryHelper entry; | TestMemPoolEntryHelper entry; | ||||
// Create a transaction template | // Create a transaction template | ||||
CScript garbage; | CScript garbage; | ||||
for (unsigned int i = 0; i < 128; i++) { | for (unsigned int i = 0; i < 128; i++) { | ||||
garbage.push_back('X'); | garbage.push_back('X'); | ||||
▲ Show 20 Lines • Show All 84 Lines • Show Last 20 Lines |