From ed7bd3774c46d374c0a466cc0a946fa96fe2003f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20L=C3=A9vesque?= Date: Thu, 20 Oct 2022 21:05:30 -0400 Subject: add function.applyX --- test/gleam/function_test.gleam | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'test') diff --git a/test/gleam/function_test.gleam b/test/gleam/function_test.gleam index eff4dea..d481893 100644 --- a/test/gleam/function_test.gleam +++ b/test/gleam/function_test.gleam @@ -122,3 +122,51 @@ pub fn tap_test() { }) |> should.equal("Thanks Joe & Louis") } + +pub fn apply1_test() { + let fun = fn(x1) { x1 } + + fun + |> function.apply1(1) + |> should.equal(1) +} + +pub fn apply2_test() { + let fun = fn(x1, x2) { x1 + x2 } + + fun + |> function.apply2(1, 2) + |> should.equal(3) +} + +pub fn apply3_test() { + let fun = fn(x1, x2, x3) { x1 + x2 + x3 } + + fun + |> function.apply3(1, 2, 3) + |> should.equal(6) +} + +pub fn apply4_test() { + let fun = fn(x1, x2, x3, x4) { x1 + x2 + x3 + x4 } + + fun + |> function.apply4(1, 2, 3, 4) + |> should.equal(10) +} + +pub fn apply5_test() { + let fun = fn(x1, x2, x3, x4, x5) { x1 + x2 + x3 + x4 + x5 } + + fun + |> function.apply5(1, 2, 3, 4, 5) + |> should.equal(15) +} + +pub fn apply6_test() { + let fun = fn(x1, x2, x3, x4, x5, x6) { x1 + x2 + x3 + x4 + x5 + x6 } + + fun + |> function.apply6(1, 2, 3, 4, 5, 6) + |> should.equal(21) +} -- cgit v1.2.3