summaryrefslogtreecommitdiff
path: root/tests/sort-tests.dx
blob: e5940dfb785b3830cfcff3be6d2c1a4e4ab7157c (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
import sort

:p is_sorted $ sort []::((Fin 0)=>Int)
> True
:p is_sorted $ sort [9, 3, 7, 4, 6, 1, 9, 1, 9, -1, 10, 10, 100, 0]
> True


'### Lexical Sorting Tests

:p "aaa" < "bbb"
> True

:p "aa" < "bbb"
> True

:p "a" < "aa"
> True

:p "aaa" > "bbb"
> False

:p "aa" > "bbb"
> False

:p "a" > "aa"
> False

:p "a" < "aa"
> True

:p ("" :: List Word8) > ("" :: List Word8)
> False

:p ("" :: List Word8) < ("" :: List Word8)
> False

:p "a" > "a"
> False

:p "a" < "a"
> False

:p "Thomas" < "Thompson"
> True

:p "Thomas" > "Thompson"
> False

:p is_sorted $ sort ["Charlie", "Alice", "Bob", "Aaron"]
> True