X-Git-Url: https://git.xandkar.net/?p=hope.git;a=blobdiff_plain;f=test%2Fhope_fun_SUITE.erl;h=7b5051b6289faad7a8d642a1de1e0fa61bb6a115;hp=910cc494e6669c646539484f30e42cca1c57e97b;hb=0b6ed6177fd85b5dd1b6ceadb9c2e2560c6597d2;hpb=a3173cf2c4cd3aa3b7da033cac6b2d9e9ccd492a diff --git a/test/hope_fun_SUITE.erl b/test/hope_fun_SUITE.erl index 910cc49..7b5051b 100644 --- a/test/hope_fun_SUITE.erl +++ b/test/hope_fun_SUITE.erl @@ -8,8 +8,10 @@ %% Test cases -export( - [ t_id/1 + [ t_specs/1 + , t_id/1 , t_curry/1 + , t_compose/1 ]). @@ -26,8 +28,10 @@ all() -> groups() -> Tests = - [ t_id + [ t_specs + , t_id , t_curry + , t_compose ], Properties = [parallel], [ {?GROUP, Properties, Tests} @@ -38,6 +42,9 @@ groups() -> %% Test cases %% ============================================================================= +t_specs(_) -> + [] = proper:check_specs(hope_fun). + t_id(_Cfg) -> X = foo, X = hope_fun:id(X). @@ -58,3 +65,12 @@ t_curry(_Cfg) -> H2 = H1(a), H = H2(b), {a, b, c} = H(c). + +t_compose(_Cfg) -> + A2B = fun (a) -> b end, + B2C = fun (b) -> c end, + C2D = fun (c) -> d end, + Fs = [C2D, B2C, A2B], + d = (hope_fun:compose ( Fs ))(a), + d = (hope_fun:compose_right ( Fs ))(a), + d = (hope_fun:compose_left (lists:reverse(Fs) ))(a).