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

          Line data    Source code
       1             : /*
       2             :   This file is part of TALER
       3             :   Copyright (C) 2020 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 testing/testing_api_trait_uuid.c
      21             :  * @brief offer any trait that is passed over as a uuid.
      22             :  * @author Jonathan Buchanan
      23             :  */
      24             : #include "platform.h"
      25             : #include "taler_signatures.h"
      26             : #include "taler_exchange_service.h"
      27             : #include "taler_testing_lib.h"
      28             : 
      29             : 
      30             : #define TALER_TESTING_TRAIT_UUID "uuid"
      31             : #define TALER_TESTING_TRAIT_CLAIM_TOKEN "claim_token"
      32             : 
      33             : 
      34             : /**
      35             :  * Obtain a uuid from @a cmd.
      36             :  *
      37             :  * @param cmd command to extract the uuid from.
      38             :  * @param index which amount to pick if @a cmd has multiple
      39             :  *        on offer
      40             :  * @param[out] uuid where to write the uuid.
      41             :  * @return #GNUNET_OK on success.
      42             :  */
      43             : int
      44           0 : TALER_TESTING_get_trait_uuid (const struct TALER_TESTING_Command *cmd,
      45             :                               unsigned int index,
      46             :                               struct GNUNET_Uuid **uuid)
      47             : {
      48           0 :   return cmd->traits (cmd->cls,
      49             :                       (const void **) uuid,
      50             :                       TALER_TESTING_TRAIT_UUID,
      51             :                       index);
      52             : }
      53             : 
      54             : 
      55             : /**
      56             :  * Offer a uuid in a trait.
      57             :  *
      58             :  * @param index which uuid to offer, in case there are
      59             :  *        multiple available.
      60             :  * @param uuid the uuid to offer.
      61             :  *
      62             :  * @return the trait.
      63             :  */
      64             : struct TALER_TESTING_Trait
      65           0 : TALER_TESTING_make_trait_uuid (unsigned int index,
      66             :                                const struct GNUNET_Uuid *uuid)
      67             : {
      68           0 :   struct TALER_TESTING_Trait ret = {
      69             :     .index = index,
      70             :     .trait_name = TALER_TESTING_TRAIT_UUID,
      71             :     .ptr = (const void *) uuid
      72             :   };
      73           0 :   return ret;
      74             : }
      75             : 
      76             : 
      77             : /**
      78             :  * Obtain a claim token from @a cmd.
      79             :  *
      80             :  * @param cmd command to extract the token from.
      81             :  * @param index which amount to pick if @a cmd has multiple
      82             :  *        on offer
      83             :  * @param[out] ct where to write the token.
      84             :  * @return #GNUNET_OK on success.
      85             :  */
      86             : int
      87           0 : TALER_TESTING_get_trait_claim_token (const struct TALER_TESTING_Command *cmd,
      88             :                                      unsigned int index,
      89             :                                      const struct TALER_ClaimTokenP **ct)
      90             : {
      91           0 :   return cmd->traits (cmd->cls,
      92             :                       (const void **) ct,
      93             :                       TALER_TESTING_TRAIT_CLAIM_TOKEN,
      94             :                       index);
      95             : }
      96             : 
      97             : 
      98             : /**
      99             :  * Offer a claim token in a trait.
     100             :  *
     101             :  * @param index which token to offer, in case there are
     102             :  *        multiple available.
     103             :  * @param ct the token to offer.
     104             :  *
     105             :  * @return the trait.
     106             :  */
     107             : struct TALER_TESTING_Trait
     108           0 : TALER_TESTING_make_trait_claim_token (unsigned int index,
     109             :                                       const struct TALER_ClaimTokenP *ct)
     110             : {
     111           0 :   struct TALER_TESTING_Trait ret = {
     112             :     .index = index,
     113             :     .trait_name = TALER_TESTING_TRAIT_CLAIM_TOKEN,
     114             :     .ptr = (const void *) ct
     115             :   };
     116           0 :   return ret;
     117             : }

Generated by: LCOV version 1.14