From c1d3cc12b920f60d06265b645daa3ff0010a8402 Mon Sep 17 00:00:00 2001 From: Connor Schembor Date: Thu, 5 Nov 2020 21:28:32 -0500 Subject: Add product function to int and float modules --- test/gleam/float_test.gleam | 11 +++++++++++ test/gleam/int_test.gleam | 11 +++++++++++ 2 files changed, 22 insertions(+) (limited to 'test') diff --git a/test/gleam/float_test.gleam b/test/gleam/float_test.gleam index 2ebaefc..2b3334e 100644 --- a/test/gleam/float_test.gleam +++ b/test/gleam/float_test.gleam @@ -250,3 +250,14 @@ pub fn sum_test() { float.sum([1.0, 2.2, 3.3]) |> should.equal(6.5) } + +pub fn product_test() { + float.product([]) + |> should.equal(0.) + + float.product([4.]) + |> should.equal(4.) + + float.product([2.5, 3.2, 4.2]) + |> should.equal(33.6) +} diff --git a/test/gleam/int_test.gleam b/test/gleam/int_test.gleam index cd7b2b9..22a35e9 100644 --- a/test/gleam/int_test.gleam +++ b/test/gleam/int_test.gleam @@ -190,3 +190,14 @@ pub fn sum_test() { int.sum([1, 2, 3]) |> should.equal(6) } + +pub fn product_test() { + int.product([]) + |> should.equal(0) + + int.product([4]) + |> should.equal(4) + + int.product([1, 2, 3]) + |> should.equal(6) +} -- cgit v1.2.3