Property test specs and add coverage
[hope.git] / test / hope_list_SUITE.erl
CommitLineData
8dad2faf
SK
1-module(hope_list_SUITE).
2
f4780d18
PO
3-include_lib("proper/include/proper.hrl").
4
8dad2faf
SK
5%% Callbacks
6-export(
7 [ all/0
8 , groups/0
9 ]).
10
11%% Test cases
12-export(
13 [ t_unique_preserve_order/1
8bbf6f4d 14 , t_hope_list_specs/1
8dad2faf
SK
15 ]).
16
17
18-define(GROUP , hope_list).
19
f4780d18
PO
20-define(PROPTEST(A), true = proper:quickcheck(A())).
21
8dad2faf
SK
22
23%% ============================================================================
24%% Common Test callbacks
25%% ============================================================================
26
27all() ->
28 [{group, ?GROUP}].
29
30groups() ->
31 Tests =
32 [ t_unique_preserve_order
8bbf6f4d 33 , t_hope_list_specs
8dad2faf 34 ],
8bbf6f4d 35 Properties = [parallel],
8dad2faf
SK
36 [{?GROUP, Properties, Tests}].
37
38
39%% =============================================================================
40%% Test cases
41%% =============================================================================
42
43t_unique_preserve_order(_Cfg) ->
f4780d18
PO
44 ?PROPTEST(prop_unique_preserve_order).
45
46prop_unique_preserve_order() ->
47 ?FORALL(L, list(),
48 begin
49 Duplicates = L -- lists:usort(L),
50 hope_list:unique_preserve_order(L) ==
51 lists:reverse(lists:reverse(L) -- Duplicates)
52 end).
8bbf6f4d
PO
53
54t_hope_list_specs(_) ->
55 [] = proper:check_specs(hope_list).
This page took 0.02702 seconds and 4 git commands to generate.