fees: refactor: rename policy_fee_tests.cpp to feerounder_tests.cpp

- Also remame the test suite name to match the new name.
This commit is contained in:
ismaelsadeeq
2025-01-13 09:58:23 -05:00
committed by ismaelsadeeq
parent f54ffb4bc1
commit 6dfdd7e034
2 changed files with 2 additions and 2 deletions

View File

@@ -0,0 +1,35 @@
// Copyright (c) 2020-2021 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <consensus/amount.h>
#include <policy/fees.h>
#include <boost/test/unit_test.hpp>
#include <set>
BOOST_AUTO_TEST_SUITE(fee_rounder_tests)
BOOST_AUTO_TEST_CASE(FeeRounder)
{
FastRandomContext rng{/*fDeterministic=*/true};
FeeFilterRounder fee_rounder{CFeeRate{1000}, rng};
// check that 1000 rounds to 974 or 1071
std::set<CAmount> results;
while (results.size() < 2) {
results.emplace(fee_rounder.round(1000));
}
BOOST_CHECK_EQUAL(*results.begin(), 974);
BOOST_CHECK_EQUAL(*++results.begin(), 1071);
// check that negative amounts rounds to 0
BOOST_CHECK_EQUAL(fee_rounder.round(-0), 0);
BOOST_CHECK_EQUAL(fee_rounder.round(-1), 0);
// check that MAX_MONEY rounds to 9170997
BOOST_CHECK_EQUAL(fee_rounder.round(MAX_MONEY), 9170997);
}
BOOST_AUTO_TEST_SUITE_END()