summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-04-14 13:42:50 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-04-14 13:45:55 (GMT)
commit734238d64f292af9d3f68742c18b0ac96b78ac06 (patch)
tree8137fd572a13853a2c913c33048bbda58aeb6bce /Tests
parentb54d80b29344d3544f4d51a4ae466fb3d8a5e0f0 (diff)
parentda99eca1e7956e42e88df1b52c322f9c571acddd (diff)
downloadCMake-734238d64f292af9d3f68742c18b0ac96b78ac06.zip
CMake-734238d64f292af9d3f68742c18b0ac96b78ac06.tar.gz
CMake-734238d64f292af9d3f68742c18b0ac96b78ac06.tar.bz2
Merge topic 'sort_list_natural_20563'
da99eca1e7 list: add NATURAL sorting on SORT sub-command Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4602
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeTests/ListTest.cmake.in23
1 files changed, 23 insertions, 0 deletions
diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in
index f517e64..785f41d 100644
--- a/Tests/CMakeTests/ListTest.cmake.in
+++ b/Tests/CMakeTests/ListTest.cmake.in
@@ -85,6 +85,9 @@ set(result ken bill andy brad)
list(SORT result)
TEST("SORT result" "andy;bill;brad;ken")
+list(SORT result COMPARE NATURAL)
+TEST("SORT result COMPARE NATURAL" "andy;bill;brad;ken")
+
set(result andy bill brad ken)
list(REVERSE result)
TEST("REVERSE result" "ken;brad;bill;andy")
@@ -104,6 +107,26 @@ TEST("REVERSE empty result" "")
list(SORT result)
TEST("SORT empty result" "")
+list(SORT result COMPARE NATURAL)
+TEST("SORT result COMPARE NATURAL" "")
+
+set(result 1.1 10.0 11.0 12.0 12.1 2.0 2.1 3.0 3.1 3.2 8.0 9.0)
+
+list(SORT result COMPARE NATURAL)
+TEST("SORT result COMPARE NATURAL" "1.1;2.0;2.1;3.0;3.1;3.2;8.0;9.0;10.0;11.0;12.0;12.1")
+
+list(SORT result)
+TEST("SORT result" "1.1;10.0;11.0;12.0;12.1;2.0;2.1;3.0;3.1;3.2;8.0;9.0")
+
+list(SORT result COMPARE NATURAL ORDER DESCENDING)
+TEST("SORT result COMPARE NATURAL ORDER DESCENDING" "12.1;12.0;11.0;10.0;9.0;8.0;3.2;3.1;3.0;2.1;2.0;1.1")
+
+set(result b-1.1 a-10.0 c-2.0 d 1 00 0)
+
+list(SORT result COMPARE NATURAL)
+TEST("SORT result COMPARE NATURAL" "00;0;1;a-10.0;b-1.1;c-2.0;d")
+
+
# these trigger top-level condition
foreach(cmd IN ITEMS Append Find Get Insert Length Reverse Remove_At Remove_Duplicates Remove_Item Sort)
set(${cmd}-No-Arguments-RESULT 1)