aboutsummaryrefslogtreecommitdiff
path: root/test/gleam/int_test.gleam
diff options
context:
space:
mode:
Diffstat (limited to 'test/gleam/int_test.gleam')
-rw-r--r--test/gleam/int_test.gleam22
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()