aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorsharno <sharnoby3@gmail.com>2020-10-10 16:01:50 -0400
committerLouis Pilfold <louis@lpil.uk>2020-10-13 12:50:34 +0100
commit42c75c7c9594a068d72b75390b2a47e17544d087 (patch)
tree9d2bf0998b4551a32d8a67656a2b6c868bb31336 /test
parent2d7e7143d6b6445bd6973ff88e6594dfd1da4966 (diff)
downloadgleam_stdlib-42c75c7c9594a068d72b75390b2a47e17544d087.tar.gz
gleam_stdlib-42c75c7c9594a068d72b75390b2a47e17544d087.zip
add negate functions to int and float modules
Diffstat (limited to 'test')
-rw-r--r--test/gleam/float_test.gleam11
-rw-r--r--test/gleam/int_test.gleam11
2 files changed, 22 insertions, 0 deletions
diff --git a/test/gleam/float_test.gleam b/test/gleam/float_test.gleam
index 79bece2..be1f22d 100644
--- a/test/gleam/float_test.gleam
+++ b/test/gleam/float_test.gleam
@@ -231,3 +231,14 @@ pub fn square_root_test() {
float.square_root(-4.0)
|> should.equal(Error(Nil))
}
+
+pub fn negate_test() {
+ float.negate(-1.)
+ |> should.equal(1.)
+
+ float.negate(2.)
+ |> should.equal(-2.)
+
+ float.negate(0.)
+ |> should.equal(0.)
+}
diff --git a/test/gleam/int_test.gleam b/test/gleam/int_test.gleam
index bb4648e..4a01073 100644
--- a/test/gleam/int_test.gleam
+++ b/test/gleam/int_test.gleam
@@ -157,3 +157,14 @@ pub fn is_odd_test() {
int.is_odd(10005)
|> should.be_true
}
+
+pub fn negate_test() {
+ int.negate(-1)
+ |> should.equal(1)
+
+ int.negate(2)
+ |> should.equal(-2)
+
+ int.negate(0)
+ |> should.equal(0)
+}