ENH: More coverage

This commit is contained in:
Andy Cedilnik 2003-07-22 12:21:15 -04:00
parent 6920d40ac6
commit 92ac3689c9
4 changed files with 172 additions and 0 deletions

View File

@ -12,6 +12,10 @@ typedef struct
/* do almost everything in the initial pass */
static int InitialPass(void *inf, void *mf, int argc, char *argv[])
{
char* file;
char* str;
char buffer[1024];
void *source_file;
cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf;
cmVTKWrapTclData *cdata =
@ -29,6 +33,83 @@ static int InitialPass(void *inf, void *mf, int argc, char *argv[])
info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO");
cdata->LibraryName = "HOO";
info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE", "ON",
"Test cache variable",
CM_CACHE_BOOL);
info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE1", "",
"Test cache variable 1",
CM_CACHE_PATH);
info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE2", "",
"Test cache variable 2",
CM_CACHE_FILEPATH);
info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE3", "",
"Test cache variable 3",
CM_CACHE_STRING);
info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE4", "",
"Test cache variable 4",
CM_CACHE_INTERNAL);
info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE5", "",
"Test cache variable 5",
CM_CACHE_STATIC);
file = info->CAPI->ExpandVariablesInString(mf, "${CMAKE_COMMAND}", 0, 0);
str = info->CAPI->GetFilenameWithoutExtension(file);
info->CAPI->DisplaySatus(mf, str);
info->CAPI->Free(str);
str = info->CAPI->GetFilenamePath(file);
info->CAPI->DisplaySatus(mf, str);
info->CAPI->Free(str);
str = info->CAPI->Capitalized("cmake");
info->CAPI->DisplaySatus(mf, str);
info->CAPI->Free(str);
info->CAPI->Free(file);
info->CAPI->DisplaySatus(mf, info->CAPI->GetProjectName(mf));
info->CAPI->DisplaySatus(mf, info->CAPI->GetHomeDirectory(mf));
info->CAPI->DisplaySatus(mf, info->CAPI->GetHomeOutputDirectory(mf));
info->CAPI->DisplaySatus(mf, info->CAPI->GetStartDirectory(mf));
info->CAPI->DisplaySatus(mf, info->CAPI->GetStartOutputDirectory(mf));
info->CAPI->DisplaySatus(mf, info->CAPI->GetCurrentDirectory(mf));
info->CAPI->DisplaySatus(mf, info->CAPI->GetCurrentOutputDirectory(mf));
sprintf(buffer, "Cache version: %d.%d, CMake version: %d.%d",
info->CAPI->GetCacheMajorVersion(mf),
info->CAPI->GetCacheMinorVersion(mf),
info->CAPI->GetMajorVersion(mf),
info->CAPI->GetMinorVersion(mf));
info->CAPI->DisplaySatus(mf, buffer);
if ( info->CAPI->CommandExists(mf, "SET") )
{
info->CAPI->DisplaySatus(mf, "Command SET exists");
}
if ( info->CAPI->CommandExists(mf, "SET_FOO_BAR") )
{
info->CAPI->SetError(mf, "Command SET_FOO_BAR should not exists");
return 0;
}
info->CAPI->AddDefineFlag(mf, "-DADDED_DEFINITION");
source_file = info->CAPI->CreateSourceFile();
str = info->CAPI->SourceFileGetSourceName(source_file);
sprintf(buffer, "Shold be empty (source file name): [%s]", str);
info->CAPI->DisplaySatus(mf, buffer);
str = info->CAPI->SourceFileGetFullPath(source_file);
sprintf(buffer, "Shold be empty (source file full path): [%s]", str);
info->CAPI->DisplaySatus(mf, buffer);
if ( info->CAPI->SourceFileGetPropertyAsBool(source_file, "SOME_PROPERTY") )
{
info->CAPI->SetError(mf, "Property SOME_PROPERTY should not be defined");
return 0;
}
str = info->CAPI->SourceFileGetProperty(source_file, "ABSTRACT");
sprintf(buffer, "Shold be 0 (source file abstract property): [%p]", str);
info->CAPI->DisplaySatus(mf, buffer);
info->CAPI->DestroySourceFile(source_file);
return 1;
}

View File

@ -13,6 +13,11 @@ int main ()
return 1;
#endif
#if !defined( ADDED_DEFINITION )
printf("Should have ADDED_DEFINITION defined\n");
return 1;
#endif
#ifdef CMAKE_IS_FUN
return SIZEOF_CHAR-1;
#else

