Property test specs and add coverage
[hope.git] / test / hope_dictionary_SUITE.erl
index a0848a3..914ae48 100644 (file)
@@ -1,5 +1,7 @@
 -module(hope_dictionary_SUITE).
 
+-include_lib("proper/include/proper.hrl").
+
 %% Callbacks
 -export(
     [ all/0
@@ -13,6 +15,8 @@
     [ t_set_new/1
     , t_set_existing/1
     , t_pop/1
+    , t_fold/1
+    , t_dictionary_specs/1
     ]).
 
 
@@ -32,8 +36,10 @@ groups() ->
         [ t_set_new
         , t_set_existing
         , t_pop
+        , t_fold
+        , t_dictionary_specs
         ],
-    Properties = [],
+    Properties = [parallel],
     [{?DICT_MODULE_KV_LIST, Properties, Tests}].
 
 init_per_group(DictModule, Cfg) ->
@@ -77,3 +83,13 @@ t_pop(Cfg) ->
     {{some, 3} , Dict6} = DictModule:pop(Dict5, c),
     {none      , Dict7} = DictModule:pop(Dict6, c),
     [] = DictModule:to_kv_list(Dict7).
+
+t_fold(Cfg) ->
+    {some, DictModule} = hope_kv_list:get(Cfg, ?DICT_MODULE),
+    KVList = [{a, 1}, {a, 5}, {b, 3}, {c, 4}, {c, 4}],
+    Dict = DictModule:of_kv_list(KVList),
+    17 = DictModule:fold(Dict, fun (_K, V, Acc) -> V + Acc end, 0).
+
+t_dictionary_specs(Cfg) ->
+    {some, DictModule} = hope_kv_list:get(Cfg, ?DICT_MODULE),
+    [] = proper:check_specs(DictModule).
This page took 0.0242 seconds and 4 git commands to generate.