diff options
author | Louis Pilfold <louis@lpil.uk> | 2019-05-10 14:35:16 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2019-05-10 14:35:16 +0100 |
commit | 59a644c59dcebaab9369341ec3419a9ddb2deda8 (patch) | |
tree | d3301f99b63075c7f6294a9612629f2b40e49e36 /test | |
parent | 8fb5ad85ab623f93cfc0670bc11ec12856a9b4cd (diff) | |
download | gleam_stdlib-59a644c59dcebaab9369341ec3419a9ddb2deda8.tar.gz gleam_stdlib-59a644c59dcebaab9369341ec3419a9ddb2deda8.zip |
order tests
Diffstat (limited to 'test')
-rw-r--r-- | test/order_test.gleam | 157 |
1 files changed, 108 insertions, 49 deletions
diff --git a/test/order_test.gleam b/test/order_test.gleam index 07b527c..35ba0bd 100644 --- a/test/order_test.gleam +++ b/test/order_test.gleam @@ -1,52 +1,111 @@ import expect import order -// TODO: https://github.com/lpil/gleam/issues/141 - -// pub fn reverse_test() { -// order:reverse(Lt) |> expect:equal(_, Gt) -// order:reverse(Eq) |> expect:equal(_, Eq) -// order:reverse(Gt) |> expect:equal(_, Lt) -// } - -// pub fn to_int_test() { -// order:to_int(Lt) |> expect:equal(_, -1) -// order:to_int(Eq) |> expect:equal(_, 0) -// order:to_int(Gt) |> expect:equal(_, 1) -// } - -// pub fn compare_test() { -// order:compare(Lt, Lt) |> expect:equal(_, Eq) -// order:compare(Lt, Eq) |> expect:equal(_, Lt) -// order:compare(Lt, Gt) |> expect:equal(_, Lt) -// order:compare(Eq, Lt) |> expect:equal(_, Gt) -// order:compare(Eq, Eq) |> expect:equal(_, Eq) -// order:compare(Eq, Gt) |> expect:equal(_, Lt) -// order:compare(Gt, Lt) |> expect:equal(_, Gt) -// order:compare(Gt, Eq) |> expect:equal(_, Gt) -// order:compare(Gt, Gt) |> expect:equal(_, Eq) -// } - -// pub fn max_test() { -// order:max(Lt, Lt) |> expect:equal(_, Lt) -// order:max(Lt, Eq) |> expect:equal(_, Eq) -// order:max(Lt, Gt) |> expect:equal(_, Gt) -// order:max(Eq, Lt) |> expect:equal(_, Eq) -// order:max(Eq, Eq) |> expect:equal(_, Eq) -// order:max(Eq, Gt) |> expect:equal(_, Gt) -// order:max(Gt, Lt) |> expect:equal(_, Gt) -// order:max(Gt, Eq) |> expect:equal(_, Gt) -// order:max(Gt, Gt) |> expect:equal(_, Gt) -// } - -// pub fn min_test() { -// order:min(Lt, Lt) |> expect:equal(_, Lt) -// order:min(Lt, Eq) |> expect:equal(_, Lt) -// order:min(Lt, Gt) |> expect:equal(_, Lt) -// order:min(Eq, Lt) |> expect:equal(_, Lt) -// order:min(Eq, Eq) |> expect:equal(_, Eq) -// order:min(Eq, Gt) |> expect:equal(_, Eq) -// order:min(Gt, Lt) |> expect:equal(_, Lt) -// order:min(Gt, Eq) |> expect:equal(_, Eq) -// order:min(Gt, Gt) |> expect:equal(_, Gt) -// } +pub fn reverse_test() { + order:reverse(order:Lt) + |> expect:equal(_, order:Gt) + + order:reverse(order:Eq) + |> expect:equal(_, order:Eq) + + order:reverse(order:Gt) + |> expect:equal(_, order:Lt) +} + +pub fn to_int_test() { + order:to_int(order:Lt) + |> expect:equal(_, -1) + + order:to_int(order:Eq) + |> expect:equal(_, 0) + + order:to_int(order:Gt) + |> expect:equal(_, 1) +} + +pub fn compare_test() { + order:compare(order:Lt, order:Lt) + |> expect:equal(_, order:Eq) + + order:compare(order:Lt, order:Eq) + |> expect:equal(_, order:Lt) + + order:compare(order:Lt, order:Gt) + |> expect:equal(_, order:Lt) + + order:compare(order:Eq, order:Lt) + |> expect:equal(_, order:Gt) + + order:compare(order:Eq, order:Eq) + |> expect:equal(_, order:Eq) + + order:compare(order:Eq, order:Gt) + |> expect:equal(_, order:Lt) + + order:compare(order:Gt, order:Lt) + |> expect:equal(_, order:Gt) + + order:compare(order:Gt, order:Eq) + |> expect:equal(_, order:Gt) + + order:compare(order:Gt, order:Gt) + |> expect:equal(_, order:Eq) +} + +pub fn max_test() { + order:max(order:Lt, order:Lt) + |> expect:equal(_, order:Lt) + + order:max(order:Lt, order:Eq) + |> expect:equal(_, order:Eq) + + order:max(order:Lt, order:Gt) + |> expect:equal(_, order:Gt) + + order:max(order:Eq, order:Lt) + |> expect:equal(_, order:Eq) + + order:max(order:Eq, order:Eq) + |> expect:equal(_, order:Eq) + + order:max(order:Eq, order:Gt) + |> expect:equal(_, order:Gt) + + order:max(order:Gt, order:Lt) + |> expect:equal(_, order:Gt) + + order:max(order:Gt, order:Eq) + |> expect:equal(_, order:Gt) + + order:max(order:Gt, order:Gt) + |> expect:equal(_, order:Gt) +} + +pub fn min_test() { + order:min(order:Lt, order:Lt) + |> expect:equal(_, order:Lt) + + order:min(order:Lt, order:Eq) + |> expect:equal(_, order:Lt) + + order:min(order:Lt, order:Gt) + |> expect:equal(_, order:Lt) + + order:min(order:Eq, order:Lt) + |> expect:equal(_, order:Lt) + + order:min(order:Eq, order:Eq) + |> expect:equal(_, order:Eq) + + order:min(order:Eq, order:Gt) + |> expect:equal(_, order:Eq) + + order:min(order:Gt, order:Lt) + |> expect:equal(_, order:Lt) + + order:min(order:Gt, order:Eq) + |> expect:equal(_, order:Eq) + + order:min(order:Gt, order:Gt) + |> expect:equal(_, order:Gt) +} |