LCOV - code coverage report
Current view: top level - src/test - policy_fee_tests.cpp (source / functions) Hit Total Coverage
Test: fuzz_coverage.info Lines: 0 17 0.0 %
Date: 2023-10-05 12:38:51 Functions: 0 9 0.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // Copyright (c) 2020-2021 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 <consensus/amount.h>
       6                 :            : #include <policy/fees.h>
       7                 :            : 
       8                 :            : #include <boost/test/unit_test.hpp>
       9                 :            : 
      10                 :            : #include <set>
      11                 :            : 
      12                 :          0 : BOOST_AUTO_TEST_SUITE(policy_fee_tests)
      13                 :            : 
      14                 :          0 : BOOST_AUTO_TEST_CASE(FeeRounder)
      15                 :            : {
      16                 :          0 :     FeeFilterRounder fee_rounder{CFeeRate{1000}};
      17                 :          0 : 
      18                 :          0 :     // check that 1000 rounds to 974 or 1071
      19                 :          0 :     std::set<CAmount> results;
      20                 :          0 :     while (results.size() < 2) {
      21                 :          0 :         results.emplace(fee_rounder.round(1000));
      22                 :            :     }
      23                 :          0 :     BOOST_CHECK_EQUAL(*results.begin(), 974);
      24                 :          0 :     BOOST_CHECK_EQUAL(*++results.begin(), 1071);
      25                 :            : 
      26                 :            :     // check that negative amounts rounds to 0
      27                 :          0 :     BOOST_CHECK_EQUAL(fee_rounder.round(-0), 0);
      28                 :          0 :     BOOST_CHECK_EQUAL(fee_rounder.round(-1), 0);
      29                 :            : 
      30                 :            :     // check that MAX_MONEY rounds to 9170997
      31                 :          0 :     BOOST_CHECK_EQUAL(fee_rounder.round(MAX_MONEY), 9170997);
      32                 :          0 : }
      33                 :            : 
      34                 :          0 : BOOST_AUTO_TEST_SUITE_END()

Generated by: LCOV version 1.14