X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=test%2Fhope_kv_list_SUITE.erl;h=d99e6696126452d48fd097c82b5cfc3af0775e2b;hb=37c6e98b7b4b018972e0e6bdc557b266277fe353;hp=65d4d1f0acfe09a121bdd79e516d967b7660248d;hpb=56b05e819f4531cdd2f32fa1054c9297436877b4;p=hope.git diff --git a/test/hope_kv_list_SUITE.erl b/test/hope_kv_list_SUITE.erl index 65d4d1f..d99e669 100644 --- a/test/hope_kv_list_SUITE.erl +++ b/test/hope_kv_list_SUITE.erl @@ -8,7 +8,8 @@ %% Test cases -export( - [ + [ t_set_new/1 + , t_set_existing/1 ]). @@ -19,12 +20,16 @@ %% Common Test callbacks %% ============================================================================ +%% TODO: Make tests generic for any dictionary. +%% TODO: Each group shold test a type of dictionary against the generic cases. + all() -> [{group, ?GROUP_KV_LIST}]. groups() -> Tests = - [ + [ t_set_new + , t_set_existing ], Properties = [], [{?GROUP_KV_LIST, Properties, Tests}]. @@ -33,3 +38,20 @@ groups() -> %% ============================================================================= %% Test cases %% ============================================================================= + +t_set_new(_Config) -> + Key = key, + ValExpected = bar, + ListInitial = hope_kv_list:empty(), + ListResulting = hope_kv_list:set(ListInitial, Key, ValExpected), + {some, ValResulting} = hope_kv_list:get(ListResulting, Key), + ValResulting = ValExpected. + +t_set_existing(_Config) -> + Key = key, + ValInitial = foo, + ValExpected = bar, + ListInitial = [{donald, duck}, {Key, ValInitial}], + ListResulting = hope_kv_list:set(ListInitial, Key, ValExpected), + {some, ValResulting} = hope_kv_list:get(ListResulting, Key), + ValResulting = ValExpected.