diff options
author | Sebastien Barre <sebastien.barre@kitware.com> | 2002-03-28 16:43:53 (GMT) |
---|---|---|
committer | Sebastien Barre <sebastien.barre@kitware.com> | 2002-03-28 16:43:53 (GMT) |
commit | e081345595453d203542e41449568ddbb8deeed2 (patch) | |
tree | 38f04dc49bb84d28c59780b26fbbd6f49ecbd46b /Source/cmCreateTestSourceList.cxx | |
parent | b63d6ee7ddefccbd290eec494a52cbc07c63dda4 (diff) | |
download | CMake-e081345595453d203542e41449568ddbb8deeed2.zip CMake-e081345595453d203542e41449568ddbb8deeed2.tar.gz CMake-e081345595453d203542e41449568ddbb8deeed2.tar.bz2 |
ENH: perform case insensitive comparison on test names
Diffstat (limited to 'Source/cmCreateTestSourceList.cxx')
-rw-r--r-- | Source/cmCreateTestSourceList.cxx | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index 895d5aa..1f64772 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -58,6 +58,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn) fout << "#include <stdio.h>\n" + "#include <stdlib.h>\n" "#include <string.h>\n" "\n" "// Forward declare test functions\n" @@ -112,6 +113,25 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn) fout << "};\n" "\n" + "// Allocate and create a lowercased copy of string\n" + "\n" + "char* lowercase(const char *string)\n" + "{\n" + " char *new_string = new char[strlen(string) + 1];\n" + " if (!new_string)\n" + " {\n" + " return NULL;\n" + " }\n" + " strcpy(new_string, string);\n" + " char *p = new_string;\n" + " while (*p != NULL)\n" + " {\n" + " *p = tolower(*p);\n" + " ++p;\n" + " }\n" + " return new_string;\n" + "}\n" + "\n" "int main(int ac, char** av)\n" "{\n" " int NumTests = " << numTests << ";\n" @@ -151,20 +171,21 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn) " return -1;\n" " }\n" " \n" - " // A test name was given, try to find it\n" + " char *arg = lowercase(av[1 + partial_match]);\n" " for (i =0; i < NumTests; ++i)\n" " {\n" - " if (partial_match && \n" - " strstr(cmakeGeneratedFunctionMapEntries[i].name, av[2]) != NULL)\n" + " char *test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);\n" + " if (partial_match && strstr(test_name, arg) != NULL)\n" " {\n" - " return (*cmakeGeneratedFunctionMapEntries[i].func)(ac-2, av+2);\n" + " return (*cmakeGeneratedFunctionMapEntries[i].func)(ac - 2, av + 2);\n" " }\n" - " else if (!partial_match && \n" - " strcmp(cmakeGeneratedFunctionMapEntries[i].name, av[1]) == 0)\n" + " else if (!partial_match && strcmp(test_name, arg) == 0)\n" " {\n" - " return (*cmakeGeneratedFunctionMapEntries[i].func)(ac-1, av+1);\n" + " return (*cmakeGeneratedFunctionMapEntries[i].func)(ac - 1, av + 1);\n" " }\n" + " delete [] test_name;\n" " }\n" + " delete [] arg;\n" " \n" " // If the test was not found but there is only one test, then\n" " // run it with the arguments\n" |