LCOV - code coverage report
Current view: top level - testing - testing_api_trait_fresh_coin.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 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             :  * @file testing/testing_api_trait_fresh_coin.c
      21             :  * @brief traits to offer fresh conins (after "melt" operations)
      22             :  * @author Marcello Stanisci
      23             :  */
      24             : #include "platform.h"
      25             : #include "taler_json_lib.h"
      26             : #include <gnunet/gnunet_curl_lib.h>
      27             : #include "taler_signatures.h"
      28             : #include "taler_testing_lib.h"
      29             : 
      30             : #define TALER_TESTING_TRAIT_FRESH_COINS "fresh-coins"
      31             : 
      32             : /**
      33             :  * Get a array of fresh coins.
      34             :  *
      35             :  * @param cmd command to extract the fresh coin from.
      36             :  * @param index which array to pick if @a cmd has multiple
      37             :  *        on offer.
      38             :  * @param[out] fresh_coins will point to the offered array.
      39             :  * @return #GNUNET_OK on success.
      40             :  */
      41             : int
      42           1 : TALER_TESTING_get_trait_fresh_coins
      43             :   (const struct TALER_TESTING_Command *cmd,
      44             :   unsigned int index,
      45             :   const struct TALER_TESTING_FreshCoinData **fresh_coins)
      46             : {
      47           1 :   return cmd->traits (cmd->cls,
      48             :                       (const void **) fresh_coins,
      49             :                       TALER_TESTING_TRAIT_FRESH_COINS,
      50             :                       index);
      51             : }
      52             : 
      53             : 
      54             : /**
      55             :  * Offer a _array_ of fresh coins.
      56             :  *
      57             :  * @param index which array of fresh coins to offer,
      58             :  *        if there are multiple on offer.  Typically passed as
      59             :  *        zero.
      60             :  * @param fresh_coins the array of fresh coins to offer
      61             :  * @return the trait,
      62             :  */
      63             : struct TALER_TESTING_Trait
      64          92 : TALER_TESTING_make_trait_fresh_coins
      65             :   (unsigned int index,
      66             :   const struct TALER_TESTING_FreshCoinData *fresh_coins)
      67             : {
      68          92 :   struct TALER_TESTING_Trait ret = {
      69             :     .index = index,
      70             :     .trait_name = TALER_TESTING_TRAIT_FRESH_COINS,
      71             :     .ptr = (const void *) fresh_coins
      72             :   };
      73          92 :   return ret;
      74             : }
      75             : 
      76             : 
      77             : /* end of testing_api_trait_fresh_coin.c */

Generated by: LCOV version 1.14