LCOV - code coverage report
Current view: top level - testing - testing_api_trait_coin_priv.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 by
       7             :   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 GNU
      13             :   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_coin_priv.c
      22             :  * @brief coin priv 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_COIN_PRIVATE_KEY "coin-private-key"
      33             : 
      34             : 
      35             : /**
      36             :  * Obtain a coin private key from a @a cmd.
      37             :  *
      38             :  * @param cmd command to extract trait from.
      39             :  * @param index index of the coin priv to obtain.
      40             :  * @param[out] coin_priv set to the private key of the coin.
      41             :  * @return #GNUNET_OK on success.
      42             :  */
      43             : int
      44         264 : TALER_TESTING_get_trait_coin_priv
      45             :   (const struct TALER_TESTING_Command *cmd,
      46             :   unsigned int index,
      47             :   const struct TALER_CoinSpendPrivateKeyP **coin_priv)
      48             : {
      49         264 :   return cmd->traits (cmd->cls,
      50             :                       (const void **) coin_priv,
      51             :                       TALER_TESTING_TRAIT_COIN_PRIVATE_KEY,
      52             :                       index);
      53             : }
      54             : 
      55             : 
      56             : /**
      57             :  * Offer coin private key.
      58             :  *
      59             :  * @param index index number to associate with offered coin priv.
      60             :  * @param coin_priv coin private key to offer.
      61             :  * @return the trait.
      62             :  */
      63             : struct TALER_TESTING_Trait
      64        1034 : TALER_TESTING_make_trait_coin_priv
      65             :   (unsigned int index,
      66             :   const struct TALER_CoinSpendPrivateKeyP *coin_priv)
      67             : {
      68        1034 :   struct TALER_TESTING_Trait ret = {
      69             :     .index = index,
      70             :     .trait_name = TALER_TESTING_TRAIT_COIN_PRIVATE_KEY,
      71             :     .ptr = (const void *) coin_priv
      72             :   };
      73             : 
      74        1034 :   return ret;
      75             : }
      76             : 
      77             : 
      78             : /* end of testing_api_trait_coin_priv.c */

Generated by: LCOV version 1.14