summaryrefslogtreecommitdiffstats
path: root/Tests/StringFileTest
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2004-04-29 19:12:40 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2004-04-29 19:12:40 (GMT)
commit8750f1c277d8bf3fdf2d2986f473c5f09e293ea5 (patch)
treec5db04b06c7c9ae256b6404fab2b664edb1ad5dd /Tests/StringFileTest
parentae50b4bc6afa62663317e630aef509a29c4f9021 (diff)
downloadCMake-8750f1c277d8bf3fdf2d2986f473c5f09e293ea5.zip
CMake-8750f1c277d8bf3fdf2d2986f473c5f09e293ea5.tar.gz
CMake-8750f1c277d8bf3fdf2d2986f473c5f09e293ea5.tar.bz2
ENH: Add RANGE support to FOREACH
Diffstat (limited to 'Tests/StringFileTest')
-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 74b99ec..c0a904d 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")