]> arthur.barton.de Git - netatalk.git/blob - test/afpd/test.h
Merge
[netatalk.git] / test / afpd / test.h
1 /*
2   $Id: test.h,v 1.1.2.1 2010-02-01 10:56:08 franklahm Exp $
3   Copyright (c) 2010 Frank Lahm <franklahm@gmail.com>
4
5   This program is free software; you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation; either version 2 of the License, or
8   (at your option) any later version.
9
10   This program is distributed in the hope that it will be useful,
11   but 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
16 #ifndef TEST_H
17 #define TEST_H
18
19 #ifdef HAVE_CONFIG_H
20 #include "config.h"
21 #endif /* HAVE_CONFIG_H */
22
23 #include <string.h>
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <errno.h>
27
28 #include <atalk/util.h>
29 #include <atalk/cnid.h>
30 #include <atalk/logger.h>
31 #include <atalk/volume.h>
32 #include <atalk/directory.h>
33 #include <atalk/queue.h>
34 #include <atalk/bstrlib.h>
35
36 #include "directory.h"
37 #include "dircache.h"
38 #include "hash.h"
39 #include "globals.h"
40 #include "afp_config.h"
41 #include "volume.h"
42 #include "subtests.h"
43
44 static inline void alignok(int len)
45 {
46     int i = 1;
47     if (len < 80)
48         i = 80 - len;
49     while (i--)
50         printf(" ");
51 }
52
53 #define TEST(a) \
54     printf("Testing: %s ... ", (#a) ); \
55     alignok(strlen(#a));               \
56     a;                                 \
57     printf("[ok]\n");
58
59 #define TEST_int(a, b) \
60     printf("Testing: %s ... ", (#a) );            \
61     alignok(strlen(#a));                          \
62     if ((reti = (a)) != b) {                      \
63         printf("[error]\n");                      \
64         exit(1);                                  \
65     } else { printf("[ok]\n"); }
66
67 #define TEST_expr(a, b)                              \
68     printf("Testing: %s ... ", (#a) );               \
69     alignok(strlen(#a));                             \
70     a;                                               \
71     if (b) {                                         \
72         printf("[ok]\n");                            \
73     } else {                                         \
74         printf("[error]\n");                         \
75         exit(1);                                     \
76     }
77 #endif  /* TEST_H */