aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorsobolevn <mail@sobolevn.me>2024-08-20 09:25:18 +0300
committerLouis Pilfold <louis@lpil.uk>2024-08-24 13:07:53 +0100
commit7f348a800e676f753756712673aabc5dde66594d (patch)
treed4cabd381ecd06dfe2abe251738239bb61abf056 /test
parent55144a098040bf43871df4cf7b217e47f697c12b (diff)
downloadgleam_stdlib-7f348a800e676f753756712673aabc5dde66594d.tar.gz
gleam_stdlib-7f348a800e676f753756712673aabc5dde66594d.zip
More tests
Diffstat (limited to 'test')
-rw-r--r--test/gleam/bit_array_test.gleam30
1 files changed, 29 insertions, 1 deletions
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)