summaryrefslogtreecommitdiff
path: root/Tests/StringFileTest/CMakeLists.txt
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2004-04-29 15:12:40 -0400
committerAndy Cedilnik <andy.cedilnik@kitware.com>2004-04-29 15:12:40 -0400
commit8750f1c277d8bf3fdf2d2986f473c5f09e293ea5 (patch)
treec5db04b06c7c9ae256b6404fab2b664edb1ad5dd /Tests/StringFileTest/CMakeLists.txt
parentae50b4bc6afa62663317e630aef509a29c4f9021 (diff)
downloadcmake-8750f1c277d8bf3fdf2d2986f473c5f09e293ea5.tar.gz
ENH: Add RANGE support to FOREACH
Diffstat (limited to 'Tests/StringFileTest/CMakeLists.txt')
-rw-r--r--Tests/StringFileTest/CMakeLists.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt
index 74b99ecfc3..c0a904d4a7 100644
--- a/Tests/StringFileTest/CMakeLists.txt
+++ b/Tests/StringFileTest/CMakeLists.txt
@@ -73,3 +73,22 @@ FILE(GLOB src_files "${expr}")
MESSAGE("Globbed files [${src_files}].")
ADD_EXECUTABLE(StringFileTest ${src_files})
+
+# Test FOREACH range
+MESSAGE("Cheack if FOREACH with RANGE works")
+MACRO(TEST_RANGE ARGS CHECK)
+ SET(r)
+ FOREACH(a RANGE ${ARGS})
+ SET(r ${r} ${a})
+ ENDFOREACH(a)
+ MESSAGE("FOREACH with RANGE ${ARGS} produces ${r}")
+ IF("x${r}x" MATCHES "^x${CHECK}x$")
+ ELSE("x${r}x" MATCHES "^x${CHECK}x$")
+ MESSAGE(SEND_ERROR "The range resulted in: ${r} should be ${CHECK}")
+ ENDIF("x${r}x" MATCHES "^x${CHECK}x$")
+ENDMACRO(TEST_RANGE)
+TEST_RANGE("5" "0;1;2;3;4;5")
+TEST_RANGE("3;5" "3;4;5")
+TEST_RANGE("5;3" "5;4;3")
+TEST_RANGE("3;10;2" "3;5;7;9")
+TEST_RANGE("10;0;-3" "10;7;4;1")