1 /*! 2 * \file 3 * 4 * This file contains constants and prototypes required to compile an 5 * Auto Test library/plugin. This is used by the unixODBC-Test and 6 * unixODBC-GUI-Qt projects. 7 * 8 * \note 9 * 10 * The contents of this file must be consistent with MS version so as to 11 * maintain source code portability. This should allow (for example) 12 * Auto Tests to be compiled for all platforms without source changes. 13 * 14 */ 15 #ifndef AUTOTEST_H 16 #define AUTOTEST_H 17 18 /* standard C stuff... */ 19 #include <stdlib.h> 20 #include <string.h> 21 22 /* platform specific... */ 23 #ifdef _WINDOWS 24 #include <windows.h> 25 #endif 26 27 /* standard ODBC stuff... */ 28 #include <sql.h> 29 #include <sqlext.h> 30 #include <sqltypes.h> 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 #ifndef WIN32 37 #ifdef PATH_MAX 38 #define _MAX_PATH PATH_MAX 39 #else 40 #define _MAX_PATH 256 41 #endif 42 #endif 43 44 extern HINSTANCE hLoadedInst; 45 46 /*---------------------------------------------------------------------------------- 47 Defines and Macros 48 ----------------------------------------------------------------------------------*/ 49 50 #define TEST_ABORTED (-1) 51 52 #define AUTO_MAX_TEST_NAME 35 53 #define AUTO_MAX_TESTCASE_NAME 35 54 #define AUTO_MAX_TESTDESC_NAME 75 55 56 #define MAXFLUSH 300 57 #define MAX_USER_INFO 50 58 #define MAX_KEYWORD_LEN 149 59 60 /* */ 61 #ifdef WIN32 62 #define EXTFUNCDECL _stdcall 63 #define EXTFUN _stdcall 64 #define MY_EXPORT __declspec(dllexport) 65 #else 66 #define EXTFUNCDECL 67 #define EXTFUN 68 #define MY_EXPORT 69 #endif 70 71 #define InitTest(lps) \ 72 { lps->cErrors=0; } 73 #define AbortTest(lps) \ 74 { lps->cErrors=TEST_ABORTED; } 75 76 #define AllocateMemory(cb) (calloc(cb,1)) 77 #define ReleaseMemory(lp) (free(lp)) 78 79 #define NumItems(s) (sizeof(s) / sizeof(s[0])) 80 81 /* Following will access bit number pos in a bit array and return */ 82 /* TRUE if it is set, FALSE if it is not */ 83 #define CQBITS (sizeof(unsigned int) * 8) 84 #define getqbit(lpa, pos) \ 85 (lpa[((pos) / CQBITS)] & (1 << ((pos) - (CQBITS * ((pos) / CQBITS))))) 86 #define GETBIT(p1,p2) getqbit(p1,(p2)-1) 87 88 /* 89 * Message box defines 90 */ 91 92 #ifndef WIN32 93 #define MB_OK (0x0000) 94 #define MB_ABORTRETRYIGNORE (0x0001) 95 #define MB_OKCANCEL (0x0002) 96 #define MB_RETRYCANCEL (0x0003) 97 #define MB_YESNO (0x0004) 98 #define MB_YESNOCANCEL (0x0005) 99 100 #define MB_ICONEXCLAMATION (0x0000) 101 #define MB_ICONWARNING MB_ICONEXCLAMATION 102 #define MB_ICONINFORMATION (0x0010) 103 #define MB_ICONASTERISK MB_ICONINFORMATION 104 #define MB_ICONQUESTION (0x0020) 105 #define MB_ICONSTOP (0x0030) 106 #define MB_ICONERROR MB_ICONSTOP 107 #define MB_ICONHAND MB_ICONSTOP 108 109 #define MB_DEFBUTTON1 (0x0000) 110 #define MB_DEFBUTTON2 (0x0100) 111 #define MB_DEFBUTTON3 (0x0200) 112 #define MB_DEFBUTTON4 (0x0300) 113 114 #define MB_APPMODAL (0x0000) 115 #define MB_SYSTEMMODAL (0x1000) 116 #define MB_TASKMODAL (0x2000) 117 118 #define MB_DEFAULT_DESKTOP_ONLY (0x0000) 119 #define MB_HELP (0x0000) 120 #define MB_RIGHT (0x0000) 121 #define MB_RTLREADING (0x0000) 122 #define MB_SETFOREGROUND (0x0000) 123 #define MB_TOPMOST (0x0000) 124 #define MB_SERVICE_NOTIFICATION (0x0000) 125 #define MB_SERVICE_NOTIFICATION_NT3X (0x0000) 126 #endif 127 128 /*! 129 This structure contains the information found in the .INI file for a 130 data source. The filled out structure is in turn passed to AutoTestFunc 131 to drive the individual tests. 132 */ 133 typedef struct tagSERVERINFO { 134 HWND hwnd; /* Output edit window */ 135 CHAR szLogFile[_MAX_PATH]; /* Output log file */ 136 HENV henv; /* .EXE's henv */ 137 HDBC hdbc; /* .EXE's hdbc */ 138 HSTMT hstmt; /* .EXE's hstmt */ 139 140 /* The following items are gathered from the .INI file and may be defined */ 141 /* via the "Manage Test Sources" menu item from ODBC Test */ 142 CHAR szSource[SQL_MAX_DSN_LENGTH+1]; 143 CHAR szValidServer0[SQL_MAX_DSN_LENGTH+1]; 144 CHAR szValidLogin0[MAX_USER_INFO+1]; 145 CHAR szValidPassword0[MAX_USER_INFO+1]; 146 CHAR szKeywords[MAX_KEYWORD_LEN+1]; 147 148 /* Following are used for run-time */ 149 UINT FAR * rglMask; /* Run test mask */ 150 int failed; /* Track failures on a test case basis */ 151 int cErrors; /* Count of errors */ 152 BOOL fDebug; /* TRUE if debugging is to be enabled */ 153 BOOL fScreen; /* TRUE if test output goes to screen */ 154 BOOL fLog; /* TRUE if test output goes to log */ 155 BOOL fIsolate; /* TRUE to isolate output */ 156 UDWORD vCursorLib; /* Value for SQL_ODBC_CURSOR on SQLSetConnectOption */ 157 HINSTANCE hLoadedInst; /* Instance handle of loaded test */ 158 159 /* Following are used for buffering output to edit window */ 160 CHAR szBuff[MAXFLUSH]; /* Hold temporary results */ 161 UINT cBuff; /* Number of TCHARs in szBuff */ 162 } SERVERINFO; 163 typedef SERVERINFO FAR * lpSERVERINFO; 164 165 166 BOOL EXTFUNCDECL FAR szLogPrintf(lpSERVERINFO lps, BOOL fForce, LPTSTR szFmt, ...); 167 int EXTFUNCDECL FAR szMessageBox(HWND hwnd, UINT style, LPTSTR szTitle, LPTSTR szFmt, ...); 168 LPTSTR EXTFUN GetRCString(HINSTANCE hInst, LPTSTR buf, int cbbuf, UINT ids); 169 170 #ifdef __cplusplus 171 } 172 #endif 173 174 #endif 175 176 177