"Inital commit to Gerrit"
[profile/ivi/dhcp.git] / includes / t_api.h
1 /*
2  * Copyright (C) 2004-2007,2009  Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (C) 1999-2001  Internet Software Consortium.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15  * PERFORMANCE OF THIS SOFTWARE.
16  */
17
18 /* $Id: t_api.h,v 1.3.8.1 2009-11-20 01:49:01 sar Exp $ */
19
20 #ifndef TESTS_T_API_H
21 #define TESTS_T_API_H 1
22
23 /*! \file tests/t_api.h */
24
25 #include <stdio.h>
26
27 #include <omapip/result.h>
28 #include <isc/lang.h>
29 #include <isc/formatcheck.h>
30
31 /*
32  *
33  * Result codes.
34  *
35  */
36
37 #define T_PASS          0x1
38 #define T_FAIL          0x2
39 #define T_UNRESOLVED    0x3
40 #define T_UNSUPPORTED   0x4
41 #define T_UNTESTED      0x5
42 #define T_THREADONLY    0x6
43
44 /*
45  *
46  * Assertion class codes.
47  *
48  */
49
50 #define T_OPTIONAL      0x0
51 #define T_REQUIRED      0x1
52
53 /*
54  * Misc
55  */
56
57 #define T_MAXTOKS       16
58 #define T_ARG(n)        (*(av + (n)))
59
60 typedef void (*PFV)(void);
61
62 typedef struct {
63         PFV             pfv;
64         const char      *func_name;
65 } testspec_t;
66
67 extern  int     T_debug;
68 extern  testspec_t T_testlist[];
69
70 ISC_LANG_BEGINDECLS
71
72 void
73 t_assert(const char *component, int anum, int class, const char *what, ...)
74      ISC_FORMAT_PRINTF(4, 5);
75
76 void
77 t_info(const char *format, ...) ISC_FORMAT_PRINTF(1, 2);
78
79 void
80 t_result(int result);
81
82 char *
83 t_getenv(const char *name);
84
85 char *
86 t_fgetbs(FILE *fp);
87
88 isc_result_t
89 t_dns_result_fromtext(char *result);
90
91 unsigned int
92 t_dc_method_fromtext(char *dc_method);
93
94 int
95 t_bustline(char *line, char **toks);
96
97 int
98 t_eval(const char *filename, int (*func)(char **), int nargs);
99
100 ISC_LANG_ENDDECLS
101
102 #endif /* TESTS_T_API_H */
103