X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;ds=sidebyside;f=test%2Fhope_dictionary_SUITE.erl;h=cf0bfba6afec5fe9a22249c558eb779acefc5727;hb=61cace5b6adc4e9385cda749448b12c81951eef1;hp=4f355ca0bfc0f78b74e87f38c3dee0ffa26776b9;hpb=870172d69230ad2cf0f409ec009ab3feaa723fee;p=hope.git diff --git a/test/hope_dictionary_SUITE.erl b/test/hope_dictionary_SUITE.erl index 4f355ca..cf0bfba 100644 --- a/test/hope_dictionary_SUITE.erl +++ b/test/hope_dictionary_SUITE.erl @@ -16,6 +16,7 @@ , t_pop/1 , t_fold/1 , t_dictionary_specs/1 + , t_has_key/1 ]). @@ -38,6 +39,7 @@ groups() -> , t_pop , t_fold , t_dictionary_specs + , t_has_key ], Properties = [parallel], [{?DICT_MODULE_KV_LIST, Properties, Tests}]. @@ -63,7 +65,9 @@ t_get(Cfg) -> {some, V1} = DictModule:get(D, K1), V1 = DictModule:get(D, K1, V2), none = DictModule:get(D, K2), - V2 = DictModule:get(D, K2, V2). + 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), @@ -105,3 +109,13 @@ t_fold(Cfg) -> t_dictionary_specs(Cfg) -> {some, DictModule} = hope_kv_list:get(Cfg, ?DICT_MODULE), [] = proper:check_specs(DictModule). + +t_has_key(Cfg) -> + {some, DictModule} = hope_kv_list:get(Cfg, ?DICT_MODULE), + D = DictModule:of_kv_list([{a, 1}, {b, 2}, {c, 3}]), + true = DictModule:has_key(D, a), + true = DictModule:has_key(D, b), + true = DictModule:has_key(D, c), + false = DictModule:has_key(D, d), + false = DictModule:has_key(D, e), + false = DictModule:has_key(D, f).