24 #ifndef __UT_TESTMANAGER_H__
25 #define __UT_TESTMANAGER_H__
49 virtual
bool isInteractive() const = 0;
52 virtual
bool isPerformance() const = 0;
55 virtual
int numThreads() const = 0;
58 virtual
int run(
int argc,
char *argv[]) = 0;
62 virtual
void addTest(const
char *
name,
68 virtual
void logResult(const
char *name,
bool success,
114 UT_TestUnit(InitEnum init_enum, const
char *format, ...)
122 bool fail(const
char *format=NULL, ...)
123 SYS_PRINTF_CHECK_ATTRIBUTE(2, 3);
129 bool ok(const
char *format=NULL, ...)
130 SYS_PRINTF_CHECK_ATTRIBUTE(2, 3);
135 void restartTimer(const
char *format=NULL, ...)
136 SYS_PRINTF_CHECK_ATTRIBUTE(2, 3);
139 void setAlwaysPrint(
bool f) { myAlwaysPrint =
f; }
155 namespace ankerl::nanobench
240 bool saveAndCompareResults(
const UT_StringRef &file_name_root)
const;
244 using Bench = ankerl::nanobench::Bench;
250 #define TEST_LOGRESULT(NAME, SUCCESS, TIME) \
251 UT_TestManager::get().logResult(NAME, SUCCESS, TIME)
257 #define TEST_REGISTER_FN(name, method) \
258 class method##Registrar \
261 method##Registrar() \
263 UT_Functor<bool> callback(&method); \
264 UT_TestManager::get().addTest(name, callback); \
267 static method##Registrar the##method##Registrar;
274 #define TEST_REGISTER(name, classname, method) \
275 class classname##method##Registrar \
278 classname##method##Registrar() \
280 UT_Functor<bool> callback(&myTest, \
281 &classname::method); \
282 UT_TestManager::get().addTest(name, callback); \
287 static classname##method##Registrar \
288 the##classname##method##Registrar;
290 #define TEST_UNIT_MAIN() \
291 int theMain(int argc, char *argv[]) \
295 UT_Thread::resetNumProcessors(); \
296 return UT_TestManager::get().run(argc, argv); \
300 #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
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
#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.
std::function< T > UT_Function
GLboolean GLboolean GLboolean b
Wrapper around the nanobench object for unit performance tests.