Avoid catch-22 with README.main not being distributed but having the
[gnupg.git] / jnlib / t-support.h
blob52701741b634d7b7f1cf45741d7b59e4593157d5
1 /* t-support.h - Helper for the regression tests
2 * Copyright (C) 2007 Free Software Foundation, Inc.
4 * This file is part of JNLIB.
6 * JNLIB is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 3 of
9 * the License, or (at your option) any later version.
11 * JNLIB is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #ifndef LIBJNLIB_T_SUPPORT_H
21 #define LIBJNLIB_T_SUPPORT_H 1
23 #ifdef GCRYPT_VERSION
24 #error The regression tests should not include with gcrypt.h
25 #endif
27 /* Repalcement prototypes. */
28 void *gcry_xmalloc (size_t n);
29 void *gcry_xcalloc (size_t n, size_t m);
30 void *gcry_xrealloc (void *a, size_t n);
31 char *gcry_xstrdup (const char * a);
32 void gcry_free (void *a);
34 /* Map the used xmalloc functions to those implemented by t-support.c */
35 #define xmalloc(a) gcry_xmalloc ( (a) )
36 #define xcalloc(a,b) gcry_xcalloc ( (a), (b) )
37 #define xrealloc(a,n) gcry_xrealloc ( (a), (n) )
38 #define xstrdup(a) gcry_xstrdup ( (a) )
39 #define xfree(a) gcry_free ( (a) )
42 /* Macros to print the result of a test. */
43 #define pass() do { ; } while(0)
44 #define fail(a) do { fprintf (stderr, "%s:%d: test %d failed\n",\
45 __FILE__,__LINE__, (a)); \
46 exit (1); \
47 } while(0)
50 #endif /*LIBJNLIB_T_SUPPORT_H*/