Property test specs and add coverage
[hope.git] / test / hope_result_SUITE.erl
1 -module(hope_result_SUITE).
2
3 -include_lib("proper/include/proper.hrl").
4
5 %% Callbacks
6 -export(
7 [ all/0
8 , groups/0
9 , init_per_group/2
10 , end_per_group/2
11 ]).
12
13 %% Test cases
14 -export(
15 [ t_pipe_ok/1
16 , t_pipe_error/1
17 , t_hope_result_specs/1
18 ]).
19
20
21 -define(GROUP_PIPE, result_pipe).
22
23
24 %% ============================================================================
25 %% Common Test callbacks
26 %% ============================================================================
27
28 all() ->
29 [{group, ?GROUP_PIPE}].
30
31 groups() ->
32 Tests =
33 [ t_pipe_ok
34 , t_pipe_error
35 , t_hope_result_specs
36 ],
37 Properties = [parallel],
38 [{?GROUP_PIPE, Properties, Tests}].
39
40 init_per_group(?GROUP_PIPE, Cfg) ->
41 Steps =
42 [ fun (0) -> {ok, 1}; (X) -> {error, X} end
43 , fun (1) -> {ok, 2}; (X) -> {error, X} end
44 , fun (2) -> {ok, 3}; (X) -> {error, X} end
45 ],
46 hope_kv_list:set(Cfg, steps, Steps).
47
48 end_per_group(?GROUP_PIPE, _Cfg) ->
49 ok.
50
51
52 %% =============================================================================
53 %% Test cases
54 %% =============================================================================
55
56 t_pipe_ok(Cfg) ->
57 {some, Steps} = hope_kv_list:get(Cfg, steps),
58 {ok, 3} = hope_result:pipe(Steps, 0).
59
60 t_pipe_error(Cfg) ->
61 {some, Steps} = hope_kv_list:get(Cfg, steps),
62 {error, 1} = hope_result:pipe(Steps, 1).
63
64 t_hope_result_specs(_) ->
65 [] = proper:check_specs(hope_result).
This page took 0.051762 seconds and 4 git commands to generate.