LCOV - code coverage report
Current view: top level - testing - testing_api_trait_denom_sig.c (source / functions) Hit Total Coverage
Test: GNU Taler exchange coverage report Lines: 5 5 100.0 %
Date: 2021-08-30 06:43:37 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          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,
       8             :   or (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             : /**
      21             :  * @file testing/testing_api_trait_denom_sig.c
      22             :  * @brief offer denomination signatures as traits
      23             :  * @author Christian Grothoff
      24             :  * @author Marcello Stanisci
      25             :  */
      26             : #include "platform.h"
      27             : #include "taler_json_lib.h"
      28             : #include <gnunet/gnunet_curl_lib.h>
      29             : #include "taler_signatures.h"
      30             : #include "taler_testing_lib.h"
      31             : 
      32             : #define TALER_TESTING_TRAIT_DENOM_SIG "denomination-signature"
      33             : 
      34             : 
      35             : /**
      36             :  * Obtain a denomination signature from a @a cmd.
      37             :  *
      38             :  * @param cmd command to extract the denom sig from.
      39             :  * @param index index number associated with the denom sig.
      40             :  * @param[out] denom_sig set to the offered signature.
      41             :  * @return #GNUNET_OK on success.
      42             :  */
      43             : int
      44          78 : TALER_TESTING_get_trait_denom_sig
      45             :   (const struct TALER_TESTING_Command *cmd,
      46             :   unsigned int index,
      47             :   const struct TALER_DenominationSignature **denom_sig)
      48             : {
      49          78 :   return cmd->traits (cmd->cls,
      50             :                       (const void **) denom_sig,
      51             :                       TALER_TESTING_TRAIT_DENOM_SIG,
      52             :                       index);
      53             : }
      54             : 
      55             : 
      56             : /**
      57             :  * Offer denom sig.
      58             :  *
      59             :  * @param index index number to associate to the signature on
      60             :  *        offer.
      61             :  * @param denom_sig the denom sig on offer.
      62             :  * @return the trait.
      63             :  */
      64             : struct TALER_TESTING_Trait
      65         763 : TALER_TESTING_make_trait_denom_sig
      66             :   (unsigned int index,
      67             :   const struct TALER_DenominationSignature *denom_sig)
      68             : {
      69         763 :   struct TALER_TESTING_Trait ret = {
      70             :     .index = index,
      71             :     .trait_name = TALER_TESTING_TRAIT_DENOM_SIG,
      72             :     .ptr = (const void *) denom_sig
      73             :   };
      74             : 
      75         763 :   return ret;
      76             : }
      77             : 
      78             : 
      79             : /* end of testing_api_trait_denom_sig.c */

Generated by: LCOV version 1.14