diff options
author | Sebastien Barre <sebastien.barre@kitware.com> | 2002-01-20 02:24:55 (GMT) |
---|---|---|
committer | Sebastien Barre <sebastien.barre@kitware.com> | 2002-01-20 02:24:55 (GMT) |
commit | c8d8e693cf24d657ced601c8173258f89b62e71a (patch) | |
tree | 2fcf0b3929d709ec76fced03145ce59897a8c04d /Tests/ComplexRelativePaths/Executable/complex.cxx | |
parent | 30b3cc0755b43bf3ad04cf2fa4d5af441cbadfd7 (diff) | |
download | CMake-c8d8e693cf24d657ced601c8173258f89b62e71a.zip CMake-c8d8e693cf24d657ced601c8173258f89b62e71a.tar.gz CMake-c8d8e693cf24d657ced601c8173258f89b62e71a.tar.bz2 |
Add documentation, comments. Move some 'Complex' sub-tests into 2 new 'Wrapping' and 'Testing' tests.
Diffstat (limited to 'Tests/ComplexRelativePaths/Executable/complex.cxx')
-rw-r--r-- | Tests/ComplexRelativePaths/Executable/complex.cxx | 103 |
1 files changed, 67 insertions, 36 deletions
diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx index 6a55b5c..21576e9 100644 --- a/Tests/ComplexRelativePaths/Executable/complex.cxx +++ b/Tests/ComplexRelativePaths/Executable/complex.cxx @@ -8,18 +8,24 @@ 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++; } +// ====================================================================== + void TestAndRemoveFile(const char* filename) { if (!cmSystemTools::FileExists(filename)) @@ -39,6 +45,8 @@ void TestAndRemoveFile(const char* filename) } } +// ====================================================================== + void TestDir(const char* filename) { if (!cmSystemTools::FileExists(filename)) @@ -58,6 +66,7 @@ void TestDir(const char* filename) } } +// ====================================================================== int main() { @@ -88,12 +97,18 @@ int main() Passed("Call to file2 function returned 1."); } + // ---------------------------------------------------------------------- + // Test ADD_DEFINITIONS + #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 + // ---------------------------------------------------------------------- + // Test SET, VARIABLE_REQUIRES + #ifdef SHOULD_NOT_BE_DEFINED Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED is defined."); #else @@ -106,6 +121,42 @@ int main() 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 + +#ifndef ONE_VAR_IS_DEFINED + Failed("cmakedefine, SET or VARIABLE_REQUIRES is broken, " + "ONE_VAR_IS_DEFINED is not defined."); +#else + Passed("ONE_VAR_IS_DEFINED 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("the CONFIGURE_FILE command is broken, STRING_VAR is not defined."); +#else + if(strcmp(STRING_VAR, "CMake is great") != 0) + { + Failed("the SET or CONFIGURE_FILE command is broken. STRING_VAR == ", + STRING_VAR); + } + else + { + Passed("STRING_VAR == ", STRING_VAR); + } +#endif + + // ---------------------------------------------------------------------- + // Test various IF/ELSE combinations + #ifdef SHOULD_NOT_BE_DEFINED_AND Failed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_AND is defined."); #else @@ -142,38 +193,8 @@ int main() Passed("SHOULD_BE_DEFINED_MATCHES is defined."); #endif -#ifndef ONE_VAR - Failed("cmakedefine is broken, ONE_VAR is not defined."); -#else - Passed("ONE_VAR is defined."); -#endif - -#ifndef ONE_VAR_IS_DEFINED - Failed("cmakedefine, SET or VARIABLE_REQUIRES is broken, " - "ONE_VAR_IS_DEFINED is not defined."); -#else - Passed("ONE_VAR_IS_DEFINED 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("the CONFIGURE_FILE command is broken, STRING_VAR is not defined."); -#else - if(strcmp(STRING_VAR, "CMake is great") != 0) - { - Failed("the SET or CONFIGURE_FILE command is broken. STRING_VAR == ", - STRING_VAR); - } - else - { - Passed("STRING_VAR == ", STRING_VAR); - } -#endif + // ---------------------------------------------------------------------- + // Test FOREACH #ifndef FOREACH_VAR1 Failed("the FOREACH, SET or CONFIGURE_FILE command is broken, " @@ -205,6 +226,9 @@ int main() } #endif + // ---------------------------------------------------------------------- + // Test FIND_FILE, FIND_PATH and various GET_FILENAME_COMPONENT combinations + #ifndef FILENAME_VAR_PATH_NAME Failed("the FIND_FILE or GET_FILENAME_COMPONENT command is broken, " "FILENAME_VAR_PATH_NAME is not defined."); @@ -280,6 +304,9 @@ int main() } #endif + // ---------------------------------------------------------------------- + // Test LOAD_CACHE + #ifndef CACHE_TEST_VAR1 Failed("the LOAD_CACHE or CONFIGURE_FILE command is broken, " "CACHE_TEST_VAR1 is not defined."); @@ -325,22 +352,26 @@ int main() } #endif + // ---------------------------------------------------------------------- // A post-build custom-command has been attached to the lib (see Library/). - // It run ${CREATE_FILE_EXE} which will create the file - // ${Complex_BINARY_DIR}/Library/postbuild.txt. + // It runs ${CREATE_FILE_EXE} which will create a file. TestAndRemoveFile(BINARY_DIR "/Library/postbuild.txt"); + // ---------------------------------------------------------------------- // A custom target has been created (see Library/). - // It run ${CREATE_FILE_EXE} which will create the file - // ${Complex_BINARY_DIR}/Library/custom_target1.txt. + // It runs ${CREATE_FILE_EXE} which will create a file. TestAndRemoveFile(BINARY_DIR "/Library/custom_target1.txt"); + // ---------------------------------------------------------------------- // A directory has been created. TestDir(BINARY_DIR "/make_dir"); + // ---------------------------------------------------------------------- + // Summary + std::cout << "Passed: " << passed << "\n"; if(failed) { |