LCOV - code coverage report
Current view: top level - lib - testing_api_trait_merchant_sig.c (source / functions) Hit Total Coverage
Test: rcoverage.info Lines: 5 5 100.0 %
Date: 2018-09-21 06:18:36 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /*
       2             :   This file is part of TALER
       3             :   Copyright (C) 2018 Taler Systems SA
       4             : 
       5             :   TALER is free software; you can redistribute it and/or modify
       6             :   it under the terms of the GNU General Public License as
       7             :   published by the Free Software Foundation; either version 3, or
       8             :   (at your option) any later version.
       9             : 
      10             :   TALER is distributed in the hope that it will be useful, but
      11             :   WITHOUT ANY WARRANTY; without even the implied warranty of
      12             :   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      13             :   GNU General Public License for more details.
      14             : 
      15             :   You should have received a copy of the GNU General Public
      16             :   License along with TALER; see the file COPYING.  If not, see
      17             :   <http://www.gnu.org/licenses/>
      18             : */
      19             : /**
      20             :  * @file lib/testing_api_trait_merchant_sig.c
      21             :  * @brief offer merchant signature over contract
      22             :  * @author Marcello Stanisci
      23             :  */
      24             : #include "platform.h"
      25             : #include <taler/taler_signatures.h>
      26             : #include <taler/taler_exchange_service.h>
      27             : #include <taler/taler_testing_lib.h>
      28             : 
      29             : #define TALER_TESTING_TRAIT_MERCHANT_SIG "reserve-private-key"
      30             : 
      31             : /**
      32             :  * Obtain a merchant signature over a contract from a @a cmd.
      33             :  *
      34             :  * @param cmd command to extract trait from
      35             :  * @param index which signature to pick if @a cmd has multiple
      36             :  *        on offer
      37             :  * @param merchant_sig[out] set to the wanted signature.
      38             :  *
      39             :  * @return #GNUNET_OK on success
      40             :  */
      41             : int
      42          23 : TALER_TESTING_get_trait_merchant_sig
      43             :   (const struct TALER_TESTING_Command *cmd,
      44             :    unsigned int index,
      45             :    struct TALER_MerchantSignatureP **merchant_sig)
      46             : {
      47          23 :   return cmd->traits (cmd->cls,
      48             :                       (void **) merchant_sig,
      49             :                       TALER_TESTING_TRAIT_MERCHANT_SIG,
      50             :                       index);
      51             : }
      52             : 
      53             : /**
      54             :  * Offer a merchant signature over a contract.
      55             :  *
      56             :  * @param index which signature to offer if there are multiple
      57             :  *        on offer
      58             :  * @param merchant_sig set to the offered signature.
      59             :  *
      60             :  * @return the trait
      61             :  */
      62             : struct TALER_TESTING_Trait
      63         177 : TALER_TESTING_make_trait_merchant_sig
      64             :   (unsigned int index,
      65             :    const struct TALER_MerchantSignatureP *merchant_sig)
      66             : {
      67         177 :   struct TALER_TESTING_Trait ret = {
      68             :     .index = index,
      69             :     .trait_name = TALER_TESTING_TRAIT_MERCHANT_SIG,
      70             :     .ptr = (const void *) merchant_sig
      71             :   };
      72         177 :   return ret;
      73             : }
      74             : 
      75             : /* end of testing_api_trait_merchant_sig.c */

Generated by: LCOV version 1.13