summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDamien F. Katz <damien@apache.org>2009-09-11 23:23:07 +0000
committerDamien F. Katz <damien@apache.org>2009-09-11 23:23:07 +0000
commit45796298231349dadf650e9ddefd7a6ff32e1302 (patch)
tree4de5543e9584a2c8a91f0b27b5b8f9e43de3fe46 /test
parent773a23353b9101620ebb91183cb67240c17aa2c9 (diff)
Refactoring of endkey code in views and btrees. End key functionaility is now handled inside the btree code, simplfying calling code and making it trivial to add new collation options
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@814078 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rwxr-xr-xtest/etap/020-btree-basics.t14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/etap/020-btree-basics.t b/test/etap/020-btree-basics.t
index 9187b606..90c04075 100755
--- a/test/etap/020-btree-basics.t
+++ b/test/etap/020-btree-basics.t
@@ -59,8 +59,8 @@ test_kvs(KeyValues) ->
Btree1 = couch_btree:set_options(Btree, [{reduce, ReduceFun}]),
etap:is(Btree1#btree.reduce, ReduceFun, "Reduce function was set"),
- EmptyRes = couch_btree:foldl(Btree1, fun(_, X) -> {ok, X+1} end, 0),
- etap:is(EmptyRes, {ok, 0}, "Folding over an empty btree"),
+ {ok, _, EmptyRes} = couch_btree:foldl(Btree1, fun(_, X) -> {ok, X+1} end, 0),
+ etap:is(EmptyRes, 0, "Folding over an empty btree"),
{ok, Btree2} = couch_btree:add_remove(Btree1, KeyValues, []),
etap:ok(test_btree(Btree2, KeyValues),
@@ -151,15 +151,15 @@ test_key_access(Btree, List) ->
end,
Length = length(List),
Sorted = lists:sort(List),
- {ok, {[], Length}} = couch_btree:foldl(Btree, FoldFun, {Sorted, 0}),
- {ok, {[], Length}} = couch_btree:foldr(Btree, FoldFun, {Sorted, 0}),
+ {ok, _, {[], Length}} = couch_btree:foldl(Btree, FoldFun, {Sorted, 0}),
+ {ok, _, {[], Length}} = couch_btree:fold(Btree, FoldFun, {Sorted, 0}, [{dir, rev}]),
ok.
test_lookup_access(Btree, KeyValues) ->
FoldFun = fun({Key, Value}, {Key, Value}) -> {stop, true} end,
lists:foreach(fun({Key, Value}) ->
[{ok, {Key, Value}}] = couch_btree:lookup(Btree, [Key]),
- {ok, true} = couch_btree:foldl(Btree, Key, FoldFun, {Key, Value})
+ {ok, _, true} = couch_btree:foldl(Btree, FoldFun, {Key, Value}, [{start_key, Key}])
end, KeyValues).
test_final_reductions(Btree, KeyValues) ->
@@ -182,8 +182,8 @@ test_final_reductions(Btree, KeyValues) ->
0 -> {nil, nil};
_ -> lists:nth(KVLen div 3, lists:sort(KeyValues))
end,
- {ok, FoldLRed} = couch_btree:foldl(Btree, LStartKey, FoldLFun, 0),
- {ok, FoldRRed} = couch_btree:foldr(Btree, RStartKey, FoldRFun, 0),
+ {ok, _, FoldLRed} = couch_btree:foldl(Btree, FoldLFun, 0, [{start_key, LStartKey}]),
+ {ok, _, FoldRRed} = couch_btree:fold(Btree, FoldRFun, 0, [{dir, rev}, {start_key, RStartKey}]),
KVLen = FoldLRed + FoldRRed,
ok.