LCOV - code coverage report
Current view: top level - testing - testing_api_cmd_bank_check_empty.c (source / functions) Hit Total Coverage
Test: GNU Taler exchange coverage report Lines: 0 13 0.0 %
Date: 2022-08-25 06:15:09 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) 2018-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_cmd_bank_check_empty.c
      21             :  * @brief command to check if a particular wire transfer took
      22             :  *        place.
      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_testing_lib.h"
      29             : #include "taler_fakebank_lib.h"
      30             : 
      31             : 
      32             : /**
      33             :  * Cleanup the state, only defined to respect the API.
      34             :  *
      35             :  * @param cls closure.
      36             :  * @param cmd the command which is being cleaned up.
      37             :  */
      38             : static void
      39           0 : check_bank_empty_cleanup
      40             :   (void *cls,
      41             :   const struct TALER_TESTING_Command *cmd)
      42             : {
      43             :   (void) cls;
      44             :   (void) cmd;
      45           0 :   return;
      46             : }
      47             : 
      48             : 
      49             : /**
      50             :  * Run the command.
      51             :  *
      52             :  * @param cls closure.
      53             :  * @param cmd the command to execute.
      54             :  * @param is the interpreter state.
      55             :  */
      56             : static void
      57           0 : check_bank_empty_run (void *cls,
      58             :                       const struct TALER_TESTING_Command *cmd,
      59             :                       struct TALER_TESTING_Interpreter *is)
      60             : {
      61             :   (void) cls;
      62             :   (void) cmd;
      63           0 :   if (GNUNET_OK != TALER_FAKEBANK_check_empty (is->fakebank))
      64             :   {
      65           0 :     GNUNET_break (0);
      66           0 :     TALER_TESTING_interpreter_fail (is);
      67           0 :     return;
      68             :   }
      69           0 :   TALER_TESTING_interpreter_next (is);
      70             : }
      71             : 
      72             : 
      73             : /**
      74             :  * Some commands (notably "bank history") could randomly
      75             :  * look for traits; this way makes sure we don't segfault.
      76             :  */
      77             : static int
      78           0 : check_bank_empty_traits (void *cls,
      79             :                          const void **ret,
      80             :                          const char *trait,
      81             :                          unsigned int index)
      82             : {
      83             :   (void) cls;
      84             :   (void) ret;
      85             :   (void) trait;
      86             :   (void) index;
      87           0 :   return GNUNET_SYSERR;
      88             : }
      89             : 
      90             : 
      91             : /**
      92             :  * Checks whether all the wire transfers got "checked"
      93             :  * by the "bank check" CMD.
      94             :  *
      95             :  * @param label command label.
      96             :  *
      97             :  * @return the command
      98             :  */
      99             : struct TALER_TESTING_Command
     100           0 : TALER_TESTING_cmd_check_bank_empty (const char *label)
     101             : {
     102           0 :   struct TALER_TESTING_Command cmd = {
     103             :     .label = label,
     104             :     .run = &check_bank_empty_run,
     105             :     .cleanup = &check_bank_empty_cleanup,
     106             :     .traits = &check_bank_empty_traits
     107             :   };
     108             : 
     109           0 :   return cmd;
     110             : }

Generated by: LCOV version 1.14