netatalk  4.4.0dev
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
test.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2010 Frank Lahm <[email protected]>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13*/
14
15#ifndef TEST_H
16#define TEST_H
17
18#ifdef HAVE_CONFIG_H
19#include "config.h"
20#endif /* HAVE_CONFIG_H */
21
22#include <errno.h>
23#include <stdio.h>
24#include <stdlib.h>
25#include <string.h>
26
27#include <atalk/cnid.h>
28#include <atalk/directory.h>
29#include <atalk/globals.h>
30#include <atalk/logger.h>
31#include <atalk/queue.h>
32#include <atalk/util.h>
33#include <atalk/volume.h>
34
35#include "afp_config.h"
36#include "dircache.h"
37#include "directory.h"
38#include "hash.h"
39#include "subtests.h"
40#include "volume.h"
41
42static inline void alignok(int len)
43{
44 int i = 1;
45
46 if (len < 80) {
47 i = 80 - len;
48 }
49
50 while (i--) {
51 printf(" ");
52 }
53}
54
55#define TEST(a) \
56 printf("Testing: %s ... ", (#a) ); \
57 alignok(strlen(#a)); \
58 a; \
59 printf("[ok]\n");
60
61#define TEST_int(a, b) \
62 printf("Testing: %s ... ", (#a) ); \
63 alignok(strlen(#a)); \
64 if ((reti = (a)) != b) { \
65 printf("[error]\n"); \
66 exit(1); \
67 } else { printf("[ok]\n"); }
68
69#define TEST_expr(a, b) \
70 printf("Testing: %s ... ", (#a) ); \
71 alignok(strlen(#a)); \
72 a; \
73 if (b) { \
74 printf("[ok]\n"); \
75 } else { \
76 printf("[error]\n"); \
77 exit(1); \
78 }
79#endif /* TEST_H */
static void alignok(int len)
Definition test.h:42