LCOV - code coverage report
Current view: top level - src/test/util - coins.h (source / functions) Coverage Total Hit
Test: fuzz_coverage.info Lines: 100.0 % 2 2
Test Date: 2026-09-03 06:16:07 Functions: 100.0 % 1 1
Branches: 50.0 % 6 3

             Branch data     Line data    Source code
       1                 :             : // Copyright (c) 2023-present 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                 :             : #ifndef BITCOIN_TEST_UTIL_COINS_H
       6                 :             : #define BITCOIN_TEST_UTIL_COINS_H
       7                 :             : 
       8                 :             : #include <coins.h>
       9                 :             : #include <crypto/hex_base.h>
      10                 :             : #include <primitives/transaction.h>
      11                 :             : #include <tinyformat.h>
      12                 :             : 
      13                 :             : #include <ostream>
      14                 :             : 
      15                 :             : class CCoinsViewCache;
      16                 :             : class FastRandomContext;
      17                 :             : 
      18                 :             : /**
      19                 :             :  * Create a Coin with DynamicMemoryUsage of 80 bytes and add it to the given view.
      20                 :             :  * @param[in,out] coins_view  The coins view cache to add the new coin to.
      21                 :             :  * @returns the COutPoint of the created coin.
      22                 :             :  */
      23                 :             : COutPoint AddTestCoin(FastRandomContext& rng, CCoinsViewCache& coins_view);
      24                 :             : 
      25                 :             : //! Strict equality, including fields of spent coins
      26                 :       88346 : inline bool operator==(const Coin& a, const Coin& b)
      27                 :             : {
      28   [ +  -  +  -  :       88346 :     return a.fCoinBase == b.fCoinBase && a.nHeight == b.nHeight && a.out == b.out;
                   -  + ]
      29                 :             : }
      30                 :             : 
      31                 :             : //! Printed when a coin comparison fails
      32                 :             : inline std::ostream& operator<<(std::ostream& os, const Coin& coin)
      33                 :             : {
      34                 :             :     return os << strprintf("Coin(spent=%d, coinbase=%d, height=%d, value=%d, scriptPubKey=%s)",
      35                 :             :                            coin.IsSpent(), coin.fCoinBase, coin.nHeight, coin.out.nValue, HexStr(coin.out.scriptPubKey));
      36                 :             : }
      37                 :             : 
      38                 :             : #endif // BITCOIN_TEST_UTIL_COINS_H
        

Generated by: LCOV version 2.5.0-full