]>
Commit | Line | Data |
---|---|---|
b75a7d8f | 1 | /* |
374ca955 | 2 | ******************************************************************************** |
b75a7d8f | 3 | * |
374ca955 | 4 | * Copyright (C) 1996-2004, International Business Machines |
b75a7d8f A |
5 | * Corporation and others. All Rights Reserved. |
6 | * | |
374ca955 | 7 | ******************************************************************************** |
b75a7d8f A |
8 | */ |
9 | ||
b75a7d8f A |
10 | #ifndef CTEST_H |
11 | #define CTEST_H | |
12 | ||
374ca955 A |
13 | #include "unicode/testtype.h" |
14 | #include "unicode/utrace.h" | |
b75a7d8f A |
15 | |
16 | ||
17 | /* prototypes *********************************/ | |
18 | ||
374ca955 A |
19 | U_CDECL_BEGIN |
20 | typedef void (U_CALLCONV *TestFunctionPtr)(void); | |
b75a7d8f | 21 | typedef struct TestNode TestNode; |
374ca955 | 22 | U_CDECL_END |
b75a7d8f A |
23 | |
24 | /** | |
25 | * Set this to zero to disable log_verbose() messages. | |
26 | * Otherwise nonzero to see log_verbose() messages. | |
27 | * | |
28 | * @internal Internal APIs for testing purpose only | |
29 | */ | |
374ca955 | 30 | extern T_CTEST_EXPORT_API int REPEAT_TESTS; |
b75a7d8f A |
31 | |
32 | /** | |
33 | * Set this to zero to disable log_verbose() messages. | |
34 | * Otherwise nonzero to see log_verbose() messages. | |
35 | * | |
36 | * @internal Internal APIs for testing purpose only | |
37 | */ | |
374ca955 | 38 | extern T_CTEST_EXPORT_API int VERBOSITY; |
b75a7d8f A |
39 | |
40 | /** | |
41 | * Set this to zero to disable log_verbose() messages. | |
42 | * Otherwise nonzero to see log_verbose() messages. | |
43 | * | |
44 | * @internal Internal APIs for testing purpose only | |
45 | */ | |
374ca955 | 46 | extern T_CTEST_EXPORT_API int ERR_MSG; |
b75a7d8f A |
47 | |
48 | /** | |
49 | * Set this to zero to disable some of the slower tests. | |
50 | * Otherwise nonzero to run the slower tests. | |
51 | * | |
52 | * @internal Internal APIs for testing purpose only | |
53 | */ | |
374ca955 | 54 | extern T_CTEST_EXPORT_API int QUICK; |
b75a7d8f A |
55 | |
56 | /** | |
57 | * Set this to nonzero to warn (not error) on missing data. | |
58 | * Otherwise, zero will cause an error to be propagated when data is not available. | |
59 | * Affects the behavior of log_dataerr. | |
60 | * | |
61 | * @see log_data_err | |
62 | * @internal Internal APIs for testing purpose only | |
63 | */ | |
374ca955 A |
64 | extern T_CTEST_EXPORT_API int WARN_ON_MISSING_DATA; |
65 | ||
66 | /** | |
67 | * ICU tracing level, is set by command line option | |
68 | * | |
69 | * @internal | |
70 | */ | |
71 | extern T_CTEST_EXPORT_API UTraceLevel ICU_TRACE; | |
b75a7d8f A |
72 | |
73 | /** | |
74 | * Show the names of all nodes. | |
75 | * | |
76 | * @param root Subtree of tests. | |
77 | * @internal Internal APIs for testing purpose only | |
78 | */ | |
374ca955 A |
79 | T_CTEST_API void T_CTEST_EXPORT2 |
80 | showTests ( const TestNode *root); | |
b75a7d8f A |
81 | |
82 | /** | |
83 | * Run a subtree of tests. | |
84 | * | |
85 | * @param root Subtree of tests. | |
86 | * @internal Internal APIs for testing purpose only | |
87 | */ | |
374ca955 A |
88 | T_CTEST_API void T_CTEST_EXPORT2 |
89 | runTests ( const TestNode* root); | |
b75a7d8f A |
90 | |
91 | /** | |
92 | * Add a test to the subtree. | |
93 | * Example usage: | |
94 | * <PRE> | |
95 | * TestNode* root=NULL; | |
96 | * addTest(&root, &mytest, "/a/b/mytest" ); | |
97 | * </PRE> | |
98 | * @param root Pointer to the root pointer. | |
99 | * @param test Pointer to 'void function(void)' for actual test. | |
100 | * @param path Path from root under which test will be placed. Ex. '/a/b/mytest' | |
101 | * @internal Internal APIs for testing purpose only | |
102 | */ | |
374ca955 A |
103 | T_CTEST_API void T_CTEST_EXPORT2 |
104 | addTest(TestNode** root, | |
105 | TestFunctionPtr test, | |
106 | const char *path); | |
b75a7d8f | 107 | |
374ca955 A |
108 | /** |
109 | * Clean up any allocated memory. | |
110 | * Conditions for calling this function are the same as u_cleanup(). | |
111 | * @see u_cleanup | |
112 | * @internal Internal APIs for testing purpose only | |
113 | */ | |
114 | T_CTEST_API void T_CTEST_EXPORT2 | |
115 | cleanUpTestTree(TestNode *tn); | |
b75a7d8f A |
116 | |
117 | /** | |
118 | * Retreive a specific subtest. (subtree). | |
119 | * | |
120 | * @param root Pointer to the root. | |
121 | * @param path Path relative to the root, Ex. '/a/b' | |
122 | * @return The subtest, or NULL on failure. | |
123 | * @internal Internal APIs for testing purpose only | |
124 | */ | |
374ca955 A |
125 | T_CTEST_API const TestNode* T_CTEST_EXPORT2 |
126 | getTest(const TestNode* root, | |
127 | const char *path); | |
b75a7d8f A |
128 | |
129 | ||
130 | /** | |
131 | * Log an error message. (printf style) | |
132 | * @param pattern printf-style format string | |
133 | * @internal Internal APIs for testing purpose only | |
134 | */ | |
374ca955 A |
135 | T_CTEST_API void T_CTEST_EXPORT2 |
136 | log_err(const char* pattern, ...); | |
b75a7d8f A |
137 | |
138 | /** | |
139 | * Log an informational message. (printf style) | |
140 | * @param pattern printf-style format string | |
141 | * @internal Internal APIs for testing purpose only | |
142 | */ | |
374ca955 A |
143 | T_CTEST_API void T_CTEST_EXPORT2 |
144 | log_info(const char* pattern, ...); | |
145 | ||
146 | /** | |
147 | * Log an informational message. (vprintf style) | |
148 | * @param prefix a string that is output before the pattern and without formatting | |
149 | * @param pattern printf-style format string | |
150 | * @param ap variable-arguments list | |
151 | * @internal Internal APIs for testing purpose only | |
152 | */ | |
153 | T_CTEST_API void T_CTEST_EXPORT2 | |
154 | vlog_info(const char *prefix, const char *pattern, va_list ap); | |
b75a7d8f A |
155 | |
156 | /** | |
157 | * Log a verbose informational message. (printf style) | |
158 | * This message will only appear if the global VERBOSITY is nonzero | |
159 | * @param pattern printf-style format string | |
160 | * @internal Internal APIs for testing purpose only | |
161 | */ | |
374ca955 A |
162 | T_CTEST_API void T_CTEST_EXPORT2 |
163 | log_verbose(const char* pattern, ...); | |
b75a7d8f A |
164 | |
165 | /** | |
166 | * Log an error message concerning missing data. (printf style) | |
167 | * If WARN_ON_MISSING_DATA is nonzero, this will case a log_info (warning) to be | |
168 | * printed, but if it is zero this will produce an error (log_err). | |
169 | * @param pattern printf-style format string | |
170 | * @internal Internal APIs for testing purpose only | |
171 | */ | |
374ca955 A |
172 | T_CTEST_API void T_CTEST_EXPORT2 |
173 | log_data_err(const char *pattern, ...); | |
b75a7d8f A |
174 | |
175 | /** | |
176 | * Processes the command line arguments. | |
177 | * This is a sample implementation | |
178 | * <PRE>Usage: %s [ -l ] [ -v ] [ -? ] [ /path/to/test ] | |
179 | * -l List only, do not run\ | |
180 | * -v turn OFF verbosity | |
181 | * -? print this message</PRE> | |
182 | * @param root Testnode root with tests already attached to it | |
183 | * @param argv argument list from main (stdio.h) | |
184 | * @param argc argument list count from main (stdio.h) | |
185 | * @return positive for error count, 0 for success, negative for illegal argument | |
186 | * @internal Internal APIs for testing purpose only | |
187 | */ | |
374ca955 A |
188 | T_CTEST_API int T_CTEST_EXPORT2 |
189 | processArgs(const TestNode* root, | |
190 | int argc, | |
191 | const char* const argv[]); | |
b75a7d8f A |
192 | |
193 | ||
374ca955 A |
194 | T_CTEST_API const char* T_CTEST_EXPORT2 |
195 | getTestName(void); | |
b75a7d8f A |
196 | |
197 | ||
198 | ||
199 | #endif |