From 7f348a800e676f753756712673aabc5dde66594d Mon Sep 17 00:00:00 2001 From: sobolevn Date: Tue, 20 Aug 2024 09:25:18 +0300 Subject: More tests --- test/gleam/bit_array_test.gleam | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/gleam/bit_array_test.gleam b/test/gleam/bit_array_test.gleam index 5af8cee..1fa38c1 100644 --- a/test/gleam/bit_array_test.gleam +++ b/test/gleam/bit_array_test.gleam @@ -352,7 +352,6 @@ pub fn compare_test() { } pub fn compare_utf8_test() { - // utf8 bit_array.compare(<<"ABC":utf8>>, <<"ABC":utf8>>) |> should.equal(order.Eq) @@ -378,6 +377,26 @@ pub fn compare_utf8_test() { |> should.equal(order.Eq) } +pub fn compare_utf8_and_numbers_test() { + bit_array.compare(<<"A":utf8>>, <<65>>) + |> should.equal(order.Eq) + + bit_array.compare(<<"A":utf8>>, <<64>>) + |> should.equal(order.Gt) + + bit_array.compare(<<"A":utf8>>, <<66>>) + |> should.equal(order.Lt) + + bit_array.compare(<<"AA":utf8>>, <<65, 65>>) + |> should.equal(order.Eq) + + bit_array.compare(<<"AAA":utf8>>, <<65, 65>>) + |> should.equal(order.Gt) + + bit_array.compare(<<"AA":utf8>>, <<65, 65, 1>>) + |> should.equal(order.Lt) +} + @target(erlang) pub fn compare_utf16_test() { bit_array.compare(<<"ABC":utf16>>, <<"ABC":utf16>>) @@ -440,6 +459,15 @@ pub fn compare_different_sizes_test() { bit_array.compare(<<4:5>>, <<4:5>>) |> should.equal(order.Eq) + bit_array.compare(<<4:5, 3:3>>, <<4:5, 2:3>>) + |> should.equal(order.Gt) + + bit_array.compare(<<4:5, 3:3>>, <<4:5, 4:3>>) + |> should.equal(order.Lt) + + bit_array.compare(<<4:5, 3:3, 0:0>>, <<4:5, 3:3, 0:0>>) + |> should.equal(order.Eq) + bit_array.compare(<<3:5>>, <<4:5>>) |> should.equal(order.Lt) -- cgit v1.2.3