1 -module(hope_kv_list_SUITE).
17 -define(GROUP_KV_LIST, kv_list).
20 %% ============================================================================
21 %% Common Test callbacks
22 %% ============================================================================
24 %% TODO: Make tests generic for any dictionary.
25 %% TODO: Each group should test a type of dictionary against the generic cases.
28 [{group, ?GROUP_KV_LIST}].
37 [{?GROUP_KV_LIST, Properties, Tests}].
40 %% =============================================================================
42 %% =============================================================================
47 ListInitial = hope_kv_list:empty(),
48 ListResulting = hope_kv_list:set(ListInitial, Key, ValExpected),
49 {some, ValResulting} = hope_kv_list:get(ListResulting, Key),
50 ValResulting = ValExpected.
52 t_set_existing(_Config) ->
56 ListInitial = [{donald, duck}, {Key, ValInitial}],
57 ListResulting = hope_kv_list:set(ListInitial, Key, ValExpected),
58 {some, ValResulting} = hope_kv_list:get(ListResulting, Key),
59 ValResulting = ValExpected.
62 KVList = [{a, 1}, {b, 2}, {c, 3}],
63 Dict1 = hope_kv_list:of_kv_list(KVList),
64 {{some, 1} , Dict2} = hope_kv_list:pop(Dict1, a),
65 {none , Dict3} = hope_kv_list:pop(Dict2, a),
66 {{some, 2} , Dict4} = hope_kv_list:pop(Dict3, b),
67 {none , Dict5} = hope_kv_list:pop(Dict4, b),
68 {{some, 3} , Dict6} = hope_kv_list:pop(Dict5, c),
69 {none , Dict7} = hope_kv_list:pop(Dict6, c),
70 [] = hope_kv_list:to_kv_list(Dict7).