FIX: la commande créait du code C++. Du code C devrait faire l'affaire.
This commit is contained in:
parent
7dffa485f6
commit
f87057813d
@ -159,13 +159,14 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
|
|||||||
"\n"
|
"\n"
|
||||||
"char* lowercase(const char *string)\n"
|
"char* lowercase(const char *string)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" char *new_string = new char[strlen(string) + 1];\n"
|
" char *new_string, *p;\n"
|
||||||
|
" new_string = new char[strlen(string) + 1];\n"
|
||||||
" if (!new_string)\n"
|
" if (!new_string)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" return NULL;\n"
|
" return NULL;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" strcpy(new_string, string);\n"
|
" strcpy(new_string, string);\n"
|
||||||
" char *p = new_string;\n"
|
" p = new_string;\n"
|
||||||
" while (*p != 0)\n"
|
" while (*p != 0)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" *p = tolower(*p);\n"
|
" *p = tolower(*p);\n"
|
||||||
@ -176,8 +177,10 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
|
|||||||
"\n"
|
"\n"
|
||||||
"int main(int ac, char** av)\n"
|
"int main(int ac, char** av)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" int NumTests = " << numTests << ";\n"
|
" int NumTests, i, testNum, partial_match;\n"
|
||||||
" int i;\n"
|
" char *arg, *test_name;\n"
|
||||||
|
" \n"
|
||||||
|
" NumTests = " << numTests << ";\n"
|
||||||
" \n"
|
" \n"
|
||||||
" // If no test name was given\n";
|
" // If no test name was given\n";
|
||||||
if(function.size())
|
if(function.size())
|
||||||
@ -202,7 +205,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
|
|||||||
" printf(\"%3d. %s\\n\", i, cmakeGeneratedFunctionMapEntries[i].name);\n"
|
" printf(\"%3d. %s\\n\", i, cmakeGeneratedFunctionMapEntries[i].name);\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" printf(\"To run a test, enter the test number: \");\n"
|
" printf(\"To run a test, enter the test number: \");\n"
|
||||||
" int testNum = 0;\n"
|
" testNum = 0;\n"
|
||||||
" scanf(\"%d\", &testNum);\n"
|
" scanf(\"%d\", &testNum);\n"
|
||||||
" if (testNum >= NumTests)\n"
|
" if (testNum >= NumTests)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
@ -213,17 +216,17 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
|
|||||||
" }\n"
|
" }\n"
|
||||||
" \n"
|
" \n"
|
||||||
" // If partial match is requested\n"
|
" // If partial match is requested\n"
|
||||||
" int partial_match = (strcmp(av[1], \"-R\") == 0) ? 1 : 0;\n"
|
" partial_match = (strcmp(av[1], \"-R\") == 0) ? 1 : 0;\n"
|
||||||
" if (partial_match && ac < 3)\n"
|
" if (partial_match && ac < 3)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" printf(\"-R needs an additional parameter.\\n\");\n"
|
" printf(\"-R needs an additional parameter.\\n\");\n"
|
||||||
" return -1;\n"
|
" return -1;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" \n"
|
" \n"
|
||||||
" char *arg = lowercase(av[1 + partial_match]);\n"
|
" arg = lowercase(av[1 + partial_match]);\n"
|
||||||
" for (i =0; i < NumTests; ++i)\n"
|
" for (i =0; i < NumTests; ++i)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" char *test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);\n"
|
" test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);\n"
|
||||||
" if (partial_match && strstr(test_name, arg) != NULL)\n"
|
" if (partial_match && strstr(test_name, arg) != NULL)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" return (*cmakeGeneratedFunctionMapEntries[i].func)(ac - 2, av + 2);\n"
|
" return (*cmakeGeneratedFunctionMapEntries[i].func)(ac - 2, av + 2);\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user