diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2017-01-24 21:24:06 (GMT) |
---|---|---|
committer | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2017-01-24 21:24:06 (GMT) |
commit | 178c897374718c2b7cfa76f5c016f23658d5d2b2 (patch) | |
tree | ea560e7701424724c0a3033d4e9856263d53e558 /Templates/TestDriver.cxx.in | |
parent | 3bb4a798268669ca1364040abb3cfdf4a44c2f92 (diff) | |
download | CMake-178c897374718c2b7cfa76f5c016f23658d5d2b2.zip CMake-178c897374718c2b7cfa76f5c016f23658d5d2b2.tar.gz CMake-178c897374718c2b7cfa76f5c016f23658d5d2b2.tar.bz2 |
TestDriver: calc NumTests at compile time
Diffstat (limited to 'Templates/TestDriver.cxx.in')
-rw-r--r-- | Templates/TestDriver.cxx.in | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in index 8e54680..7340842 100644 --- a/Templates/TestDriver.cxx.in +++ b/Templates/TestDriver.cxx.in @@ -32,6 +32,9 @@ static functionMapEntry cmakeGeneratedFunctionMapEntries[] = { { 0, 0 } }; +static const int NumTests = + (sizeof(cmakeGeneratedFunctionMapEntries) / sizeof(functionMapEntry)) - 1; + /* Allocate and create a lowercased copy of string (note that it has to be free'd manually) */ @@ -55,16 +58,12 @@ static char* lowercase(const char* string) int main(int ac, char* av[]) { - int i, NumTests, testNum = 0, partial_match; + int i, testNum = 0, partial_match; char *arg, *test_name; - int count; int testToRun = -1; @CMAKE_TESTDRIVER_ARGVC_FUNCTION@ - for (count = 0; cmakeGeneratedFunctionMapEntries[count].name != 0; count++) { - } - NumTests = count; /* If no test name was given */ /* process command line with user function. */ if (ac < 2) { |