Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 2d4ed9bbc6
Fetching contributors…

Cannot retrieve contributors at this time

file 34 lines (27 sloc) 1.262 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
-module(riak_column_tests).

-include_lib("eunit/include/eunit.hrl").


simple_test() ->
    mock_kv:with_mock_store
        (1, <<"buck">>, [], 0,
         fun(Client) ->
                 Column = riak_column:new(Client, <<"buck">>, <<"age">>),
                 Column:add(<<"peter1">>, 1),
                 Column:add(<<"peter2">>, 2),
                 Column:add(<<"peter3">>, 3),
                 Column:add(<<"peter4">>, 4),
                 Column:add(<<"peter5">>, 5),
                 Column:add(<<"peter5">>, 6),
                 Column:add(<<"peter6">>, 6),
                 Column:add(<<"peter7">>, 7),
                 Column:add(<<"peter8">>, 8),
                 Column:add(<<"peter9">>, 9),
                 {ok, {_,[3]}} = Column:lookup(<<"peter3">>),

                 {ok, {VC, [6,5]}} = Column:lookup(<<"peter5">>),
                 ok = Column:put(<<"peter5">>, {VC, [5]}),
                 {ok, {_, [5]}} = Column:lookup(<<"peter5">>),

                 Values = Column:fold(fun({_Key,{_VC,[V]}}, Acc) -> [V|Acc] end, []),
                 [1,2,3,4,5,6,7,8,9] = lists:sort(Values),

                 All = ets:tab2list(Client:content_table()),
                 error_logger:info_msg("Store= ~p", [All]),

                 ok
         end).
Something went wrong with that request. Please try again.