diff options
author | shayan javani <shayan.javani@gmail.com> | 2022-10-03 20:58:04 +0330 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2022-12-21 22:36:47 +0000 |
commit | 04c58510ed961c03877a4611eb7ad8d125c6c9ed (patch) | |
tree | 8335d4acf1d2dec96ae8229359b786fde0be28d9 /test | |
parent | 6f403d309ff768f31f0faa50fbdb48e80ac006e9 (diff) | |
download | gleam_stdlib-04c58510ed961c03877a4611eb7ad8d125c6c9ed.tar.gz gleam_stdlib-04c58510ed961c03877a4611eb7ad8d125c6c9ed.zip |
added test
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/int_test.gleam | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/gleam/int_test.gleam b/test/gleam/int_test.gleam index 851013d..594720c 100644 --- a/test/gleam/int_test.gleam +++ b/test/gleam/int_test.gleam @@ -87,6 +87,28 @@ pub fn to_base_string_test() { |> should.equal(Error(int.InvalidBase)) } +pub fn from_base_string_test() { + "100" + |> int.from_base_string(16) + |> should.equal(Ok(256)) + + "-100" + |> int.from_base_string(16) + |> should.equal(Ok(-256)) + + "100" + |> int.from_base_string(1) + |> should.equal(Error(Nil)) + + "100" + |> int.from_base_string(37) + |> should.equal(Error(Nil)) + + "AG" + |> int.from_base_string(16) + |> should.equal(Error(Nil)) +} + pub fn to_base2_test() { 100 |> int.to_base2() |