Implement automatic currying.
[hope.git] / test / hope_fun_SUITE.erl
CommitLineData
64617423
SK
1-module(hope_fun_SUITE).
2
3%% Callbacks
4-export(
5 [ all/0
6 , groups/0
7 ]).
8
9%% Test cases
10-export(
11 [ t_id/1
e033aade 12 , t_curry/1
64617423
SK
13 ]).
14
15
16-define(GROUP, hope_fun).
17
18
19%% ============================================================================
20%% Common Test callbacks
21%% ============================================================================
22
23all() ->
24 [ {group, ?GROUP}
25 ].
26
27groups() ->
28 Tests =
29 [ t_id
e033aade 30 , t_curry
64617423
SK
31 ],
32 Properties = [parallel],
33 [ {?GROUP, Properties, Tests}
34 ].
35
36
37%% =============================================================================
38%% Test cases
39%% =============================================================================
40
41t_id(_Cfg) ->
42 X = foo,
43 X = hope_fun:id(X).
e033aade
SK
44
45t_curry(_Cfg) ->
46 Single = fun (X) -> X end,
47 Double = fun (X, Y) -> {X, Y} end,
48 Triple = fun (X, Y, Z) -> {X, Y, Z} end,
49
50 F = hope_fun:curry(Single),
51 a = F(a),
52
53 G1 = hope_fun:curry(Double),
54 G = G1(a),
55 {a, b} = G(b),
56
57 H1 = hope_fun:curry(Triple),
58 H2 = H1(a),
59 H = H2(b),
60 {a, b, c} = H(c).
This page took 0.023913 seconds and 4 git commands to generate.