hope_list:unique_preserve_order/1 property test
[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
14 ]).
15
16
17-define(GROUP , hope_list).
18
f4780d18
PO
19-define(PROPTEST(A), true = proper:quickcheck(A())).
20
8dad2faf
SK
21
22%% ============================================================================
23%% Common Test callbacks
24%% ============================================================================
25
26all() ->
27 [{group, ?GROUP}].
28
29groups() ->
30 Tests =
31 [ t_unique_preserve_order
32 ],
33 Properties = [],
34 [{?GROUP, Properties, Tests}].
35
36
37%% =============================================================================
38%% Test cases
39%% =============================================================================
40
41t_unique_preserve_order(_Cfg) ->
f4780d18
PO
42 ?PROPTEST(prop_unique_preserve_order).
43
44prop_unique_preserve_order() ->
45 ?FORALL(L, list(),
46 begin
47 Duplicates = L -- lists:usort(L),
48 hope_list:unique_preserve_order(L) ==
49 lists:reverse(lists:reverse(L) -- Duplicates)
50 end).
This page took 0.019634 seconds and 4 git commands to generate.