summaryrefslogtreecommitdiff
path: root/Tests/Complex
diff options
context:
space:
mode:
authorChuck Atkins <chuck.atkins@kitware.com>2016-08-05 14:11:46 -0400
committerBrad King <brad.king@kitware.com>2016-08-09 09:30:34 -0400
commit02d177c9cc05514baccfa530ab85eec65374fbcb (patch)
tree2fbef7a16d4acac2b3b7218ef1abd16690566d9a /Tests/Complex
parent93b705a396c23f771ba203efb6f2f4934ae027b7 (diff)
downloadcmake-02d177c9cc05514baccfa530ab85eec65374fbcb.tar.gz
Add additional <= and >= comparison operators
This adds the LESS_EQUAL, GREATER_EQUAL, and associated STR and VERSION equivalents to use the combined <= and >= functionality.
Diffstat (limited to 'Tests/Complex')
-rw-r--r--Tests/Complex/CMakeLists.txt6
-rw-r--r--Tests/Complex/Executable/complex.cxx200
-rw-r--r--Tests/Complex/VarTests.cmake78
3 files changed, 264 insertions, 20 deletions
diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt
index 80cc2e3ba3..075faa768c 100644
--- a/Tests/Complex/CMakeLists.txt
+++ b/Tests/Complex/CMakeLists.txt
@@ -92,6 +92,12 @@ endif()
if(NOT 2.4 EQUAL 2.4)
message(FATAL_ERROR "Failed: NOT 2.4 EQUAL 2.4")
endif()
+if(NOT 2.4 LESS_EQUAL 2.4)
+ message(FATAL_ERROR "Failed: NOT 2.4 LESS_EQUAL 2.4")
+endif()
+if(NOT 2.4 GREATER_EQUAL 2.4)
+ message(FATAL_ERROR "Failed: NOT 2.4 GREATER_EQUAL 2.4")
+endif()
if(CMAKE_SYSTEM MATCHES "OSF1-V")
if(NOT CMAKE_COMPILER_IS_GNUCXX)
diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx
index 5f79ac065e..3b09229ba1 100644
--- a/Tests/Complex/Executable/complex.cxx
+++ b/Tests/Complex/Executable/complex.cxx
@@ -455,7 +455,7 @@ int main()
#endif
#ifndef SHOULD_BE_DEFINED_LESS
- cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_LESS is not defined.\n");
+ cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_LESS is not defined.");
#else
cmPassed("SHOULD_BE_DEFINED_LESS is defined.");
#endif
@@ -467,7 +467,7 @@ int main()
#endif
#ifndef SHOULD_BE_DEFINED_LESS2
- cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_LESS2 is not defined.\n");
+ cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_LESS2 is not defined.");
#else
cmPassed("SHOULD_BE_DEFINED_LESS2 is defined.");
#endif
@@ -478,6 +478,24 @@ int main()
cmPassed("SHOULD_NOT_BE_DEFINED_GREATER is not defined.");
#endif
+#ifndef SHOULD_BE_DEFINED_GREATER
+ cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_GREATER is not defined.");
+#else
+ cmPassed("SHOULD_BE_DEFINED_GREATER is defined.");
+#endif
+
+#ifdef SHOULD_NOT_BE_DEFINED_GREATER2
+ cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER2 is defined.");
+#else
+ cmPassed("SHOULD_NOT_BE_DEFINED_GREATER2 is not defined.");
+#endif
+
+#ifndef SHOULD_BE_DEFINED_GREATER2
+ cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_GREATER2 is not defined.");
+#else
+ cmPassed("SHOULD_BE_DEFINED_GREATER2 is defined.");
+#endif
+
#ifdef SHOULD_NOT_BE_DEFINED_EQUAL
cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_EQUAL is defined.");
#else
@@ -485,28 +503,93 @@ int main()
#endif
#ifndef SHOULD_BE_DEFINED_EQUAL
- cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_EQUAL is not defined.\n");
+ cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_EQUAL is not defined.");
#else
cmPassed("SHOULD_BE_DEFINED_EQUAL is defined.");
#endif
-#ifndef SHOULD_BE_DEFINED_GREATER
- cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_GREATER is not defined.\n");
+#ifdef SHOULD_NOT_BE_DEFINED_LESS_EQUAL
+ cmFailed(
+ "IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS_EQUAL is defined.");
#else
- cmPassed("SHOULD_BE_DEFINED_GREATER is defined.");
+ cmPassed("SHOULD_NOT_BE_DEFINED_LESS_EQUAL is not defined.");
#endif
-#ifdef SHOULD_NOT_BE_DEFINED_GREATER2
- cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER2 is defined.");
+#ifndef SHOULD_BE_DEFINED_LESS_EQUAL
+ cmFailed(
+ "IF or SET is broken, SHOULD_BE_DEFINED_LESS_EQUAL is not defined.");
#else
- cmPassed("SHOULD_NOT_BE_DEFINED_GREATER2 is not defined.");
+ cmPassed("SHOULD_BE_DEFINED_LESS_EQUAL is defined.");
#endif
-#ifndef SHOULD_BE_DEFINED_GREATER2
+#ifdef SHOULD_NOT_BE_DEFINED_LESS_EQUAL2
cmFailed(
- "IF or SET is broken, SHOULD_BE_DEFINED_GREATER2 is not defined.\n");
+ "IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS_EQUAL2 is defined.");
#else
- cmPassed("SHOULD_BE_DEFINED_GREATER2 is defined.");
+ cmPassed("SHOULD_NOT_BE_DEFINED_LESS_EQUAL2 is not defined.");
+#endif
+
+#ifndef SHOULD_BE_DEFINED_LESS_EQUAL2
+ cmFailed(
+ "IF or SET is broken, SHOULD_BE_DEFINED_LESS_EQUAL2 is not defined.");
+#else
+ cmPassed("SHOULD_BE_DEFINED_LESS_EQUAL2 is defined.");
+#endif
+
+#ifdef SHOULD_NOT_BE_DEFINED_LESS_EQUAL3
+ cmFailed(
+ "IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS_EQUAL3 is defined.");
+#else
+ cmPassed("SHOULD_NOT_BE_DEFINED_LESS_EQUAL3 is not defined.");
+#endif
+
+#ifndef SHOULD_BE_DEFINED_LESS_EQUAL3
+ cmFailed(
+ "IF or SET is broken, SHOULD_BE_DEFINED_LESS_EQUAL3 is not defined.");
+#else
+ cmPassed("SHOULD_BE_DEFINED_LESS_EQUAL3 is defined.");
+#endif
+
+#ifdef SHOULD_NOT_BE_DEFINED_GREATER_EQUAL
+ cmFailed(
+ "IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER_EQUAL is defined.");
+#else
+ cmPassed("SHOULD_NOT_BE_DEFINED_GREATER_EQUAL is not defined.");
+#endif
+
+#ifndef SHOULD_BE_DEFINED_GREATER_EQUAL
+ cmFailed(
+ "IF or SET is broken, SHOULD_BE_DEFINED_GREATER_EQUAL is not defined.");
+#else
+ cmPassed("SHOULD_BE_DEFINED_GREATER_EQUAL is defined.");
+#endif
+
+#ifdef SHOULD_NOT_BE_DEFINED_GREATER_EQUAL2
+ cmFailed(
+ "IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER_EQUAL2 is defined.");
+#else
+ cmPassed("SHOULD_NOT_BE_DEFINED_GREATER_EQUAL2 is not defined.");
+#endif
+
+#ifndef SHOULD_BE_DEFINED_GREATER_EQUAL2
+ cmFailed(
+ "IF or SET is broken, SHOULD_BE_DEFINED_GREATER_EQUAL2 is not defined.");
+#else
+ cmPassed("SHOULD_BE_DEFINED_GREATER_EQUAL2 is defined.");
+#endif
+
+#ifdef SHOULD_NOT_BE_DEFINED_GREATER_EQUAL3
+ cmFailed(
+ "IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER_EQUAL3 is defined.");
+#else
+ cmPassed("SHOULD_NOT_BE_DEFINED_GREATER_EQUAL3 is not defined.");
+#endif
+
+#ifndef SHOULD_BE_DEFINED_GREATER_EQUAL3
+ cmFailed(
+ "IF or SET is broken, SHOULD_BE_DEFINED_GREATER_EQUAL3 is not defined.");
+#else
+ cmPassed("SHOULD_BE_DEFINED_GREATER_EQUAL3 is defined.");
#endif
#ifdef SHOULD_NOT_BE_DEFINED_STRLESS
@@ -516,7 +599,7 @@ int main()
#endif
#ifndef SHOULD_BE_DEFINED_STRLESS
- cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRLESS is not defined.\n");
+ cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRLESS is not defined.");
#else
cmPassed("SHOULD_BE_DEFINED_STRLESS is defined.");
#endif
@@ -528,8 +611,7 @@ int main()
#endif
#ifndef SHOULD_BE_DEFINED_STRLESS2
- cmFailed(
- "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS2 is not defined.\n");
+ cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRLESS2 is not defined.");
#else
cmPassed("SHOULD_BE_DEFINED_STRLESS2 is defined.");
#endif
@@ -543,7 +625,7 @@ int main()
#ifndef SHOULD_BE_DEFINED_STRGREATER
cmFailed(
- "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER is not defined.\n");
+ "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER is not defined.");
#else
cmPassed("SHOULD_BE_DEFINED_STRGREATER is defined.");
#endif
@@ -557,11 +639,95 @@ int main()
#ifndef SHOULD_BE_DEFINED_STRGREATER2
cmFailed(
- "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER2 is not defined.\n");
+ "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER2 is not defined.");
#else
cmPassed("SHOULD_BE_DEFINED_STRGREATER2 is defined.");
#endif
+#ifdef SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL
+ cmFailed(
+ "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL is defined.");
+#else
+ cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL is not defined.");
+#endif
+
+#ifndef SHOULD_BE_DEFINED_STRLESS_EQUAL
+ cmFailed(
+ "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS_EQUAL is not defined.");
+#else
+ cmPassed("SHOULD_BE_DEFINED_STRLESS_EQUAL is defined.");
+#endif
+
+#ifdef SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL2
+ cmFailed(
+ "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL2 is defined.");
+#else
+ cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL2 is not defined.");
+#endif
+
+#ifndef SHOULD_BE_DEFINED_STRLESS_EQUAL2
+ cmFailed(
+ "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS_EQUAL2 is not defined.");
+#else
+ cmPassed("SHOULD_BE_DEFINED_STRLESS_EQUAL2 is defined.");
+#endif
+
+#ifdef SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL3
+ cmFailed(
+ "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL3 is defined.");
+#else
+ cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL3 is not defined.");
+#endif
+
+#ifndef SHOULD_BE_DEFINED_STRLESS_EQUAL3
+ cmFailed(
+ "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS_EQUAL3 is not defined.");
+#else
+ cmPassed("SHOULD_BE_DEFINED_STRLESS_EQUAL3 is defined.");
+#endif
+
+#ifdef SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL
+ cmFailed(
+ "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL is defined.");
+#else
+ cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL is not defined.");
+#endif
+
+#ifndef SHOULD_BE_DEFINED_STRGREATER_EQUAL
+ cmFailed(
+ "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER_EQUAL is not defined.");
+#else
+ cmPassed("SHOULD_BE_DEFINED_STRGREATER_EQUAL is defined.");
+#endif
+
+#ifdef SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL2
+ cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL2 is "
+ "defined.");
+#else
+ cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL2 is not defined.");
+#endif
+
+#ifndef SHOULD_BE_DEFINED_STRGREATER_EQUAL2
+ cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER_EQUAL2 is not "
+ "defined.");
+#else
+ cmPassed("SHOULD_BE_DEFINED_STRGREATER_EQUAL2 is defined.");
+#endif
+
+#ifdef SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL3
+ cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL3 is "
+ "defined.");
+#else
+ cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL3 is not defined.");
+#endif
+
+#ifndef SHOULD_BE_DEFINED_STRGREATER_EQUAL3
+ cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER_EQUAL3 is not "
+ "defined.");
+#else
+ cmPassed("SHOULD_BE_DEFINED_STRGREATER_EQUAL3 is defined.");
+#endif
+
// ----------------------------------------------------------------------
// Test FOREACH
diff --git a/Tests/Complex/VarTests.cmake b/Tests/Complex/VarTests.cmake
index 9d35949af0..8be59be5ea 100644
--- a/Tests/Complex/VarTests.cmake
+++ b/Tests/Complex/VarTests.cmake
@@ -126,6 +126,12 @@ else ()
add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER)
endif ()
+if (SNUM1_VAR GREATER SNUM2_VAR)
+ add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER2)
+else ()
+ add_definitions(-DSHOULD_BE_DEFINED_GREATER2)
+endif ()
+
if (SNUM2_VAR EQUAL SNUM1_VAR)
add_definitions(-DSHOULD_NOT_BE_DEFINED_EQUAL)
else ()
@@ -138,10 +144,40 @@ else ()
add_definitions(-DSHOULD_NOT_BE_DEFINED_EQUAL)
endif ()
-if (SNUM1_VAR GREATER SNUM2_VAR)
- add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER2)
+if (SNUM1_VAR LESS_EQUAL SNUM2_VAR)
+ add_definitions(-DSHOULD_BE_DEFINED_LESS_EQUAL)
else ()
- add_definitions(-DSHOULD_BE_DEFINED_GREATER2)
+ add_definitions(-DSHOULD_NOT_BE_DEFINED_LESS_EQUAL)
+endif ()
+
+if (SNUM2_VAR LESS_EQUAL SNUM1_VAR)
+ add_definitions(-DSHOULD_NOT_BE_DEFINED_LESS_EQUAL2)
+else ()
+ add_definitions(-DSHOULD_BE_DEFINED_LESS_EQUAL2)
+endif ()
+
+if (SNUM1_VAR LESS_EQUAL SNUM3_VAR)
+ add_definitions(-DSHOULD_BE_DEFINED_LESS_EQUAL3)
+else ()
+ add_definitions(-DSHOULD_BE_DEFINED_LESS_EQUAL3)
+endif ()
+
+if (SNUM2_VAR GREATER_EQUAL SNUM1_VAR)
+ add_definitions(-DSHOULD_BE_DEFINED_GREATER_EQUAL)
+else ()
+ add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER_EQUAL)
+endif ()
+
+if (SNUM1_VAR GREATER_EQUAL SNUM2_VAR)
+ add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER_EQUAL2)
+else ()
+ add_definitions(-DSHOULD_BE_DEFINED_GREATER_EQUAL2)
+endif ()
+
+if (SNUM1_VAR GREATER_EQUAL SNUM3_VAR)
+ add_definitions(-DSHOULD_BE_DEFINED_GREATER_EQUAL3)
+else ()
+ add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER_EQUAL3)
endif ()
set (SSTR1_VAR "abc")
@@ -171,6 +207,42 @@ else ()
add_definitions(-DSHOULD_BE_DEFINED_STRGREATER2)
endif ()
+if (SSTR1_VAR STRLESS_EQUAL SSTR2_VAR)
+ add_definitions(-DSHOULD_BE_DEFINED_STRLESS_EQUAL)
+else ()
+ add_definitions(-DSHOULD_NOT_BE_DEFINED_STRLESS_EQUAL)
+endif ()
+
+if (SSTR2_VAR STRLESS_EQUAL SSTR1_VAR)
+ add_definitions(-DSHOULD_NOT_BE_DEFINED_STRLESS_EQUAL2)
+else ()
+ add_definitions(-DSHOULD_BE_DEFINED_STRLESS_EQUAL2)
+endif ()
+
+if (SSTR1_VAR STRLESS_EQUAL SSTR1_VAR)
+ add_definitions(-DSHOULD_BE_DEFINED_STRLESS_EQUAL3)
+else ()
+ add_definitions(-DSHOULD_NOT_BE_DEFINED_STRLESS_EQUAL3)
+endif ()
+
+if (SSTR2_VAR STRGREATER_EQUAL SSTR1_VAR)
+ add_definitions(-DSHOULD_BE_DEFINED_STRGREATER_EQUAL)
+else ()
+ add_definitions(-DSHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL)
+endif ()
+
+if (SSTR1_VAR STRGREATER_EQUAL SSTR2_VAR)
+ add_definitions(-DSHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL2)
+else ()
+ add_definitions(-DSHOULD_BE_DEFINED_STRGREATER_EQUAL2)
+endif ()
+
+if (SSTR1_VAR STRGREATER_EQUAL SSTR1_VAR)
+ add_definitions(-DSHOULD_BE_DEFINED_STRGREATER_EQUAL3)
+else ()
+ add_definitions(-DSHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL3)
+endif ()
+
#
# Test FOREACH
#