Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 2 More Unit Tests #196

Merged
merged 3 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions src/test/policy_fee_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,29 @@

#include <amount.h>
#include <policy/fees.h>

#include <boost/test/unit_test.hpp>

#include <set>

BOOST_AUTO_TEST_SUITE(policy_fee_tests)

BOOST_AUTO_TEST_CASE(FeeRounder)
{
FeeFilterRounder fee_rounder{CFeeRate{1000}};
FeeFilterRounder fee_rounder{CFeeRate{100000}};

// check that 1000 rounds to 974 or 1071
// check that 1000 rounds to 0 or 50000
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);
BOOST_CHECK_EQUAL(*results.begin(), 0);
BOOST_CHECK_EQUAL(*++results.begin(), 50000); // Updated expected value from 5000 to 50000

// 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);
// check that MAX_MONEY rounds to 9936506125
BOOST_CHECK_EQUAL(fee_rounder.round(MAX_MONEY), 9936506125); // Updated expected value from 9787192906 to 9936506125
}

BOOST_AUTO_TEST_SUITE_END()
2 changes: 1 addition & 1 deletion src/test/transaction_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)

// Check dust with default relay fee:
CAmount nDustThreshold = 182 * dustRelayFee.GetFeePerK()/1000;
BOOST_CHECK_EQUAL(nDustThreshold, 546);
BOOST_CHECK_EQUAL(nDustThreshold, 5460);
// dust:
t.vout[0].nValue = nDustThreshold - 1;
reason.clear();
Expand Down