Add further skiplist test

This commit is contained in:
martinsumner 2016-11-26 12:51:58 +00:00
parent fe080895fd
commit 2fdf70ddf6

View file

@ -347,6 +347,21 @@ skiplist_timingtest(KL, SkipList) ->
[timer:now_diff(os:timestamp(), SWg)]), [timer:now_diff(os:timestamp(), SWg)]),
?assertMatch(KL, FlatList). ?assertMatch(KL, FlatList).
define_kv(X) ->
{{o, "Bucket", "Key" ++ X, null}, {X, {active, infinity}, null}}.
skiplist_roundsize_test() ->
KVL = lists:map(fun(X) -> define_kv(X) end, lists:seq(1, 800)),
SkipList = from_list(KVL),
lists:foreach(fun({K, V}) ->
?assertMatch({value, V}, lookup(K, SkipList)) end,
KVL),
lists:foreach(fun(X) -> R = to_range(SkipList,
define_kv(X * 32 + 1),
define_kv((X + 1) * 32)),
L = lists:sublist(KVL, X * 32 + 1, 32),
?assertMatch(L, R) end,
lists:seq(0, 24)).
-endif. -endif.