1 -module(hope_list_SUITE).
3 -include_lib("proper/include/proper.hrl").
13 [ t_unique_preserve_order/1
21 -define(GROUP , hope_list).
23 -define(PROPTEST(A), true = proper:quickcheck(A())).
26 %% ============================================================================
27 %% Common Test callbacks
28 %% ============================================================================
35 [ t_unique_preserve_order
41 Properties = [parallel],
42 [{?GROUP, Properties, Tests}].
45 %% =============================================================================
47 %% =============================================================================
50 F = fun (N) -> N + 1 end,
51 [4, 3, 2] = hope_list:map_rev([1, 2, 3], F),
52 [] = hope_list:map_rev([], F).
55 F = fun (N) -> N + 1 end,
56 [2, 3, 4] = hope_list:map_slow([1, 2, 3], F),
57 [] = hope_list:map_slow([], F).
60 F = fun (N) -> N + 1 end,
61 Xs = lists:seq(1, 5010),
62 Ys = lists:map(F, Xs),
63 Ys = hope_list:map(Xs, F),
64 [] = hope_list:map([], F).
66 t_unique_preserve_order(_Cfg) ->
67 ?PROPTEST(prop_unique_preserve_order).
69 prop_unique_preserve_order() ->
72 Duplicates = L -- lists:usort(L),
73 hope_list:unique_preserve_order(L) ==
74 lists:reverse(lists:reverse(L) -- Duplicates)
77 t_hope_list_specs(_) ->
78 [] = proper:check_specs(hope_list).