diff options
author | Louis Pilfold <louis@lpil.uk> | 2019-08-14 23:22:54 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2019-08-14 23:22:54 +0100 |
commit | ddba860d353d86c3daa8c3bf7054e9f73c43eac4 (patch) | |
tree | 54346ef18ca6f6f5aba295abfa720f2e2af0f0e9 /test | |
parent | f79ba9b6e4e22188197f87b44794c9771bb40410 (diff) | |
download | gleam_stdlib-ddba860d353d86c3daa8c3bf7054e9f73c43eac4.tar.gz gleam_stdlib-ddba860d353d86c3daa8c3bf7054e9f73c43eac4.zip |
list:sort requires comparison function
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/list_test.gleam | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test/gleam/list_test.gleam b/test/gleam/list_test.gleam index 25028d9..a8b58e0 100644 --- a/test/gleam/list_test.gleam +++ b/test/gleam/list_test.gleam @@ -1,6 +1,7 @@ import gleam/expect import gleam/list import gleam/int +import gleam/float import gleam/string pub fn length_test() { @@ -258,14 +259,18 @@ pub fn unique_test() { } pub fn sort_test() { - list:sort([4, 3, 6, 5, 4]) + [4, 3, 6, 5, 4] + |> list:sort(_, int:compare) |> expect:equal(_, [3, 4, 4, 5, 6]) - list:sort([]) - |> expect:equal(_, []) + // TODO: Requires float:compare + // [4.1, 3.1, 6.1, 5.1, 4.1] + // |> list:sort(_, float:compare) + // |> expect:equal(_, [3.1, 4.1, 4.1, 5.1, 6.1]) - list:sort([{1, 2}, {4, 5}, {3, 2}]) - |> expect:equal(_, [{1, 2}, {3, 2}, {4, 5}]) + [] + |> list:sort(_, int:compare) + |> expect:equal(_, []) } pub fn index_map_test() { |