X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=test%2Fhope_dictionary_SUITE.erl;h=04e40d315ef1041688283bdba53b2d8e3f819c64;hb=e0fbc1da088f6d4a87c06c80ad40e2d40339b12a;hp=914ae48d0aa6f147a2581c59fae1ab27abfddc7a;hpb=1a88315ae2eed19bef5d0a8d57bd2eb3a51f788a;p=hope.git diff --git a/test/hope_dictionary_SUITE.erl b/test/hope_dictionary_SUITE.erl index 914ae48..04e40d3 100644 --- a/test/hope_dictionary_SUITE.erl +++ b/test/hope_dictionary_SUITE.erl @@ -1,7 +1,5 @@ -module(hope_dictionary_SUITE). --include_lib("proper/include/proper.hrl"). - %% Callbacks -export( [ all/0 @@ -14,6 +12,7 @@ -export( [ t_set_new/1 , t_set_existing/1 + , t_get/1 , t_pop/1 , t_fold/1 , t_dictionary_specs/1 @@ -35,6 +34,7 @@ groups() -> Tests = [ t_set_new , t_set_existing + , t_get , t_pop , t_fold , t_dictionary_specs @@ -53,6 +53,20 @@ end_per_group(_DictModule, _Cfg) -> %% Test cases %% ============================================================================= +t_get(Cfg) -> + {some, DictModule} = hope_kv_list:get(Cfg, ?DICT_MODULE), + K1 = k1, + K2 = k2, + V1 = v1, + V2 = v2, + D = DictModule:set(DictModule:empty(), K1, V1), + {some, V1} = DictModule:get(D, K1), + V1 = DictModule:get(D, K1, V2), + none = DictModule:get(D, K2), + V2 = DictModule:get(D, K2, V2), + default = DictModule:get(D, K1, default, fun (X) -> X =:= foo end), + V1 = DictModule:get(D, K1, default, fun (X) -> X =:= V1 end). + t_set_new(Cfg) -> {some, DictModule} = hope_kv_list:get(Cfg, ?DICT_MODULE), Key = key,