diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2001-08-23 17:57:45 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2001-08-23 17:57:45 (GMT) |
commit | 3a3b55679b1c28ac4d7c24c2de2ce28d88a3d21c (patch) | |
tree | 7bb6b35243fdc96afa879e06c1f4557ee22318b9 /Tests/ComplexRelativePaths/Executable | |
parent | bd4c5cf3625bc4d23f2f5c20fee7fa0bb34aed4b (diff) | |
download | CMake-3a3b55679b1c28ac4d7c24c2de2ce28d88a3d21c.zip CMake-3a3b55679b1c28ac4d7c24c2de2ce28d88a3d21c.tar.gz CMake-3a3b55679b1c28ac4d7c24c2de2ce28d88a3d21c.tar.bz2 |
ENH: try to get better test coverage
Diffstat (limited to 'Tests/ComplexRelativePaths/Executable')
-rw-r--r-- | Tests/ComplexRelativePaths/Executable/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/ComplexRelativePaths/Executable/complex.cxx | 104 |
2 files changed, 108 insertions, 0 deletions
diff --git a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt new file mode 100644 index 0000000..f0df86f --- /dev/null +++ b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt @@ -0,0 +1,4 @@ +ADD_EXECUTABLE(complex complex) +TARGET_LINK_LIBRARIES(complex CMakeTestLibrary) +TARGET_LINK_LIBRARIES(complex CMakeTestLibraryShared) + diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx new file mode 100644 index 0000000..9af88ad --- /dev/null +++ b/Tests/ComplexRelativePaths/Executable/complex.cxx @@ -0,0 +1,104 @@ +#include "cmTestConfigure.h" +#include "ExtraSources/file1.h" +#include "file2.h" +#include "sharedFile.h" +#include "cmStandardIncludes.h" + +int passed = 0; +int failed = 0; + +void Failed(const char* Message, const char* m2= "") +{ + std::cerr << "Failed: " << Message << m2 << "\n"; + failed++; +} + +void Passed(const char* Message, const char* m2="") +{ + std::cout << "Passed: " << Message << m2 << "\n"; + passed++; +} + +main() +{ + if(sharedFunction() != 1) + { + Failed("Call to sharedFunction from shared library failed."); + } + else + { + Passed("Call to sharedFunction from shared library worked."); + } + + if(file1() != 1) + { + Failed("Call to file1 function from library failed."); + } + else + { + Passed("Call to file1 function returned 1."); + } + if(file2() != 1) + { + Failed("Call to file2 function from library failed."); + } + else + { + Passed("Call to file2 function returned 1."); + } +#ifndef CMAKE_IS_FUN + Failed("CMake is not fun, so it is broken and should be fixed."); +#else + Passed("CMAKE_IS_FUN is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED + Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED is defined."); +#else + Passed("SHOULD_NOT_BE_DEFINED is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED + Failed("IF or SET is broken, SHOULD_BE_DEFINED is not defined.\n"); +#else + Passed("SHOULD_BE_DEFINED is defined."); +#endif + +#ifndef ONE_VAR + Failed("cmakedefine is broken, ONE_VAR is not defined."); +#else + Passed("ONE_VAR is defined."); +#endif + +#ifdef ZERO_VAR + Failed("cmakedefine is broken, ZERO_VAR is defined."); +#else + Passed("ZERO_VAR is not defined."); +#endif + + + +#ifndef STRING_VAR + Failed("configureFile is broken, STRING_VAR is not defined."); +#else + if(strcmp(STRING_VAR, "CMake is great") != 0) + { + Failed("CMake is not great, so the SET command," + "or the configurefile comand is broken. STRING_VAR== ", + STRING_VAR); + } + else + { + Passed("STRING_VAR == ", STRING_VAR); + } +#endif + std::cout << "Passed:" << passed << "\n"; + if(failed) + { + std::cout << "Failed: " << failed << "\n"; + return failed; + } + return 0; +} + + |