summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/list/SORT.cmake
blob: 4a9e064dd7b5abd9ef24ef4452391a5788eb0d1d (plain)
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
set(source_unsorted
        c/B.h
        a/c.h
        B/a.h
        )

## Test with default options
set(expected
        B/a.h
        a/c.h
        c/B.h
        )
set(list ${source_unsorted})
list(SORT list)
if (NOT expected STREQUAL list)
    message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE STRING)")
endif ()


## Test CASE INSENSITIVE ORDER ASCENDING COMPARE STRING
set(expected
        a/c.h
        B/a.h
        c/B.h
        )
set(list ${source_unsorted})
list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE STRING)
if (NOT expected STREQUAL list)
    message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE STRING)")
endif ()

## Test CASE INSENSITIVE ORDER DESCENDING COMPARE STRING
set(expected
        c/B.h
        B/a.h
        a/c.h
        )
set(list ${source_unsorted})
list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE STRING)
if (NOT expected STREQUAL list)
    message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE STRING)")
endif ()

## Test CASE SENSITIVE ORDER ASCENDING COMPARE STRING
set(expected
        B/a.h
        a/c.h
        c/B.h
        )
set(list ${source_unsorted})
list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE STRING)
if (NOT expected STREQUAL list)
    message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE STRING)")
endif ()

## Test CASE SENSITIVE ORDER DESCENDING COMPARE STRING
set(expected
        c/B.h
        a/c.h
        B/a.h
        )
set(list ${source_unsorted})
list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE STRING)
if (NOT expected STREQUAL list)
    message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE STRING)")
endif ()

## Test CASE INSENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME
set(expected
        B/a.h
        c/B.h
        a/c.h
        )
set(list ${source_unsorted})
list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME)
if (NOT expected STREQUAL list)
    message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME)")
endif ()

## Test CASE INSENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME
set(expected
        a/c.h
        c/B.h
        B/a.h
        )
set(list ${source_unsorted})
list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME)
if (NOT expected STREQUAL list)
    message(FATAL_ERROR "wrong sort result with command list(SORT list CASE INSENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME)")
endif ()

## Test CASE SENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME
set(expected
        c/B.h
        B/a.h
        a/c.h
        )
set(list ${source_unsorted})
list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME)
if (NOT expected STREQUAL list)
    message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME)")
endif ()

## Test CASE SENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME
set(expected
        a/c.h
        B/a.h
        c/B.h
        )
set(list ${source_unsorted})
list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME)
if (NOT expected STREQUAL list)
    message(FATAL_ERROR "wrong sort result with command list(SORT list CASE SENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME)")
endif ()