Defines | Typedefs | Functions
core/testlib/testlib_register.h File Reference

Macros for registering the tests with the driver. More...

#include <vcl_string.h>

Go to the source code of this file.

Defines

#define DECLARE(testname)   int testname ## _main ( int argc, char* argv[] )
 Declare the existence of the test.
#define REGISTER(testname)   testlib_register_test(#testname, & testname ## _main );
 Register the test with the driver.
#define DEFINE_MAIN
 Define the main() routine for this test driver.

Typedefs

typedef int(* TestMainFunction )(int, char *[])

Functions

void testlib_register_test (const vcl_string &, TestMainFunction)

Detailed Description

Macros for registering the tests with the driver.

Author:
Amitha Perera A test driver program would simply look like
   #include <testlib/testlib_register.h>
   DECLARE( some_test_name );
   void register_tests()
   {
     REGISTER( some_test_name );
   }
   DEFINE_MAIN;
The DEFINE_MAIN macro will define the main() function for the driver. You will also have to link in a file defining a function
   int some_test_name_main(int,char*[])
See the vxl tests for further examples (such as vil/tests).

Definition in file testlib_register.h.


Define Documentation

#define DECLARE (   testname)    int testname ## _main ( int argc, char* argv[] )

Declare the existence of the test.

If you DECLARE( x ), then you will need to define a function int x_main(int,char*[]).

Definition at line 39 of file testlib_register.h.

#define DEFINE_MAIN
Value:
int testlib_main(int,char*[]); \
   void testlib_cleanup(); \
   int main( int argc, char* argv[] ) { \
     register_tests(); \
     int retval = testlib_main( argc, argv ); \
     testlib_cleanup(); \
     return retval; \
   }

Define the main() routine for this test driver.

This allows the main function to be defined in the driver code itself--instead of in the testlib library--thus avoiding "awf-weirdness". This also means that functionality from the test library, such as testlib_root_dir, can be used even if it is not used to create a test driver.

Definition at line 55 of file testlib_register.h.

#define REGISTER (   testname)    testlib_register_test(#testname, & testname ## _main );

Register the test with the driver.

Parameters:
testnameshould be the same as one of the tests declared with DECLARE.

Definition at line 46 of file testlib_register.h.


Typedef Documentation

typedef int(* TestMainFunction)(int, char *[])

Definition at line 30 of file testlib_register.h.


Function Documentation

void testlib_register_test ( const vcl_string &  ,
TestMainFunction   
)

Definition at line 191 of file testlib_main.cxx.