LCOV - code coverage report
Current view: top level - src/test/util - common.cpp (source / functions) Coverage Total Hit
Test: test_bitcoin_coverage.info Lines: 0.0 % 52 0
Test Date: 2026-12-01 06:04:45 Functions: 0.0 % 21 0
Branches: 0.0 % 58 0

             Branch data     Line data    Source code
       1                 :             : // Copyright (c) The Bitcoin Core developers
       2                 :             : // Distributed under the MIT software license, see the accompanying
       3                 :             : // file COPYING or https://www.opensource.org/licenses/mit-license.php.
       4                 :             : 
       5                 :             : #include <test/util/common.h>
       6                 :             : 
       7                 :             : #include <addresstype.h>
       8                 :             : #include <addrman.h>
       9                 :             : #include <core_io.h>
      10                 :             : #include <crypto/hex_base.h>
      11                 :             : #include <key.h>
      12                 :             : #include <netaddress.h>
      13                 :             : #include <netbase.h>
      14                 :             : #include <protocol.h>
      15                 :             : #include <pubkey.h>
      16                 :             : #include <script/keyorigin.h>
      17                 :             : #include <script/script.h>
      18                 :             : #include <streams.h>
      19                 :             : #include <tinyformat.h>
      20                 :             : #include <util/bip32.h>
      21                 :             : #include <util/string.h>
      22                 :             : 
      23                 :             : #include <array>
      24                 :             : #include <ostream>
      25                 :             : #include <variant>
      26                 :             : 
      27                 :           0 : std::ostream& operator<<(std::ostream& os, const AddressPosition& pos)
      28                 :             : {
      29         [ #  # ]:           0 :     return os << strprintf("AddressPosition(tried=%d, multiplicity=%d, bucket=%d, position=%d)", pos.tried, pos.multiplicity, pos.bucket, pos.position);
      30                 :             : }
      31                 :             : 
      32                 :           0 : std::ostream& operator<<(std::ostream& os, const CScript& script)
      33                 :             : {
      34   [ #  #  #  #  :           0 :     return os << strprintf("CScript(asm=%s, hex=%s)", ScriptToAsmStr(script), HexStr(script));
                   #  # ]
      35                 :             : }
      36                 :             : 
      37                 :           0 : std::ostream& operator<<(std::ostream& os, const CService& service)
      38                 :             : {
      39   [ #  #  #  # ]:           0 :     return os << strprintf("CService(addr=%s, net=%s)", service.ToStringAddrPort(), GetNetworkName(service.GetNetwork()));
      40                 :             : }
      41                 :             : 
      42                 :           0 : std::ostream& operator<<(std::ostream& os, const CAddress& addr)
      43                 :             : {
      44         [ #  # ]:           0 :     return os << strprintf("CAddress(addr=%s, nTime=%s, nServices=[%s])",
      45                 :           0 :                            addr.ToStringAddrPort(),
      46         [ #  # ]:           0 :                            addr.nTime,
      47         [ #  # ]:           0 :                            util::Join(serviceFlagsToStr(addr.nServices), ", "));
      48                 :             : }
      49                 :             : 
      50                 :           0 : std::ostream& operator<<(std::ostream& os, const CExtKey& k)
      51                 :             : {
      52         [ #  # ]:           0 :     if (!k.key.IsValid()) return os << "CExtKey(<invalid>)";
      53                 :           0 :     std::array<std::byte, BIP32_EXTKEY_SIZE> code;
      54                 :           0 :     SpanWriter{code} << k;
      55         [ #  # ]:           0 :     return os << strprintf("CExtKey(encoded=%s)", HexStr(code));
      56                 :             : }
      57                 :             : 
      58                 :           0 : std::ostream& operator<<(std::ostream& os, const CExtPubKey& k)
      59                 :             : {
      60         [ #  # ]:           0 :     if (k.pubkey.size() != CPubKey::COMPRESSED_SIZE) return os << "CExtPubKey(<invalid>)";
      61                 :           0 :     std::array<std::byte, BIP32_EXTKEY_SIZE> code;
      62                 :           0 :     SpanWriter{code} << k;
      63         [ #  # ]:           0 :     return os << strprintf("CExtPubKey(encoded=%s)", HexStr(code));
      64                 :             : }
      65                 :             : 
      66                 :           0 : std::ostream& operator<<(std::ostream& os, const FeeFrac& ff)
      67                 :             : {
      68         [ #  # ]:           0 :     return os << strprintf("FeeFrac(fee=%d, size=%d)", ff.fee, ff.size);
      69                 :             : }
      70                 :             : 
      71                 :           0 : std::ostream& operator<<(std::ostream& os, const ByRatioNegSize<FeeFrac>& b)
      72                 :             : {
      73                 :           0 :     return os << "ByRatioNegSize(" << static_cast<const FeeFrac&>(b) << ")";
      74                 :             : }
      75                 :             : 
      76                 :           0 : std::ostream& operator<<(std::ostream& os, const CNoDestination& dest)
      77                 :             : {
      78         [ #  # ]:           0 :     return os << strprintf("CNoDestination(script=%s)", dest.GetScript());
      79                 :             : }
      80                 :             : 
      81                 :           0 : std::ostream& operator<<(std::ostream& os, const PubKeyDestination& dest)
      82                 :             : {
      83         [ #  # ]:           0 :     return os << strprintf("PubKeyDestination(pubkey=%s)", dest.GetPubKey());
      84                 :             : }
      85                 :             : 
      86                 :           0 : std::ostream& operator<<(std::ostream& os, const PKHash& h)
      87                 :             : {
      88         [ #  # ]:           0 :     return os << strprintf("PKHash(hash=%s)", h.ToString());
      89                 :             : }
      90                 :             : 
      91                 :           0 : std::ostream& operator<<(std::ostream& os, const ScriptHash& h)
      92                 :             : {
      93         [ #  # ]:           0 :     return os << strprintf("ScriptHash(hash=%s)", h.ToString());
      94                 :             : }
      95                 :             : 
      96                 :           0 : std::ostream& operator<<(std::ostream& os, const WitnessV0KeyHash& h)
      97                 :             : {
      98         [ #  # ]:           0 :     return os << strprintf("WitnessV0KeyHash(hash=%s)", h.ToString());
      99                 :             : }
     100                 :             : 
     101                 :           0 : std::ostream& operator<<(std::ostream& os, const WitnessV0ScriptHash& h)
     102                 :             : {
     103         [ #  # ]:           0 :     return os << strprintf("WitnessV0ScriptHash(hash=%s)", h.ToString());
     104                 :             : }
     105                 :             : 
     106                 :           0 : std::ostream& operator<<(std::ostream& os, const WitnessUnknown& w)
     107                 :             : {
     108   [ #  #  #  # ]:           0 :     return os << strprintf("WitnessUnknown(version=%u, program=%s)", w.GetWitnessVersion(), HexStr(w.GetWitnessProgram()));
     109                 :             : }
     110                 :             : 
     111                 :           0 : std::ostream& operator<<(std::ostream& os, const PayToAnchor& p)
     112                 :             : {
     113   [ #  #  #  # ]:           0 :     return os << strprintf("PayToAnchor(version=%u, program=%s)", p.GetWitnessVersion(), HexStr(p.GetWitnessProgram()));
     114                 :             : }
     115                 :             : 
     116                 :           0 : std::ostream& operator<<(std::ostream& os, const WitnessV1Taproot& t)
     117                 :             : {
     118         [ #  # ]:           0 :     return os << strprintf("WitnessV1Taproot(program=%s)", HexStr(t));
     119                 :             : }
     120                 :             : 
     121                 :           0 : std::ostream& operator<<(std::ostream& os, const CTxDestination& dest)
     122                 :             : {
     123                 :           0 :     std::visit([&os](const auto& alt) { os << alt; }, dest);
     124                 :           0 :     return os;
     125                 :             : }
     126                 :             : 
     127                 :           0 : std::ostream& operator<<(std::ostream& os, const CPubKey& pk)
     128                 :             : {
     129         [ #  # ]:           0 :     return os << strprintf("CPubKey(pubkey=%s)", HexStr(pk));
     130                 :             : }
     131                 :             : 
     132                 :           0 : std::ostream& operator<<(std::ostream& os, const XOnlyPubKey& pk)
     133                 :             : {
     134         [ #  # ]:           0 :     return os << strprintf("XOnlyPubKey(pubkey=%s)", HexStr(pk));
     135                 :             : }
     136                 :             : 
     137                 :           0 : std::ostream& operator<<(std::ostream& os, const KeyOriginInfo& info)
     138                 :             : {
     139   [ #  #  #  # ]:           0 :     return os << strprintf("KeyOriginInfo(fingerprint=%s, path=%s)", HexStr(info.fingerprint), FormatHDKeypath(info.path));
     140                 :             : }
        

Generated by: LCOV version 2.0-1