Skip to content

Commit af801d8

Browse files
committed
Add unit test for Apply
1 parent d1b272e commit af801d8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using static Funcky.Discard;
2+
3+
namespace Funcky.Test.FunctionalClass;
4+
5+
public class ApplyTest
6+
{
7+
[Fact]
8+
public void CanApplyParametersInAnyOrder()
9+
{
10+
var func = Linear0;
11+
var f1 = Fn(Linear0).Apply(__, __, 10);
12+
var f2 = func.Apply(2, __, 7);
13+
var f3 = Apply(Fn(Linear0), 42, __, __);
14+
Assert.Equal(Linear0(10, 2, 10), f1(10, 2));
15+
Assert.Equal(Linear0(2, 10, 7), f2(10));
16+
Assert.Equal(Linear0(42, 10, 2), f3(10, 2));
17+
}
18+
19+
public static T Fn<T>(T value) => value;
20+
21+
private static int Linear0(int a, int b, int c)
22+
=> a + (b * c);
23+
}

0 commit comments

Comments
 (0)