OpenDNSSEC-enforcer
1.3.4
|
00001 /* 00002 * $Id: test_routines.h 4639 2011-03-24 13:06:12Z rb $ 00003 * 00004 * Copyright (c) 2008-2009 Nominet UK. All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 1. Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * 2. Redistributions in binary form must reproduce the above copyright 00012 * notice, this list of conditions and the following disclaimer in the 00013 * documentation and/or other materials provided with the distribution. 00014 * 00015 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 00016 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00017 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00018 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 00019 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00020 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 00021 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00022 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 00023 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 00024 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 00025 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 * 00027 */ 00028 00029 #ifndef TEST_ROUTINES_H 00030 #define TEST_ROUTINES_H 00031 00032 /*+ 00033 * Filename: test.h 00034 * 00035 * Description: 00036 * Definitions of structures and routines for the CUnit-based module 00037 * tests. 00038 -*/ 00039 00040 #include <pthread.h> 00041 #include <unistd.h> 00042 00043 #include "ksm/system_includes.h" 00044 00045 #ifdef __cplusplus 00046 extern "C" { 00047 #endif 00048 00049 /* Structure due to define tests in a suite */ 00050 00051 struct test_testdef { 00052 const char* title; /* Test title - must be unique within a suite */ 00053 void (*function)(); /* Function executing the test */ 00054 }; 00055 00056 /* Structure for creating background threads */ 00057 00058 struct test_thread_data { 00059 const char** lines; /* Pointer to the data to be written */ 00060 unsigned int* lengths; /* Pointer to data lengths */ 00061 int fd; /* File descriptor */ 00062 int first_delay; /* First delay */ 00063 int subsequent_delay; /* Subsequent delay */ 00064 }; 00065 00066 /* Common test routines */ 00067 00068 void TestInitialize(int argc, char** argv); 00069 00070 /* Option access routines */ 00071 00072 int TestGetAutomatic(void); 00073 int TestGetBasic(void); 00074 int TestGetCurses(void); 00075 int TestGetConsole(void); 00076 int TestGetList(void); 00077 const char* TestGetFilename(void); 00078 00079 /* CUnuit test routines */ 00080 00081 void TcuInitialize(void); 00082 void TcuExecute(void); 00083 int TcuCreateSuite(const char* title, int (*init)(), int (*teardown)(), 00084 struct test_testdef* tests); 00085 00086 /* Database access */ 00087 00088 const char* TdbUsername(void); 00089 const char* TdbPassword(void); 00090 const char* TdbHost(void); 00091 const char* TdbPort(void); 00092 const char* TdbName(void); 00093 00094 int TdbSetup(void); 00095 int TdbTeardown(void); 00096 00097 #ifdef __cplusplus 00098 } 00099 #endif 00100 00101 #endif