Main Page | Modules | Data Structures | Directories | File List | Data Fields

test.h

00001 #ifndef _LIBU_TEST_H_
00002 #define _LIBU_TEST_H_
00003 #include <u/libu.h>
00004 
00087 #define U_TEST_MODULE( name ) \
00088     int u_test_run_ ## name (void)
00089 
00098 #define U_TEST_RUN( f ) \
00099     if( f () ) { _test_cnt++; _test_fail++; con("%s: failed", #f); } \
00100     else { _test_cnt++; _test_ok++; if(_verbose) con("%s: ok", #f); }
00101 
00102 
00110 #define U_TEST_MODULE_USE( name ) \
00111     do {    \
00112         int u_test_run_ ## name (void); \
00113         *_top = u_test_run_ ## name; ++_top; *_top = NULL; \
00114         *_top_nm = u_strdup( #name ); ++_top_nm; *_top_nm = NULL; \
00115     } while(0)
00116 
00127 int u_test_run(int argc, char **argv);
00128 
00130 typedef int (*test_runner_t)(void);
00132 extern test_runner_t _mods[], *_top;
00134 extern char *_mods_nm[], **_top_nm;
00136 extern int _test_cnt, _test_ok, _test_fail;
00138 extern int _verbose;
00139 
00144 #endif

←Products
© 2005-2007 - KoanLogic S.r.l. - All rights reserved