Skip to content

Commit

Permalink
more flexible kvs:test/1
Browse files Browse the repository at this point in the history
  • Loading branch information
5HT committed Aug 30, 2016
1 parent e3646c8 commit de5c250
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/kvs.erl
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,11 @@ setkey(Name,Pos,List,New) ->
false -> [New|List];
_Element -> lists:keyreplace(Name,Pos,List,New) end.

test() ->
test() -> test(#user{}).

test(Proto) ->
kvs:join(),
[ kvs:add(#user{id=kvs:next_id("user",1)}) || _ <- lists:seq(1,20) ],
Table = element(1,Proto),
[ kvs:add(setelement(2,Proto,kvs:next_id(Table,1))) || _ <- lists:seq(1,20) ],
io:format("Config: ~p~n",[kvs:all(config)]),
io:format("Fetch: ~p~n",[kvs:entries(kvs:get(feed,user),user,infinity)]).
io:format("Fetch: ~p~n",[kvs:entries(kvs:get(feed,Table),Table,infinity)]).

0 comments on commit de5c250

Please sign in to comment.