LCOV - code coverage report
Current view: top level - src/test - policy_fee_tests.cpp (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 13 13 100.0 %
Date: 2020-09-26 01:30:44 Functions: 9 9 100.0 %

          Line data    Source code
       1             : // Copyright (c) 2020 The Bitcoin Core developers
       2             : // Distributed under the MIT software license, see the accompanying
       3             : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       4             : 
       5             : #include <amount.h>
       6             : #include <policy/fees.h>
       7             : 
       8             : #include <test/util/setup_common.h>
       9             : 
      10             : #include <boost/test/unit_test.hpp>
      11             : 
      12          89 : BOOST_FIXTURE_TEST_SUITE(policy_fee_tests, BasicTestingSetup)
      13             : 
      14          95 : BOOST_AUTO_TEST_CASE(FeeRounder)
      15             : {
      16           1 :     FeeFilterRounder fee_rounder{CFeeRate{1000}};
      17             : 
      18             :     // check that 1000 rounds to 974 or 1071
      19           1 :     std::set<CAmount> results;
      20           4 :     while (results.size() < 2) {
      21           3 :         results.emplace(fee_rounder.round(1000));
      22             :     }
      23           1 :     BOOST_CHECK_EQUAL(*results.begin(), 974);
      24           1 :     BOOST_CHECK_EQUAL(*++results.begin(), 1071);
      25             : 
      26             :     // check that negative amounts rounds to 0
      27           1 :     BOOST_CHECK_EQUAL(fee_rounder.round(-0), 0);
      28           1 :     BOOST_CHECK_EQUAL(fee_rounder.round(-1), 0);
      29             : 
      30             :     // check that MAX_MONEY rounds to 9170997
      31           1 :     BOOST_CHECK_EQUAL(fee_rounder.round(MAX_MONEY), 9170997);
      32           1 : }
      33             : 
      34          89 : BOOST_AUTO_TEST_SUITE_END()

Generated by: LCOV version 1.15