diff options
author | Sebastien Barre <sebastien.barre@kitware.com> | 2002-01-20 06:58:57 (GMT) |
---|---|---|
committer | Sebastien Barre <sebastien.barre@kitware.com> | 2002-01-20 06:58:57 (GMT) |
commit | 6f3570656caf463addeb9edafcecba33f0efcbb9 (patch) | |
tree | d7c00a97f0216851a1adc583ec0ed737b3e99e8e /Tests | |
parent | f04128ad63b560079ab49118b9e64e2fe73ba39b (diff) | |
download | CMake-6f3570656caf463addeb9edafcecba33f0efcbb9.zip CMake-6f3570656caf463addeb9edafcecba33f0efcbb9.tar.gz CMake-6f3570656caf463addeb9edafcecba33f0efcbb9.tar.bz2 |
Increase Coverage.
Diffstat (limited to 'Tests')
21 files changed, 377 insertions, 13 deletions
diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index 8bd6bcd..fd3a2ba 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -46,7 +46,7 @@ INCLUDE_DIRECTORIES(BEFORE ${Complex_BINARY_DIR} ) -INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$") +INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$" ".*") LINK_DIRECTORIES( ${Complex_BINARY_DIR}/Library diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt index 33332eb..438808f 100644 --- a/Tests/Complex/Executable/CMakeLists.txt +++ b/Tests/Complex/Executable/CMakeLists.txt @@ -17,7 +17,11 @@ FIND_LIBRARY(CMAKE_LIB ${Complex_BINARY_DIR}/../../Source/MinSizeRel ${Complex_BINARY_DIR}/../../Source/RelWithDebInfo) -TARGET_LINK_LIBRARIES(complex ${CMAKE_LIB}) +# Specify the same one for debug/optimized to increase coverage +TARGET_LINK_LIBRARIES(complex + ${CMAKE_LIB} + debug ${CMAKE_LIB} + optimized ${CMAKE_LIB}) # # Output the files required by 'complex' to a file. diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx index a611b72..8707937 100644 --- a/Tests/Complex/Executable/complex.cxx +++ b/Tests/Complex/Executable/complex.cxx @@ -157,6 +157,30 @@ int main() // ---------------------------------------------------------------------- // Test various IF/ELSE combinations +#ifdef SHOULD_NOT_BE_DEFINED_NOT + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_NOT is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_NOT + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_NOT is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_NOT2 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_NOT2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_NOT2 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT2 is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_NOT2 is defined."); +#endif + #ifdef SHOULD_NOT_BE_DEFINED_AND cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined."); #else @@ -169,6 +193,18 @@ int main() cmPassed("SHOULD_BE_DEFINED_AND is defined."); #endif +#ifdef SHOULD_NOT_BE_DEFINED_AND2 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_AND2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_AND2 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_AND2 is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_AND2 is defined."); +#endif + #ifdef SHOULD_NOT_BE_DEFINED_OR cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR is defined."); #else @@ -181,6 +217,18 @@ int main() cmPassed("SHOULD_BE_DEFINED_OR is defined."); #endif +#ifdef SHOULD_NOT_BE_DEFINED_OR2 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_OR2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_OR2 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_OR2 is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_OR2 is defined."); +#endif + #ifdef SHOULD_NOT_BE_DEFINED_MATCHES cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES is defined."); #else @@ -193,6 +241,18 @@ int main() cmPassed("SHOULD_BE_DEFINED_MATCHES is defined."); #endif +#ifdef SHOULD_NOT_BE_DEFINED_MATCHES2 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_MATCHES2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_MATCHES2 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES2 is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_MATCHES2 is defined."); +#endif + #ifdef SHOULD_NOT_BE_DEFINED_COMMAND cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND is defined."); #else @@ -205,6 +265,18 @@ int main() cmPassed("SHOULD_BE_DEFINED_COMMAND is defined."); #endif +#ifdef SHOULD_NOT_BE_DEFINED_COMMAND2 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_COMMAND2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_COMMAND2 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_COMMAND2 is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_COMMAND2 is defined."); +#endif + // ---------------------------------------------------------------------- // Test FOREACH diff --git a/Tests/Complex/Library/CMakeLists.txt b/Tests/Complex/Library/CMakeLists.txt index aaa11ca..1445ccc 100644 --- a/Tests/Complex/Library/CMakeLists.txt +++ b/Tests/Complex/Library/CMakeLists.txt @@ -8,10 +8,15 @@ ADD_EXECUTABLE(create_file create_file.cxx) # # Create static library -# SOURCE_FILES_REMOVE is used for Coverage +# SOURCE_FILES_REMOVE is used for Coverage. empty.h is included for coverage # AUX_SOURCE_DIRECTORY(ExtraSources LibrarySources) -SOURCE_FILES(LibrarySources file2 create_file.cxx GENERATED nonexisting_file) +SOURCE_FILES(LibrarySources + file2 + empty + create_file.cxx + GENERATED + nonexisting_file) SOURCE_FILES_REMOVE(LibrarySources create_file.cxx GENERATED nonexisting_file) ADD_LIBRARY(CMakeTestLibrary LibrarySources) diff --git a/Tests/Complex/Library/empty.h b/Tests/Complex/Library/empty.h new file mode 100644 index 0000000..dea4b80 --- /dev/null +++ b/Tests/Complex/Library/empty.h @@ -0,0 +1 @@ +int file2(); diff --git a/Tests/Complex/VarTests.cmake b/Tests/Complex/VarTests.cmake index e4fb156..800a66e 100644 --- a/Tests/Complex/VarTests.cmake +++ b/Tests/Complex/VarTests.cmake @@ -2,6 +2,7 @@ # Test SET # SET (ZERO_VAR 0) +SET (ZERO_VAR2 0) IF(ZERO_VAR) ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED) @@ -22,30 +23,66 @@ VARIABLE_REQUIRES(ONE_VAR # # Test various IF/ELSE combinations # +IF(NOT ZERO_VAR) + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_NOT) +ELSE(NOT ZERO_VAR) + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_NOT) +ENDIF(NOT ZERO_VAR) + +IF(NOT ONE_VAR) + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_NOT2) +ELSE(NOT ONE_VAR) + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_NOT2) +ENDIF(NOT ONE_VAR) + IF(ONE_VAR AND ONE_VAR2) ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_AND) ELSE(ONE_VAR AND ONE_VAR2) ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_AND) ENDIF(ONE_VAR AND ONE_VAR2) +IF(ONE_VAR AND ZERO_VAR) + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_AND2) +ELSE(ONE_VAR AND ZERO_VAR) + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_AND2) +ENDIF(ONE_VAR AND ZERO_VAR) + IF(ZERO_VAR OR ONE_VAR2) ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_OR) ELSE(ZERO_VAR OR ONE_VAR2) ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_OR) ENDIF(ZERO_VAR OR ONE_VAR2) +IF(ZERO_VAR OR ZERO_VAR2) + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_OR2) +ELSE(ZERO_VAR OR ZERO_VAR2) + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_OR2) +ENDIF(ZERO_VAR OR ZERO_VAR2) + IF(STRING_VAR MATCHES "^CMake") ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_MATCHES) ELSE(STRING_VAR MATCHES "^CMake") ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES) ENDIF(STRING_VAR MATCHES "^CMake") +IF(STRING_VAR MATCHES "^foo") + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES2) +ELSE(STRING_VAR MATCHES "^foo") + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_MATCHES2) +ENDIF(STRING_VAR MATCHES "^foo") + IF(COMMAND "IF") ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND) ELSE(COMMAND "IF") ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND) ENDIF(COMMAND "IF") +IF(COMMAND "ROQUEFORT") + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND2) +ELSE(COMMAND "ROQUEFORT") + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND2) +ENDIF(COMMAND "ROQUEFORT") + # # Test FOREACH # diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index 8bd6bcd..fd3a2ba 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -46,7 +46,7 @@ INCLUDE_DIRECTORIES(BEFORE ${Complex_BINARY_DIR} ) -INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$") +INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$" ".*") LINK_DIRECTORIES( ${Complex_BINARY_DIR}/Library diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt index 33332eb..438808f 100644 --- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt @@ -17,7 +17,11 @@ FIND_LIBRARY(CMAKE_LIB ${Complex_BINARY_DIR}/../../Source/MinSizeRel ${Complex_BINARY_DIR}/../../Source/RelWithDebInfo) -TARGET_LINK_LIBRARIES(complex ${CMAKE_LIB}) +# Specify the same one for debug/optimized to increase coverage +TARGET_LINK_LIBRARIES(complex + ${CMAKE_LIB} + debug ${CMAKE_LIB} + optimized ${CMAKE_LIB}) # # Output the files required by 'complex' to a file. diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx index a611b72..8707937 100644 --- a/Tests/ComplexOneConfig/Executable/complex.cxx +++ b/Tests/ComplexOneConfig/Executable/complex.cxx @@ -157,6 +157,30 @@ int main() // ---------------------------------------------------------------------- // Test various IF/ELSE combinations +#ifdef SHOULD_NOT_BE_DEFINED_NOT + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_NOT is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_NOT + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_NOT is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_NOT2 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_NOT2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_NOT2 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT2 is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_NOT2 is defined."); +#endif + #ifdef SHOULD_NOT_BE_DEFINED_AND cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined."); #else @@ -169,6 +193,18 @@ int main() cmPassed("SHOULD_BE_DEFINED_AND is defined."); #endif +#ifdef SHOULD_NOT_BE_DEFINED_AND2 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_AND2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_AND2 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_AND2 is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_AND2 is defined."); +#endif + #ifdef SHOULD_NOT_BE_DEFINED_OR cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR is defined."); #else @@ -181,6 +217,18 @@ int main() cmPassed("SHOULD_BE_DEFINED_OR is defined."); #endif +#ifdef SHOULD_NOT_BE_DEFINED_OR2 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_OR2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_OR2 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_OR2 is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_OR2 is defined."); +#endif + #ifdef SHOULD_NOT_BE_DEFINED_MATCHES cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES is defined."); #else @@ -193,6 +241,18 @@ int main() cmPassed("SHOULD_BE_DEFINED_MATCHES is defined."); #endif +#ifdef SHOULD_NOT_BE_DEFINED_MATCHES2 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_MATCHES2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_MATCHES2 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES2 is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_MATCHES2 is defined."); +#endif + #ifdef SHOULD_NOT_BE_DEFINED_COMMAND cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND is defined."); #else @@ -205,6 +265,18 @@ int main() cmPassed("SHOULD_BE_DEFINED_COMMAND is defined."); #endif +#ifdef SHOULD_NOT_BE_DEFINED_COMMAND2 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_COMMAND2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_COMMAND2 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_COMMAND2 is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_COMMAND2 is defined."); +#endif + // ---------------------------------------------------------------------- // Test FOREACH diff --git a/Tests/ComplexOneConfig/Library/CMakeLists.txt b/Tests/ComplexOneConfig/Library/CMakeLists.txt index aaa11ca..1445ccc 100644 --- a/Tests/ComplexOneConfig/Library/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Library/CMakeLists.txt @@ -8,10 +8,15 @@ ADD_EXECUTABLE(create_file create_file.cxx) # # Create static library -# SOURCE_FILES_REMOVE is used for Coverage +# SOURCE_FILES_REMOVE is used for Coverage. empty.h is included for coverage # AUX_SOURCE_DIRECTORY(ExtraSources LibrarySources) -SOURCE_FILES(LibrarySources file2 create_file.cxx GENERATED nonexisting_file) +SOURCE_FILES(LibrarySources + file2 + empty + create_file.cxx + GENERATED + nonexisting_file) SOURCE_FILES_REMOVE(LibrarySources create_file.cxx GENERATED nonexisting_file) ADD_LIBRARY(CMakeTestLibrary LibrarySources) diff --git a/Tests/ComplexOneConfig/Library/empty.h b/Tests/ComplexOneConfig/Library/empty.h new file mode 100644 index 0000000..dea4b80 --- /dev/null +++ b/Tests/ComplexOneConfig/Library/empty.h @@ -0,0 +1 @@ +int file2(); diff --git a/Tests/ComplexOneConfig/VarTests.cmake b/Tests/ComplexOneConfig/VarTests.cmake index e4fb156..800a66e 100644 --- a/Tests/ComplexOneConfig/VarTests.cmake +++ b/Tests/ComplexOneConfig/VarTests.cmake @@ -2,6 +2,7 @@ # Test SET # SET (ZERO_VAR 0) +SET (ZERO_VAR2 0) IF(ZERO_VAR) ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED) @@ -22,30 +23,66 @@ VARIABLE_REQUIRES(ONE_VAR # # Test various IF/ELSE combinations # +IF(NOT ZERO_VAR) + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_NOT) +ELSE(NOT ZERO_VAR) + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_NOT) +ENDIF(NOT ZERO_VAR) + +IF(NOT ONE_VAR) + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_NOT2) +ELSE(NOT ONE_VAR) + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_NOT2) +ENDIF(NOT ONE_VAR) + IF(ONE_VAR AND ONE_VAR2) ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_AND) ELSE(ONE_VAR AND ONE_VAR2) ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_AND) ENDIF(ONE_VAR AND ONE_VAR2) +IF(ONE_VAR AND ZERO_VAR) + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_AND2) +ELSE(ONE_VAR AND ZERO_VAR) + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_AND2) +ENDIF(ONE_VAR AND ZERO_VAR) + IF(ZERO_VAR OR ONE_VAR2) ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_OR) ELSE(ZERO_VAR OR ONE_VAR2) ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_OR) ENDIF(ZERO_VAR OR ONE_VAR2) +IF(ZERO_VAR OR ZERO_VAR2) + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_OR2) +ELSE(ZERO_VAR OR ZERO_VAR2) + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_OR2) +ENDIF(ZERO_VAR OR ZERO_VAR2) + IF(STRING_VAR MATCHES "^CMake") ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_MATCHES) ELSE(STRING_VAR MATCHES "^CMake") ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES) ENDIF(STRING_VAR MATCHES "^CMake") +IF(STRING_VAR MATCHES "^foo") + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES2) +ELSE(STRING_VAR MATCHES "^foo") + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_MATCHES2) +ENDIF(STRING_VAR MATCHES "^foo") + IF(COMMAND "IF") ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND) ELSE(COMMAND "IF") ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND) ENDIF(COMMAND "IF") +IF(COMMAND "ROQUEFORT") + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND2) +ELSE(COMMAND "ROQUEFORT") + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND2) +ENDIF(COMMAND "ROQUEFORT") + # # Test FOREACH # diff --git a/Tests/ComplexRelativePaths/CMakeLists.txt b/Tests/ComplexRelativePaths/CMakeLists.txt index 8bd6bcd..fd3a2ba 100644 --- a/Tests/ComplexRelativePaths/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/CMakeLists.txt @@ -46,7 +46,7 @@ INCLUDE_DIRECTORIES(BEFORE ${Complex_BINARY_DIR} ) -INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$") +INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile).*$" ".*") LINK_DIRECTORIES( ${Complex_BINARY_DIR}/Library diff --git a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt index 33332eb..438808f 100644 --- a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt @@ -17,7 +17,11 @@ FIND_LIBRARY(CMAKE_LIB ${Complex_BINARY_DIR}/../../Source/MinSizeRel ${Complex_BINARY_DIR}/../../Source/RelWithDebInfo) -TARGET_LINK_LIBRARIES(complex ${CMAKE_LIB}) +# Specify the same one for debug/optimized to increase coverage +TARGET_LINK_LIBRARIES(complex + ${CMAKE_LIB} + debug ${CMAKE_LIB} + optimized ${CMAKE_LIB}) # # Output the files required by 'complex' to a file. diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx index a611b72..8707937 100644 --- a/Tests/ComplexRelativePaths/Executable/complex.cxx +++ b/Tests/ComplexRelativePaths/Executable/complex.cxx @@ -157,6 +157,30 @@ int main() // ---------------------------------------------------------------------- // Test various IF/ELSE combinations +#ifdef SHOULD_NOT_BE_DEFINED_NOT + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_NOT is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_NOT + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_NOT is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_NOT2 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_NOT2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_NOT2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_NOT2 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_NOT2 is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_NOT2 is defined."); +#endif + #ifdef SHOULD_NOT_BE_DEFINED_AND cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined."); #else @@ -169,6 +193,18 @@ int main() cmPassed("SHOULD_BE_DEFINED_AND is defined."); #endif +#ifdef SHOULD_NOT_BE_DEFINED_AND2 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_AND2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_AND2 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_AND2 is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_AND2 is defined."); +#endif + #ifdef SHOULD_NOT_BE_DEFINED_OR cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR is defined."); #else @@ -181,6 +217,18 @@ int main() cmPassed("SHOULD_BE_DEFINED_OR is defined."); #endif +#ifdef SHOULD_NOT_BE_DEFINED_OR2 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_OR2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_OR2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_OR2 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_OR2 is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_OR2 is defined."); +#endif + #ifdef SHOULD_NOT_BE_DEFINED_MATCHES cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES is defined."); #else @@ -193,6 +241,18 @@ int main() cmPassed("SHOULD_BE_DEFINED_MATCHES is defined."); #endif +#ifdef SHOULD_NOT_BE_DEFINED_MATCHES2 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_MATCHES2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_MATCHES2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_MATCHES2 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_MATCHES2 is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_MATCHES2 is defined."); +#endif + #ifdef SHOULD_NOT_BE_DEFINED_COMMAND cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND is defined."); #else @@ -205,6 +265,18 @@ int main() cmPassed("SHOULD_BE_DEFINED_COMMAND is defined."); #endif +#ifdef SHOULD_NOT_BE_DEFINED_COMMAND2 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_COMMAND2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_COMMAND2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_COMMAND2 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_COMMAND2 is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_COMMAND2 is defined."); +#endif + // ---------------------------------------------------------------------- // Test FOREACH diff --git a/Tests/ComplexRelativePaths/Library/CMakeLists.txt b/Tests/ComplexRelativePaths/Library/CMakeLists.txt index aaa11ca..1445ccc 100644 --- a/Tests/ComplexRelativePaths/Library/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/Library/CMakeLists.txt @@ -8,10 +8,15 @@ ADD_EXECUTABLE(create_file create_file.cxx) # # Create static library -# SOURCE_FILES_REMOVE is used for Coverage +# SOURCE_FILES_REMOVE is used for Coverage. empty.h is included for coverage # AUX_SOURCE_DIRECTORY(ExtraSources LibrarySources) -SOURCE_FILES(LibrarySources file2 create_file.cxx GENERATED nonexisting_file) +SOURCE_FILES(LibrarySources + file2 + empty + create_file.cxx + GENERATED + nonexisting_file) SOURCE_FILES_REMOVE(LibrarySources create_file.cxx GENERATED nonexisting_file) ADD_LIBRARY(CMakeTestLibrary LibrarySources) diff --git a/Tests/ComplexRelativePaths/Library/empty.h b/Tests/ComplexRelativePaths/Library/empty.h new file mode 100644 index 0000000..dea4b80 --- /dev/null +++ b/Tests/ComplexRelativePaths/Library/empty.h @@ -0,0 +1 @@ +int file2(); diff --git a/Tests/ComplexRelativePaths/VarTests.cmake b/Tests/ComplexRelativePaths/VarTests.cmake index e4fb156..800a66e 100644 --- a/Tests/ComplexRelativePaths/VarTests.cmake +++ b/Tests/ComplexRelativePaths/VarTests.cmake @@ -2,6 +2,7 @@ # Test SET # SET (ZERO_VAR 0) +SET (ZERO_VAR2 0) IF(ZERO_VAR) ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED) @@ -22,30 +23,66 @@ VARIABLE_REQUIRES(ONE_VAR # # Test various IF/ELSE combinations # +IF(NOT ZERO_VAR) + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_NOT) +ELSE(NOT ZERO_VAR) + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_NOT) +ENDIF(NOT ZERO_VAR) + +IF(NOT ONE_VAR) + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_NOT2) +ELSE(NOT ONE_VAR) + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_NOT2) +ENDIF(NOT ONE_VAR) + IF(ONE_VAR AND ONE_VAR2) ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_AND) ELSE(ONE_VAR AND ONE_VAR2) ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_AND) ENDIF(ONE_VAR AND ONE_VAR2) +IF(ONE_VAR AND ZERO_VAR) + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_AND2) +ELSE(ONE_VAR AND ZERO_VAR) + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_AND2) +ENDIF(ONE_VAR AND ZERO_VAR) + IF(ZERO_VAR OR ONE_VAR2) ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_OR) ELSE(ZERO_VAR OR ONE_VAR2) ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_OR) ENDIF(ZERO_VAR OR ONE_VAR2) +IF(ZERO_VAR OR ZERO_VAR2) + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_OR2) +ELSE(ZERO_VAR OR ZERO_VAR2) + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_OR2) +ENDIF(ZERO_VAR OR ZERO_VAR2) + IF(STRING_VAR MATCHES "^CMake") ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_MATCHES) ELSE(STRING_VAR MATCHES "^CMake") ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES) ENDIF(STRING_VAR MATCHES "^CMake") +IF(STRING_VAR MATCHES "^foo") + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES2) +ELSE(STRING_VAR MATCHES "^foo") + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_MATCHES2) +ENDIF(STRING_VAR MATCHES "^foo") + IF(COMMAND "IF") ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND) ELSE(COMMAND "IF") ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND) ENDIF(COMMAND "IF") +IF(COMMAND "ROQUEFORT") + ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND2) +ELSE(COMMAND "ROQUEFORT") + ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND2) +ENDIF(COMMAND "ROQUEFORT") + # # Test FOREACH # diff --git a/Tests/Testing/CMakeLists.txt b/Tests/Testing/CMakeLists.txt index 3c2dd97..fdb85d3 100644 --- a/Tests/Testing/CMakeLists.txt +++ b/Tests/Testing/CMakeLists.txt @@ -34,7 +34,10 @@ FIND_LIBRARY(CMAKE_LIB ${Testing_BINARY_DIR}/../../Source/MinSizeRel ${Testing_BINARY_DIR}/../../Source/RelWithDebInfo) -LINK_LIBRARIES(${CMAKE_LIB}) +# Specify the same one for debug/optimized to increase coverage +LINK_LIBRARIES(${CMAKE_LIB} + debug ${CMAKE_LIB} + optimized ${CMAKE_LIB}) # # Include Dart diff --git a/Tests/Wrapping/vtkExcluded.h b/Tests/Wrapping/vtkExcluded.h index e69de29..835f61a 100644 --- a/Tests/Wrapping/vtkExcluded.h +++ b/Tests/Wrapping/vtkExcluded.h @@ -0,0 +1,2 @@ +// A comment +// Another comment diff --git a/Tests/Wrapping/vtkIncluded.h b/Tests/Wrapping/vtkIncluded.h index e69de29..a1c4aba 100644 --- a/Tests/Wrapping/vtkIncluded.h +++ b/Tests/Wrapping/vtkIncluded.h @@ -0,0 +1,2 @@ +// A comment +// Another comment (force coverage) |