LCOV - code coverage report
Current view: top level - shared_model/validators - proposal_validator.hpp (source / functions) Hit Total Coverage
Test: coverage_cleared.info Lines: 2 3 66.7 %
Date: 2018-12-05 17:11:35 Functions: 9 9 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             : #ifndef IROHA_PROPOSAL_VALIDATOR_HPP
       7             : #define IROHA_PROPOSAL_VALIDATOR_HPP
       8             : 
       9             : #include <boost/format.hpp>
      10             : #include <regex>
      11             : #include "datetime/time.hpp"
      12             : #include "interfaces/common_objects/types.hpp"
      13             : #include "interfaces/iroha_internal/proposal.hpp"
      14             : #include "validators/answer.hpp"
      15             : #include "validators/container_validator.hpp"
      16             : 
      17             : // TODO 22/01/2018 x3medima17: write stateless validator IR-836
      18             : 
      19             : namespace shared_model {
      20             :   namespace validation {
      21             : 
      22             :     /**
      23             :      * Class that validates proposal
      24             :      */
      25             :     template <typename FieldValidator, typename TransactionsCollectionValidator>
      26             :     class ProposalValidator
      27             :         : public ContainerValidator<interface::Proposal,
      28             :                                     FieldValidator,
      29             :                                     TransactionsCollectionValidator> {
      30             :      public:
      31             :       using ContainerValidator<
      32             :           interface::Proposal,
      33             :           FieldValidator,
      34             :           TransactionsCollectionValidator>::ContainerValidator;
      35             :       /**
      36             :        * Applies validation on proposal
      37             :        * @param proposal
      38             :        * @return Answer containing found error if any
      39             :        */
      40             :       Answer validate(const interface::Proposal &prop) const {
      41           6 :         return ContainerValidator<
      42             :             interface::Proposal,
      43             :             FieldValidator,
      44           6 :             TransactionsCollectionValidator>::validate(prop, "Proposal");
      45           0 :       }
      46             :     };
      47             : 
      48             :   }  // namespace validation
      49             : }  // namespace shared_model
      50             : 
      51             : #endif  // IROHA_PROPOSAL_VALIDATOR_HPP

Generated by: LCOV version 1.13