LCOV - code coverage report
Current view: top level - src/util - hash_type.h (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 31 31 100.0 %
Date: 2022-04-21 14:51:19 Functions: 24 24 100.0 %
Legend: Modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed

Not modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed
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                 :            : #ifndef BITCOIN_UTIL_HASH_TYPE_H
#       6                 :            : #define BITCOIN_UTIL_HASH_TYPE_H
#       7                 :            : 
#       8                 :            : template <typename HashType>
#       9                 :            : class BaseHash
#      10                 :            : {
#      11                 :            : protected:
#      12                 :            :     HashType m_hash;
#      13                 :            : 
#      14                 :            : public:
#      15                 :     843208 :     BaseHash() : m_hash() {}
#      16                 :    2637326 :     explicit BaseHash(const HashType& in) : m_hash(in) {}
#      17                 :            : 
#      18                 :            :     unsigned char* begin()
#      19                 :     380572 :     {
#      20                 :     380572 :         return m_hash.begin();
#      21                 :     380572 :     }
#      22                 :            : 
#      23                 :            :     const unsigned char* begin() const
#      24                 :    1484184 :     {
#      25                 :    1484184 :         return m_hash.begin();
#      26                 :    1484184 :     }
#      27                 :            : 
#      28                 :            :     unsigned char* end()
#      29                 :            :     {
#      30                 :            :         return m_hash.end();
#      31                 :            :     }
#      32                 :            : 
#      33                 :            :     const unsigned char* end() const
#      34                 :    1483237 :     {
#      35                 :    1483237 :         return m_hash.end();
#      36                 :    1483237 :     }
#      37                 :            : 
#      38                 :            :     operator std::vector<unsigned char>() const
#      39                 :       8947 :     {
#      40                 :       8947 :         return std::vector<unsigned char>{m_hash.begin(), m_hash.end()};
#      41                 :       8947 :     }
#      42                 :            : 
#      43                 :            :     std::string ToString() const
#      44                 :          6 :     {
#      45                 :          6 :         return m_hash.ToString();
#      46                 :          6 :     }
#      47                 :            : 
#      48                 :            :     bool operator==(const BaseHash<HashType>& other) const noexcept
#      49                 :      19954 :     {
#      50                 :      19954 :         return m_hash == other.m_hash;
#      51                 :      19954 :     }
#      52                 :            : 
#      53                 :            :     bool operator!=(const BaseHash<HashType>& other) const noexcept
#      54                 :         35 :     {
#      55                 :         35 :         return !(m_hash == other.m_hash);
#      56                 :         35 :     }
#      57                 :            : 
#      58                 :            :     bool operator<(const BaseHash<HashType>& other) const noexcept
#      59                 :  203901614 :     {
#      60                 :  203901614 :         return m_hash < other.m_hash;
#      61                 :  203901614 :     }
#      62                 :            : 
#      63                 :            :     size_t size() const
#      64                 :      27636 :     {
#      65                 :      27636 :         return m_hash.size();
#      66                 :      27636 :     }
#      67                 :            : 
#      68                 :          2 :     unsigned char* data() { return m_hash.data(); }
#      69                 :       1018 :     const unsigned char* data() const { return m_hash.data(); }
#      70                 :            : };
#      71                 :            : 
#      72                 :            : #endif // BITCOIN_UTIL_HASH_TYPE_H

Generated by: LCOV version 0-eol-96201-ge66f56f4af6a