From 39273fbe5d3bb9501b22e98d313a72d9fb4ea2ea Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Tue, 12 Aug 2014 14:26:09 -0400 Subject: [PATCH] Add tests for hope_kv_list:set/3 --- test/hope_kv_list_SUITE.erl | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/test/hope_kv_list_SUITE.erl b/test/hope_kv_list_SUITE.erl index 65d4d1f..98c5489 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 ]). @@ -24,7 +25,8 @@ all() -> groups() -> Tests = - [ + [ t_set_new + , t_set_existing ], Properties = [], [{?GROUP_KV_LIST, Properties, Tests}]. @@ -33,3 +35,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. -- 2.20.1