[CMake] Multiple tests in a single file

David Doria daviddoria at gmail.com
Fri Jan 6 10:03:16 EST 2012


Does CTest have a mechanism to run man mini-tests in a single file?
I'm looking for something equivalent to the UnitTest++ syntax:

TEST(YourTestName)
{}
TEST(YourOtherTestName){}
int main(){  return UnitTest::RunAllTests();}
Of course you could do something like:

int YourTestName()
{

}

int YourOtherTestName()
{
}

int main()
{
  YourTestName();
  YourOtherTestName();
}

but then you have to manually output the name of the test if it fails,
you could forget to call one of the tests, etc.

Is there anything like this for CMake/CTest?

Thanks,

David


More information about the CMake mailing list