summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2005-09-20 16:50:27 (GMT)
committerKen Martin <ken.martin@kitware.com>2005-09-20 16:50:27 (GMT)
commit8607e8008bf3ec037bb7060a9dc5e229e02b8428 (patch)
treee9b3db4f5aeeabe261c6491b221126e76def4f55 /Tests
parent2e50727eca4aa2dc06aeda9f5f28cbfa56cb98ca (diff)
downloadCMake-8607e8008bf3ec037bb7060a9dc5e229e02b8428.zip
CMake-8607e8008bf3ec037bb7060a9dc5e229e02b8428.tar.gz
CMake-8607e8008bf3ec037bb7060a9dc5e229e02b8428.tar.bz2
ENH: increase coverage in loaded commands
Diffstat (limited to 'Tests')
-rw-r--r--Tests/LoadCommand/CMakeCommands/cmTestCommand.c22
-rw-r--r--Tests/LoadCommand/CMakeLists.txt5
-rw-r--r--Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c22
-rw-r--r--Tests/LoadCommandOneConfig/CMakeLists.txt5
4 files changed, 42 insertions, 12 deletions
diff --git a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c
index 4bcaa33..5ca9b33 100644
--- a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c
+++ b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c
@@ -16,18 +16,20 @@ static int InitialPass(void *inf, void *mf, int argc, char *argv[])
{
char* file;
char* str;
+ char *srcs;
const char* cstr;
char buffer[1024];
void *source_file;
+ char *args[2];
cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf;
-
+
cmVTKWrapTclData *cdata =
(cmVTKWrapTclData *)malloc(sizeof(cmVTKWrapTclData));
cdata->LibraryName = "BOO";
cdata->Argc = argc;
cdata->Argv = argv;
info->CAPI->SetClientData(info,cdata);
-
+
/* Now check and see if the value has been stored in the cache */
/* already, if so use that value and don't look for the program */
if(!info->CAPI->IsOn(mf,"TEST_COMMAND_TEST1"))
@@ -109,12 +111,26 @@ static int InitialPass(void *inf, void *mf, int argc, char *argv[])
info->CAPI->SetError(mf, "Property SOME_PROPERTY should not be defined");
return 0;
}
+ info->CAPI->SourceFileSetProperty(source_file, "SOME_PROPERTY2", "HERE");
cstr = info->CAPI->SourceFileGetProperty(source_file, "ABSTRACT");
- sprintf(buffer, "Shold be 0 (source file abstract property): [%p]", cstr);
+ sprintf(buffer, "Should be 0 (source file abstract property): [%p]", cstr);
info->CAPI->DisplaySatus(mf, buffer);
info->CAPI->DestroySourceFile(source_file);
+ srcs = "LoadedCommand.cxx";
+ info->CAPI->AddExecutable(mf,"LoadedCommand",1, &srcs, 0);
+
+ args[0] = "TEST_EXEC";
+ args[1] = "TRUE";
+
+ /* code coverage */
+ if (info->CAPI->GetTotalArgumentSize(2,args) != 13)
+ {
+ return 0;
+ }
+ info->CAPI->ExecuteCommand(mf,"SET",2,args);
+
return 1;
}
diff --git a/Tests/LoadCommand/CMakeLists.txt b/Tests/LoadCommand/CMakeLists.txt
index 6c1eb45..411d439 100644
--- a/Tests/LoadCommand/CMakeLists.txt
+++ b/Tests/LoadCommand/CMakeLists.txt
@@ -58,8 +58,7 @@ ELSE (COMPILE_OK)
ENDIF (COMPILE_OK)
# TEST_DEF is set by the loaded command cmTestCommand.c
-IF (TEST_DEF AND SOME_CACHE_VARIABLE)
+IF (TEST_DEF AND SOME_CACHE_VARIABLE AND TEST_EXEC)
ADD_DEFINITIONS(-DCMAKE_IS_FUN)
-ENDIF (TEST_DEF AND SOME_CACHE_VARIABLE)
+ENDIF (TEST_DEF AND SOME_CACHE_VARIABLE AND TEST_EXEC)
-ADD_EXECUTABLE (LoadedCommand LoadedCommand.cxx)
diff --git a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c b/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c
index 4bcaa33..5ca9b33 100644
--- a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c
+++ b/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c
@@ -16,18 +16,20 @@ static int InitialPass(void *inf, void *mf, int argc, char *argv[])
{
char* file;
char* str;
+ char *srcs;
const char* cstr;
char buffer[1024];
void *source_file;
+ char *args[2];
cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf;
-
+
cmVTKWrapTclData *cdata =
(cmVTKWrapTclData *)malloc(sizeof(cmVTKWrapTclData));
cdata->LibraryName = "BOO";
cdata->Argc = argc;
cdata->Argv = argv;
info->CAPI->SetClientData(info,cdata);
-
+
/* Now check and see if the value has been stored in the cache */
/* already, if so use that value and don't look for the program */
if(!info->CAPI->IsOn(mf,"TEST_COMMAND_TEST1"))
@@ -109,12 +111,26 @@ static int InitialPass(void *inf, void *mf, int argc, char *argv[])
info->CAPI->SetError(mf, "Property SOME_PROPERTY should not be defined");
return 0;
}
+ info->CAPI->SourceFileSetProperty(source_file, "SOME_PROPERTY2", "HERE");
cstr = info->CAPI->SourceFileGetProperty(source_file, "ABSTRACT");
- sprintf(buffer, "Shold be 0 (source file abstract property): [%p]", cstr);
+ sprintf(buffer, "Should be 0 (source file abstract property): [%p]", cstr);
info->CAPI->DisplaySatus(mf, buffer);
info->CAPI->DestroySourceFile(source_file);
+ srcs = "LoadedCommand.cxx";
+ info->CAPI->AddExecutable(mf,"LoadedCommand",1, &srcs, 0);
+
+ args[0] = "TEST_EXEC";
+ args[1] = "TRUE";
+
+ /* code coverage */
+ if (info->CAPI->GetTotalArgumentSize(2,args) != 13)
+ {
+ return 0;
+ }
+ info->CAPI->ExecuteCommand(mf,"SET",2,args);
+
return 1;
}
diff --git a/Tests/LoadCommandOneConfig/CMakeLists.txt b/Tests/LoadCommandOneConfig/CMakeLists.txt
index 6c1eb45..411d439 100644
--- a/Tests/LoadCommandOneConfig/CMakeLists.txt
+++ b/Tests/LoadCommandOneConfig/CMakeLists.txt
@@ -58,8 +58,7 @@ ELSE (COMPILE_OK)
ENDIF (COMPILE_OK)
# TEST_DEF is set by the loaded command cmTestCommand.c
-IF (TEST_DEF AND SOME_CACHE_VARIABLE)
+IF (TEST_DEF AND SOME_CACHE_VARIABLE AND TEST_EXEC)
ADD_DEFINITIONS(-DCMAKE_IS_FUN)
-ENDIF (TEST_DEF AND SOME_CACHE_VARIABLE)
+ENDIF (TEST_DEF AND SOME_CACHE_VARIABLE AND TEST_EXEC)
-ADD_EXECUTABLE (LoadedCommand LoadedCommand.cxx)