LCOV - code coverage report
Current view: top level - irohad/consensus/impl - round.cpp (source / functions) Hit Total Coverage
Test: cleared_cor.info Lines: 14 16 87.5 %
Date: 2019-03-07 14:46:43 Functions: 6 7 85.7 %

          Line data    Source code
       1             : /**
       2             :  * Copyright Soramitsu Co., Ltd. All Rights Reserved.
       3             :  * SPDX-License-Identifier: Apache-2.0
       4             :  */
       5             : 
       6             : #include "consensus/round.hpp"
       7             : 
       8             : #include <ciso646>
       9             : #include <tuple>
      10             : #include <utility>
      11             : 
      12             : #include <boost/functional/hash.hpp>
      13             : #include "utils/string_builder.hpp"
      14             : 
      15             : namespace iroha {
      16             :   namespace consensus {
      17             :     Round::Round(BlockRoundType block_r, RejectRoundType reject_r)
      18       51131 :         : block_round{block_r}, reject_round{reject_r} {}
      19             : 
      20             :     bool Round::operator<(const Round &rhs) const {
      21       30646 :       return std::tie(block_round, reject_round)
      22       30646 :           < std::tie(rhs.block_round, rhs.reject_round);
      23             :     }
      24             : 
      25             :     bool Round::operator==(const Round &rhs) const {
      26       80901 :       return std::tie(block_round, reject_round)
      27       80901 :           == std::tie(rhs.block_round, rhs.reject_round);
      28             :     }
      29             : 
      30             :     bool Round::operator!=(const Round &rhs) const {
      31           0 :       return not(*this == rhs);
      32             :     }
      33             : 
      34             :     std::size_t RoundTypeHasher::operator()(const consensus::Round &val) const {
      35       36921 :       size_t seed = 0;
      36       36921 :       boost::hash_combine(seed, val.block_round);
      37       36921 :       boost::hash_combine(seed, val.reject_round);
      38       36921 :       return seed;
      39             :     }
      40             : 
      41             :     std::string Round::toString() const {
      42       25565 :       return shared_model::detail::PrettyStringBuilder()
      43       25374 :           .init("Round")
      44       25466 :           .append("block", std::to_string(block_round))
      45       25464 :           .append("reject", std::to_string(reject_round))
      46       25500 :           .finalize();
      47           0 :     }
      48             :   }  // namespace consensus
      49             : }  // namespace iroha

Generated by: LCOV version 1.13