1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
set(mylist alpha bravo charlie delta)
list(SUBLIST mylist 1 2 result)
if (NOT result STREQUAL "bravo;charlie")
message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"bravo;charlie\"")
endif()
unset(result)
list(SUBLIST mylist 0 2 result)
if (NOT result STREQUAL "alpha;bravo")
message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"alpha;bravo\"")
endif()
unset(result)
list(SUBLIST mylist 3 2 result)
if (NOT result STREQUAL "delta")
message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"delta\"")
endif()
unset(result)
list(SUBLIST mylist 2 0 result)
list(LENGTH result length)
if (NOT length EQUAL 0)
message (FATAL_ERROR "SUBLIST is \"${result}\", expected is an empty list")
endif()
unset(result)
list(SUBLIST mylist 1 5 result)
if (NOT result STREQUAL "bravo;charlie;delta")
message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"bravo;charlie;delta\"")
endif()
unset(result)
list(SUBLIST mylist 1 -1 result)
if (NOT result STREQUAL "bravo;charlie;delta")
message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"bravo;charlie;delta\"")
endif()
set(mylist ";;")
unset(result)
list(SUBLIST mylist 0 0 result)
if (NOT result STREQUAL "")
message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"\"")
endif()
unset(result)
list(SUBLIST mylist 0 1 result)
if (NOT result STREQUAL "")
message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"\"")
endif()
unset(result)
list(SUBLIST mylist 0 2 result)
if (NOT result STREQUAL ";")
message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \";\"")
endif()
unset(result)
list(SUBLIST mylist 0 3 result)
if (NOT result STREQUAL ";;")
message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \";;\"")
endif()
set(mylist [[a\;b;c\;d;e]])
unset(result)
list(SUBLIST mylist 1 2 result)
if (NOT result STREQUAL "c;d;e")
message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"c;d;e\"")
endif()
set(mylist [[a\;b;c\\;d;e;f;g;h]])
unset(result)
list(SUBLIST mylist 1 -1 result)
if (NOT result STREQUAL "c\\;d;e;f;g;h")
message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"c\\;d;e;f;g;h\"")
endif()
|