OpenDNSSEC-enforcer  1.4.7
test_routines.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2009 Nominet UK. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
17  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
19  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
21  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
23  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  */
26 
27 #ifndef TEST_ROUTINES_H
28 #define TEST_ROUTINES_H
29 
30 /*+
31  * Filename: test.h
32  *
33  * Description:
34  * Definitions of structures and routines for the CUnit-based module
35  * tests.
36 -*/
37 
38 #include <pthread.h>
39 #include <unistd.h>
40 
41 #include "ksm/system_includes.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /* Structure due to define tests in a suite */
48 
49 struct test_testdef {
50  const char* title; /* Test title - must be unique within a suite */
51  void (*function)(); /* Function executing the test */
52 };
53 
54 /* Structure for creating background threads */
55 
57  const char** lines; /* Pointer to the data to be written */
58  unsigned int* lengths; /* Pointer to data lengths */
59  int fd; /* File descriptor */
60  int first_delay; /* First delay */
61  int subsequent_delay; /* Subsequent delay */
62 };
63 
64 /* Common test routines */
65 
66 void TestInitialize(int argc, char** argv);
67 
68 /* Option access routines */
69 
70 int TestGetAutomatic(void);
71 int TestGetBasic(void);
72 int TestGetCurses(void);
73 int TestGetConsole(void);
74 int TestGetList(void);
75 const char* TestGetFilename(void);
76 
77 /* CUnuit test routines */
78 
79 void TcuInitialize(void);
80 void TcuExecute(void);
81 int TcuCreateSuite(const char* title, int (*init)(), int (*teardown)(),
82  struct test_testdef* tests);
83 
84 /* Database access */
85 
86 const char* TdbUsername(void);
87 const char* TdbPassword(void);
88 const char* TdbHost(void);
89 const char* TdbPort(void);
90 const char* TdbName(void);
91 
92 int TdbSetup(void);
93 int TdbTeardown(void);
94 
95 #ifdef __cplusplus
96 }
97 #endif
98 
99 #endif
int TestGetBasic(void)
const char * TdbPort(void)
int TcuCreateSuite(const char *title, int(*init)(), int(*teardown)(), struct test_testdef *tests)
unsigned int * lengths
Definition: test_routines.h:58
const char * TestGetFilename(void)
const char * TdbUsername(void)
const char * TdbName(void)
void TcuExecute(void)
int TestGetList(void)
int TestGetCurses(void)
int TdbTeardown(void)
void TestInitialize(int argc, char **argv)
int TdbSetup(void)
int TestGetConsole(void)
int TestGetAutomatic(void)
const char ** lines
Definition: test_routines.h:57
const char * TdbPassword(void)
const char * TdbHost(void)
const char * title
Definition: test_routines.h:50
void TcuInitialize(void)