LCOV - code coverage report
Current view: top level - testing - testing_api_trait_denom_pub.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 it
       6             :   under the terms of the GNU General Public License as published
       7             :   by the Free Software Foundation; either version 3, or (at your
       8             :   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 testing/testing_api_trait_denom_pub.c
      21             :  * @brief denom pub traits.
      22             :  * @author Christian Grothoff
      23             :  * @author Marcello Stanisci
      24             :  */
      25             : #include "platform.h"
      26             : #include "taler_json_lib.h"
      27             : #include <gnunet/gnunet_curl_lib.h>
      28             : #include "taler_signatures.h"
      29             : #include "taler_testing_lib.h"
      30             : 
      31             : #define TALER_TESTING_TRAIT_DENOM_PUB "denomination-public-key"
      32             : 
      33             : 
      34             : /**
      35             :  * Obtain a denomination public key from a @a cmd.
      36             :  *
      37             :  * @param cmd command to extract trait from
      38             :  * @param index index number of the denom to obtain.
      39             :  * @param[out] denom_pub set to the offered denom pub.
      40             :  * @return #GNUNET_OK on success.
      41             :  */
      42             : int
      43         105 : TALER_TESTING_get_trait_denom_pub (const struct TALER_TESTING_Command *cmd,
      44             :                                    unsigned int index,
      45             :                                    const struct
      46             :                                    TALER_EXCHANGE_DenomPublicKey **denom_pub)
      47             : {
      48         105 :   return cmd->traits (cmd->cls,
      49             :                       (const void **) denom_pub,
      50             :                       TALER_TESTING_TRAIT_DENOM_PUB,
      51             :                       index);
      52             : }
      53             : 
      54             : 
      55             : /**
      56             :  * Make a trait for a denomination public key.
      57             :  *
      58             :  * @param index index number to associate to the offered denom pub.
      59             :  * @param denom_pub denom pub to offer with this trait.
      60             :  * @return the trait.
      61             :  */
      62             : struct TALER_TESTING_Trait
      63         874 : TALER_TESTING_make_trait_denom_pub (unsigned int index,
      64             :                                     const struct
      65             :                                     TALER_EXCHANGE_DenomPublicKey *denom_pub)
      66             : {
      67         874 :   struct TALER_TESTING_Trait ret = {
      68             :     .index = index,
      69             :     .trait_name = TALER_TESTING_TRAIT_DENOM_PUB,
      70             :     .ptr = (const void *) denom_pub
      71             :   };
      72             : 
      73         874 :   return ret;
      74             : }
      75             : 
      76             : 
      77             : /* end of testing_api_trait_denom_pub.c */

Generated by: LCOV version 1.14