X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=test%2Fhope_kv_list_SUITE.erl;h=e0f0747e2c7772862323939020e906da53269cad;hb=a2673523b39fb6fbcc4fe4dce649f8a44c9fb94c;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..e0f0747 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 should 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.