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