From e1f4d26f3ee2e765c87b02c96950c9e0cb1d8bde Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Fri, 10 May 2019 14:11:45 +0100 Subject: int:compare --- test/int_test.gleam | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test') diff --git a/test/int_test.gleam b/test/int_test.gleam index d5f0f58..77f48ba 100644 --- a/test/int_test.gleam +++ b/test/int_test.gleam @@ -1,5 +1,6 @@ import expect import int +import order pub fn to_string() { 123 @@ -50,3 +51,23 @@ pub fn to_base_string() { |> int:to_base_string(_, 16) |> expect:equal(_, "-64") } + +pub fn compare_test() { + int:compare(0, 0) + |> expect:equal(_, order:Eq) + + int:compare(1, 1) + |> expect:equal(_, order:Eq) + + int:compare(0, 1) + |> expect:equal(_, order:Lt) + + int:compare(-2, -1) + |> expect:equal(_, order:Lt) + + int:compare(2, 1) + |> expect:equal(_, order:Gt) + + int:compare(-1, -2) + |> expect:equal(_, order:Gt) +} -- cgit v1.2.3