From 58ad7ad6c330bf65b89e0f5e4a790d14510d3ce7 Mon Sep 17 00:00:00 2001 From: Paul Joseph Davis Date: Thu, 11 Jun 2009 01:59:56 +0000 Subject: Integrating more ETAP tests from Bob Dionne. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@783600 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_key_tree.erl | 84 +----------------------------------------- 1 file changed, 1 insertion(+), 83 deletions(-) (limited to 'src/couchdb/couch_key_tree.erl') diff --git a/src/couchdb/couch_key_tree.erl b/src/couchdb/couch_key_tree.erl index 7c6a2dc1..bb11ad54 100644 --- a/src/couchdb/couch_key_tree.erl +++ b/src/couchdb/couch_key_tree.erl @@ -322,87 +322,5 @@ stem(Trees, Limit) -> NewTrees end, [], Paths2). -test() -> - EmptyTree = [], - One = [{0, {"1","foo",[]}}], - TwoSibs = [{0, {"1","foo",[]}}, - {0, {"2","foo",[]}}], - OneChild = [{0, {"1","foo",[{"1a", "bar", []}]}}], - TwoChild = [{0, {"1","foo", [{"1a", "bar", [{"1aa", "bar", []}]}]}}], - TwoChildSibs = [{0, {"1","foo", [{"1a", "bar", []}, - {"1b", "bar", []}]}}], - TwoChildSibs2 = [{0, {"1","foo", [{"1a", "bar", []}, - {"1b", "bar", [{"1bb", "boo", []}]}]}}], - Stemmed1b = [{1, {"1a", "bar", []}}], - Stemmed1a = [{1, {"1a", "bar", [{"1aa", "bar", []}]}}], - Stemmed1aa = [{2, {"1aa", "bar", []}}], - Stemmed1bb = [{2, {"1bb", "boo", []}}], - - {EmptyTree, no_conflicts} = merge(EmptyTree, EmptyTree), - {One, no_conflicts} = merge(EmptyTree, One), - {One, no_conflicts} = merge(One, EmptyTree), - {TwoSibs, no_conflicts} = merge(One, TwoSibs), - {One, no_conflicts} = merge(One, One), - {TwoChild, no_conflicts} = merge(TwoChild, TwoChild), - {TwoChildSibs, no_conflicts} = merge(TwoChildSibs, TwoChildSibs), - {TwoChildSibs, no_conflicts} = merge(TwoChildSibs, Stemmed1b), - {TwoChildSibs, no_conflicts} = merge(Stemmed1b, TwoChildSibs), - {TwoChildSibs2, no_conflicts} = merge(TwoChildSibs2, Stemmed1bb), - {TwoChildSibs2, no_conflicts} = merge(Stemmed1bb, TwoChildSibs2), - {TwoChild, no_conflicts} = merge(TwoChild, Stemmed1aa), - {TwoChild, no_conflicts} = merge(TwoChild, Stemmed1a), - {Stemmed1a, no_conflicts} = merge(Stemmed1a, Stemmed1aa), - Expect1 = OneChild ++ Stemmed1aa, - {Expect1, conflicts} = merge(OneChild, Stemmed1aa), - {TwoChild, no_conflicts} = merge(Expect1, TwoChild), - - []=find_missing(TwoChildSibs, [{0,"1"}, {1,"1a"}]), - [{0, "10"}, {100, "x"}]=find_missing(TwoChildSibs, [{0,"1"}, {0, "10"}, {1,"1a"}, {100, "x"}]), - [{0, "1"}, {100, "x"}]=find_missing(Stemmed1a, [{0,"1"}, {1,"1a"}, {100, "x"}]), - [{0, "1"}, {1,"1a"}, {100, "x"}]=find_missing(Stemmed1aa, [{0,"1"}, {1,"1a"}, {100, "x"}]), - - {TwoChildSibs, []} = remove_leafs(TwoChildSibs, []), - {TwoChildSibs, []} = remove_leafs(TwoChildSibs, [{0, "1"}]), - {OneChild, [{1, "1b"}]} = remove_leafs(TwoChildSibs, [{1, "1b"}]), - {[], [{1, "1b"},{1, "1a"}]} = remove_leafs(TwoChildSibs, [{1, "1a"}, {1, "1b"}]), - {Stemmed1a, []} = remove_leafs(Stemmed1a, [{1, "1a"}]), - {[], [{2, "1aa"}]} = remove_leafs(Stemmed1a, [{2, "1aa"}]), - {TwoChildSibs, []} = remove_leafs(TwoChildSibs, []), - - {[],[{0,"x"}]} = get_key_leafs(TwoChildSibs, [{0, "x"}]), - - {[{"bar", {1, ["1a","1"]}}],[]} = get_key_leafs(TwoChildSibs, [{1, "1a"}]), - {[{"bar", {1, ["1a","1"]}},{"bar",{1, ["1b","1"]}}],[]} = get_key_leafs(TwoChildSibs, [{0, "1"}]), - - {[{"foo", {0, ["1"]}}],[]} = get(TwoChildSibs, [{0, "1"}]), - {[{"bar", {1, ["1a", "1"]}}],[]} = get(TwoChildSibs, [{1, "1a"}]), +% Tests moved to test/etap/06?-*.t - {[{0,[{"1", "foo"}]}],[]} = get_full_key_paths(TwoChildSibs, [{0, "1"}]), - {[{1,[{"1a", "bar"},{"1", "foo"}]}],[]} = get_full_key_paths(TwoChildSibs, [{1, "1a"}]), - - [{2, [{"1aa", "bar"},{"1a", "bar"}]}] = get_all_leafs_full(Stemmed1a), - [{1, [{"1a", "bar"},{"1", "foo"}]}, {1, [{"1b", "bar"},{"1", "foo"}]}] = get_all_leafs_full(TwoChildSibs), - - [{"bar", {2, ["1aa","1a"]}}] = get_all_leafs(Stemmed1a), - [{"bar", {1, ["1a", "1"]}}, {"bar", {1, ["1b","1"]}}] = get_all_leafs(TwoChildSibs), - - 0 = count_leafs(EmptyTree), - 1 = count_leafs(One), - 2 = count_leafs(TwoChildSibs), - 1 = count_leafs(Stemmed1a), - - TwoChild = stem(TwoChild, 3), - Stemmed1a = stem(TwoChild, 2), - Stemmed1aa = stem(TwoChild, 1), - ok. - - - - - - - - - - - \ No newline at end of file -- cgit v1.2.3