anchor.diff:      ?debugVal(ResultPos1),
       {ok, Lookup1} = vtree:lookup(Fd, ResultPos1, {0,0,1001,1001}),
       ?assertEqual(37, length(Lookup1)),
  +
  +    % Test 3.2: input tree is too small (2 levels)
  +    TargetTreeNodeNum2 = 80,
  +    % NOTE vmx: wonder why this tree is not really dense
  +    {ok, {Fd2, {RootPos2, TargetTreeHeight2}}} = vtree_test:build_random_tree(
  +            "/tmp/seedtree_write.bin", TargetTreeNodeNum2),
  +    ?debugVal(TargetTreeHeight2),
  +    ?debugVal(RootPos2),
  +
  +    % Test 3.2: input tree is too small (2 levels)
  +    Nodes2 = lists:foldl(fun(I, Acc) ->
  +        {NodeId, {NodeMbr, NodeMeta, NodeData}} =
  +            vtree_test:random_node({I,27+I*329,45}),
  +        Node = {NodeMbr, NodeMeta, {[NodeId, <<"bulk">>], NodeData}},
  +        [Node|Acc]
  +    end, [], lists:seq(1,12)),
  +
  +    Seedtree2_1 = seedtree_init(Fd2, RootPos2, 1),
  +    ?debugVal(Seedtree2_1),
  +    Seedtree2_2 = seedtree_insert_list(Seedtree2_1, Nodes2),
  +    {ok, ResultPos2_1} = seedtree_write(Fd2, Seedtree2_2, TargetTreeHeight2),
  +    ?debugVal(ResultPos2_1),
  +    {ok, Lookup2_1} = vtree:lookup(Fd2, ResultPos2_1, {0,0,1001,1001}),
  +    ?assertEqual(92, length(Lookup2_1)),
   ok.
   
   % @doc Loads nodes from file
  
positive.code: %                            {Mbr, #node{type=leaf}, Leafs}),
  %        {ok, [{Mbr, Pos}|Acc]};
      {leaf_nodes, MbrAndPos} ->
          {ok, [MbrAndPos|Acc]};
      {level_done, Level} ->
          % NOTE vmx: reversing Level is probably not neccessary
          {Mbrs, Children} = lists:unzip(lists:reverse(Level)),
          Mbr = vtree:calc_mbr(Mbrs),
          {ok, Pos} = couch_file:append_term(Fd,
                              {Mbr, #node{type=inner}, Children}),
          {ok, [{Mbr, Pos}|Acc]}
      end,
      {_, Acc3} = omt_write_tree(Fd, T, Depth, Acc2),
  
negative.code:     % Return new nodes (might be several ones)
      NewChildrenMbrAndPos.
  
  
  % XXX vmx: rename to _test when it should be run again
  seedtree_write_single() ->
      % insert single new node
      TargetTreeNodeNum = 7,
      {ok, {Fd, {RootPos, TargetTreeHeight}}} = vtree_test:build_random_tree(
              "/tmp/seedtree_write.bin", TargetTreeNodeNum),
  
      ?debugVal(RootPos),
      Nodes1 = lists:foldl(fun(I, Acc) ->
          {NodeId, {NodeMbr, NodeMeta, NodeData}} =
              vtree_test:random_node({I,27+I*329,45}),
          Node = {NodeMbr, NodeMeta, {[NodeId, <<"bulk">>], NodeData}},
          [Node|Acc]
      end, [], lists:seq(1,1)),
  
      Seedtree1 = seedtree_init(Fd, RootPos, 1),
      ?debugVal(Seedtree1),
      Seedtree2 = seedtree_insert_list(Seedtree1, Nodes1),
      %?debugVal(Seedtree2),
      {ok, ResultPos1} = seedtree_write(Fd, Seedtree2, TargetTreeHeight),
      ?debugVal(ResultPos1),
      {ok, Lookup1} = vtree:lookup(Fd, ResultPos1, {0,0,1001,1001}),
      ?assertEqual(8, length(Lookup1)).
  
  
  % XXX vmx: rename to _test when it should be run again
  seedtree_write_case1() ->
      % Test "Case 1: input R-tree fits in the target node" (chapter 6.1)
  