LCOV - code coverage report
Current view: top level - testing - testing_api_trait_contract.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-2020 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_contract.c
      21             :  * @brief offers contract term trait.
      22             :  * @author Marcello Stanisci
      23             :  * @author Christian Grothoff
      24             :  */
      25             : #include "platform.h"
      26             : #include "taler_json_lib.h"
      27             : #include <gnunet/gnunet_curl_lib.h>
      28             : #include "taler_testing_lib.h"
      29             : 
      30             : 
      31             : /**
      32             :  * Contains a contract terms object as a json_t.
      33             :  */
      34             : #define TALER_TESTING_TRAIT_CONTRACT_TERMS "contract-terms"
      35             : 
      36             : 
      37             : /**
      38             :  * Obtain contract terms from @a cmd.
      39             :  *
      40             :  * @param cmd command to extract the contract terms from.
      41             :  * @param index contract terms index number.
      42             :  * @param[out] contract_terms where to write the contract terms.
      43             :  * @return #GNUNET_OK on success.
      44             :  */
      45             : int
      46          15 : TALER_TESTING_get_trait_contract_terms (const struct TALER_TESTING_Command *cmd,
      47             :                                         unsigned int index,
      48             :                                         const json_t **contract_terms)
      49             : {
      50          15 :   return cmd->traits (cmd->cls,
      51             :                       (const void **) contract_terms,
      52             :                       TALER_TESTING_TRAIT_CONTRACT_TERMS,
      53             :                       index);
      54             : }
      55             : 
      56             : 
      57             : /**
      58             :  * Offer contract terms.
      59             :  *
      60             :  * @param index contract terms index number.
      61             :  * @param contract_terms contract terms to offer.
      62             :  * @return the trait.
      63             :  */
      64             : struct TALER_TESTING_Trait
      65         160 : TALER_TESTING_make_trait_contract_terms (unsigned int index,
      66             :                                          const json_t *contract_terms)
      67             : {
      68         160 :   struct TALER_TESTING_Trait ret = {
      69             :     .index = index,
      70             :     .trait_name = TALER_TESTING_TRAIT_CONTRACT_TERMS,
      71             :     .ptr = (const void *) contract_terms
      72             :   };
      73         160 :   return ret;
      74             : }

Generated by: LCOV version 1.14