LCOV - code coverage report
Current view: top level - shared_model/interfaces/transaction_responses/impl - tx_response.cpp (source / functions) Hit Total Coverage
Test: coverage_cleared.info Lines: 18 19 94.7 %
Date: 2018-12-05 17:11:35 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /**
       2             :  * Copyright Soramitsu Co., Ltd. All Rights Reserved.
       3             :  * SPDX-License-Identifier: Apache-2.0
       4             :  */
       5             : 
       6             : #include "interfaces/transaction_responses/tx_response_variant.hpp"
       7             : 
       8             : #include "interfaces/transaction.hpp"
       9             : #include "interfaces/transaction_responses/committed_tx_response.hpp"
      10             : #include "interfaces/transaction_responses/enough_signatures_collected_response.hpp"
      11             : #include "interfaces/transaction_responses/mst_expired_response.hpp"
      12             : #include "interfaces/transaction_responses/mst_pending_response.hpp"
      13             : #include "interfaces/transaction_responses/not_received_tx_response.hpp"
      14             : #include "interfaces/transaction_responses/rejected_tx_response.hpp"
      15             : #include "interfaces/transaction_responses/stateful_failed_tx_response.hpp"
      16             : #include "interfaces/transaction_responses/stateful_valid_tx_response.hpp"
      17             : #include "interfaces/transaction_responses/stateless_failed_tx_response.hpp"
      18             : #include "interfaces/transaction_responses/stateless_valid_tx_response.hpp"
      19             : #include "utils/visitor_apply_for_all.hpp"
      20             : 
      21             : using Variant =
      22             :     shared_model::interface::TransactionResponse::ResponseVariantType;
      23             : template Variant::~variant();
      24             : template Variant::variant(Variant &&);
      25             : template bool Variant::operator==(const Variant &) const;
      26             : template void Variant::destroy_content();
      27             : template int Variant::which() const;
      28             : template void Variant::indicate_which(int);
      29             : template bool Variant::using_backup() const;
      30             : template Variant::convert_copy_into::convert_copy_into(void *);
      31             : 
      32             : namespace shared_model {
      33             :   namespace interface {
      34             :     TransactionResponse::PrioritiesComparisonResult
      35             :     TransactionResponse::comparePriorities(const ModelType &other) const
      36             :         noexcept {
      37        2145 :       if (this->priority() < other.priority()) {
      38         744 :         return PrioritiesComparisonResult::kLess;
      39        1401 :       } else if (this->priority() == other.priority()) {
      40           3 :         return PrioritiesComparisonResult::kEqual;
      41             :       }
      42        1398 :       return PrioritiesComparisonResult::kGreater;
      43        2145 :     };
      44             : 
      45             :     std::string TransactionResponse::toString() const {
      46         747 :       return detail::PrettyStringBuilder()
      47         747 :           .init("TransactionResponse")
      48         747 :           .append("transactionHash", transactionHash().hex())
      49         747 :           .append(boost::apply_visitor(detail::ToStringVisitor(), get()))
      50         747 :           .append("statelessErrorOrCmdName", statelessErrorOrCommandName())
      51         747 :           .append("failedCmdIndex", std::to_string(failedCommandIndex()))
      52         747 :           .append("errorCode", std::to_string(errorCode()))
      53         747 :           .finalize();
      54           0 :     }
      55             : 
      56             :     bool TransactionResponse::operator==(const ModelType &rhs) const {
      57       20003 :       return transactionHash() == rhs.transactionHash()
      58       20003 :           and statelessErrorOrCommandName() == rhs.statelessErrorOrCommandName()
      59       20003 :           and failedCommandIndex() == rhs.failedCommandIndex()
      60       20002 :           and errorCode() == rhs.errorCode() and get() == rhs.get();
      61             :     }
      62             :   }  // namespace interface
      63             : }  // namespace shared_model

Generated by: LCOV version 1.13