24 #ifndef __UT_TESTMANAGER_H__
25 #define __UT_TESTMANAGER_H__
48 virtual
bool isInteractive() const = 0;
51 virtual
bool isPerformance() const = 0;
54 virtual
int numThreads() const = 0;
57 virtual
int run(
int argc,
char *argv[]) = 0;
61 virtual
void addTest(const
char *
name,
67 virtual
void logResult(const
char *name,
bool success,
113 UT_TestUnit(InitEnum init_enum, const
char *format, ...)
121 bool fail(const
char *format=NULL, ...)
122 SYS_PRINTF_CHECK_ATTRIBUTE(2, 3);
128 bool ok(const
char *format=NULL, ...)
129 SYS_PRINTF_CHECK_ATTRIBUTE(2, 3);
134 void restartTimer(const
char *format=NULL, ...)
135 SYS_PRINTF_CHECK_ATTRIBUTE(2, 3);
138 void setAlwaysPrint(
bool f) { myAlwaysPrint =
f; }
153 #define TEST_LOGRESULT(NAME, SUCCESS, TIME) \
154 UT_TestManager::get().logResult(NAME, SUCCESS, TIME)
160 #define TEST_REGISTER_FN(name, method) \
161 class method##Registrar \
164 method##Registrar() \
166 UT_Functor<bool> callback(&method); \
167 UT_TestManager::get().addTest(name, callback); \
170 static method##Registrar the##method##Registrar;
177 #define TEST_REGISTER(name, classname, method) \
178 class classname##method##Registrar \
181 classname##method##Registrar() \
183 UT_Functor<bool> callback(&myTest, \
184 &classname::method); \
185 UT_TestManager::get().addTest(name, callback); \
190 static classname##method##Registrar \
191 the##classname##method##Registrar;
193 #define TEST_UNIT_MAIN() \
194 int theMain(int argc, char *argv[]) \
198 UT_Thread::resetNumProcessors(); \
199 return UT_TestManager::get().run(argc, argv); \
203 #endif // __UT_TESTMANAGER_H__
Status maintainer used to run a test.
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
#define SYS_PRINTF_CHECK_ATTRIBUTE(string_index, first_to_check)
GLint GLint GLsizei GLint GLenum format
virtual ~UT_TestManager()
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
auto get(const UT_ARTIterator< T > &it) -> decltype(it.key())
GLuint const GLchar * name
bool status() const
Query the status of the test.
GLboolean GLboolean GLboolean b