1 -module(hope_kv_list_SUITE).
11 [ t_validate_unique_presence/1
15 -define(GROUP , hope_kv_list).
18 %% ============================================================================
19 %% Common Test callbacks
20 %% ============================================================================
27 [ t_validate_unique_presence
30 [{?GROUP, Properties, Tests}].
33 %% =============================================================================
35 %% =============================================================================
37 t_validate_unique_presence(_Cfg) ->
38 KeysRequired = [a, b, c],
39 DictOk = [{a, 1}, {b, 2}, {c, 3}],
40 DictUnsup = [{a, 1}, {b, 2}, {c, 3}, {d, 4}],
41 DictDups = [{a, 1}, {b, 2}, {c, 3}, {a, 4}],
42 DictMissing = [{a, 1}, {b, 2}],
44 hope_kv_list:validate_unique_presence(DictOk, KeysRequired),
45 {error, [{keys_unsupported, [d]}]} =
46 hope_kv_list:validate_unique_presence(DictUnsup, KeysRequired),
47 {error, [{keys_duplicated, [a]}]} =
48 hope_kv_list:validate_unique_presence(DictDups, KeysRequired),
49 {error, [{keys_missing, [c]}]} =
50 hope_kv_list:validate_unique_presence(DictMissing, KeysRequired).