View File

@ -12,6 +12,10 @@ typedef struct
/* do almost everything in the initial pass */
static int InitialPass(void *inf, void *mf, int argc, char *argv[])
{
char* file;
char* str;
char buffer[1024];
void *source_file;
cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf;
cmVTKWrapTclData *cdata =
@ -29,6 +33,83 @@ static int InitialPass(void *inf, void *mf, int argc, char *argv[])
info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO");
cdata->LibraryName = "HOO";
info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE", "ON",
"Test cache variable",
CM_CACHE_BOOL);
info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE1", "",
"Test cache variable 1",
CM_CACHE_PATH);
info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE2", "",
"Test cache variable 2",
CM_CACHE_FILEPATH);
info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE3", "",
"Test cache variable 3",
CM_CACHE_STRING);
info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE4", "",
"Test cache variable 4",
CM_CACHE_INTERNAL);
info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE5", "",
"Test cache variable 5",
CM_CACHE_STATIC);
file = info->CAPI->ExpandVariablesInString(mf, "${CMAKE_COMMAND}", 0, 0);
str = info->CAPI->GetFilenameWithoutExtension(file);
info->CAPI->DisplaySatus(mf, str);
info->CAPI->Free(str);
str = info->CAPI->GetFilenamePath(file);
info->CAPI->DisplaySatus(mf, str);
info->CAPI->Free(str);
str = info->CAPI->Capitalized("cmake");
info->CAPI->DisplaySatus(mf, str);
info->CAPI->Free(str);
info->CAPI->Free(file);
info->CAPI->DisplaySatus(mf, info->CAPI->GetProjectName(mf));
info->CAPI->DisplaySatus(mf, info->CAPI->GetHomeDirectory(mf));
info->CAPI->DisplaySatus(mf, info->CAPI->GetHomeOutputDirectory(mf));
info->CAPI->DisplaySatus(mf, info->CAPI->GetStartDirectory(mf));
info->CAPI->DisplaySatus(mf, info->CAPI->GetStartOutputDirectory(mf));
info->CAPI->DisplaySatus(mf, info->CAPI->GetCurrentDirectory(mf));
info->CAPI->DisplaySatus(mf, info->CAPI->GetCurrentOutputDirectory(mf));
sprintf(buffer, "Cache version: %d.%d, CMake version: %d.%d",
info->CAPI->GetCacheMajorVersion(mf),
info->CAPI->GetCacheMinorVersion(mf),
info->CAPI->GetMajorVersion(mf),
info->CAPI->GetMinorVersion(mf));
info->CAPI->DisplaySatus(mf, buffer);
if ( info->CAPI->CommandExists(mf, "SET") )
{
info->CAPI->DisplaySatus(mf, "Command SET exists");
}
if ( info->CAPI->CommandExists(mf, "SET_FOO_BAR") )
{
info->CAPI->SetError(mf, "Command SET_FOO_BAR should not exists");
return 0;
}
info->CAPI->AddDefineFlag(mf, "-DADDED_DEFINITION");
source_file = info->CAPI->CreateSourceFile();
str = info->CAPI->SourceFileGetSourceName(source_file);
sprintf(buffer, "Shold be empty (source file name): [%s]", str);
info->CAPI->DisplaySatus(mf, buffer);
str = info->CAPI->SourceFileGetFullPath(source_file);
sprintf(buffer, "Shold be empty (source file full path): [%s]", str);
info->CAPI->DisplaySatus(mf, buffer);
if ( info->CAPI->SourceFileGetPropertyAsBool(source_file, "SOME_PROPERTY") )
{
info->CAPI->SetError(mf, "Property SOME_PROPERTY should not be defined");
return 0;
}
str = info->CAPI->SourceFileGetProperty(source_file, "ABSTRACT");
sprintf(buffer, "Shold be 0 (source file abstract property): [%p]", str);
info->CAPI->DisplaySatus(mf, buffer);
info->CAPI->DestroySourceFile(source_file);
return 1;
}

View File

@ -13,6 +13,11 @@ int main ()
return 1;
#endif
#if !defined( ADDED_DEFINITION )
printf("Should have ADDED_DEFINITION defined\n");
return 1;
#endif
#ifdef CMAKE_IS_FUN
return SIZEOF_CHAR-1;
#else