[Insight-developers] RE: TestDriver Test

Bill Hoffman bill.hoffman@kitware.com
Mon, 04 Mar 2002 09:25:40 -0500


Yes, I think you have captured the idea quite well, and you
did not miss anything.

The names were a bit strange, because I did it quickly, and there were
actually two different types of main, some with arguments and some without.
To simplify things, I only posted one map, because I figured we could change
all of the mains to take arguments.   

I do not think there is any way around having to edit the TestDriver.cxx file
each time you add a test.   If you did a global object in each file, it would
still have to be referenced by main to be called.  


We could create a cmake command to generate the 
TestDriver.cxx file.  I guess it would look something
like this:

CREATE_REGISTER_TEST_FILE(testfile.h test1 test2 ...)

Then in TestDriver.cxx:

main()
{
#include "testfile.h"  // include the register test file generated by cmake
}

-Bill
 


At 08:46 AM 3/4/2002 -0500, Miller, James V (CRD) wrote:
>Bill,
>
>Took me a while to figure out your macros and how arguments are passed to the 
>functions. You threw me off having a variable ArgsMap which maps a string 
>to a function pointer but does not use the map for function arguments.
>
>So I would call this FunctionMap or TestMap.
>
>So to summarize:
>
>1) Each directory could have a single executable built that encapsulated all the 
>   tests for the directory.
>2) We would call the executable N times for N tests passing in the "name" of the 
>   test to execute and the various args.
>
>How does this affect how people put in tests now:
>
>A) The test writer puts their test is a separate cxx file.
>B) Instead of a main() function, they have a single function which is the 
>   name of test.
>C) The ADD_TEST line in CMakeLists.txt has the name of the test driver before
>   the name of the specific test, i.e. instead of 
>        ADD_TEST(itkAsinImageFilterAndAdaptorTest itkAsinImageFilterAndAdaptorTest)
>   they would put
>        ADD_TEST(itkAsinImageFilterAndAdaptorTest itkBasicFiltersTest 
>            itkAsinImageFilterAndAdaptorTest)
>D) They add their cxx file to the test driver SOURCE_FILES list.
>E) They edit the TestDriver.cxx file and add a call to RegisterTest()
>
>Did I miss anything?
>
>Also, people should realize they can still use the old style of adding tests as 
>separate executables.  People could use that methodology when they first introduce
>a test.  Once the test compiles on all platforms, we can move the test into
>the TestDriver.
>
>Finally, I wonder if there is a mechansism so the TestDriver.cxx does not need to 
>be edited.  Could the RegisterTest() line be in the individual test cxx files? Then
>we could skip step (E).
>