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