}
public void testSpliceSegmentsIntoSegmentPush() {
ArrayList<PostingNode> nodes = new ArrayList<PostingNode>();
PostingNode node3 = new PostingNode(3, new ArrayBytes(new byte[]{53}));
nodes.add(node3);
node3.setIdxPos(333);
ArrayList<PostingNode> subnodes1 = new ArrayList<PostingNode>();
PostingNode node5 = new PostingNode(5, new ArrayBytes(new byte[]{53}));
node5.setIdxPos(555);
subnodes1.add(node5);
PostingNode node6 = new PostingNode(6, new ArrayBytes(new byte[]{53}));
subnodes1.add(node6);
SegmentPush sub1 = new SegmentPush(subnodes1);
PostingNode node7 = new PostingNode(sub1, 7, new ArrayBytes(new byte[]{57}));
nodes.add(node7);
PostingNode node9 = new PostingNode(null, 9, new ArrayBytes(new byte[]{59}));
nodes.add(node9);
SegmentPush push = new SegmentPush(nodes);
SegmentPush o;
List<EditRec> edits = new ArrayList<EditRec>();
// edits.add(new EditRec(1, new ArrayBytes(new byte[]{11}), false));
// o = BlueSteelBagIndex.spliceEditsIntoSegmentPush(edits, push);
// assertEquals(6, o.getCount());
// Iterator<PostingNode> i = o.iterator();
// assertTrue(i.hasNext());
// assertEquals(1, i.next().getDocId());
// assertTrue(i.hasNext());
// PostingNode n = i.next();
// assertEquals(9, n.getDocId());
// assertEquals(333, n.getPush().getIdxPos());
edits = new ArrayList<EditRec>();
edits.add(new EditRec(2, new ArrayBytes(new byte[]{0}), false));
o = BlueSteelBagIndex.spliceEditsIntoSegmentPush(edits, push);
compareSegments(o, new long[]{2,3,5,6,7,9});
edits = new ArrayList<EditRec>();
edits.add(new EditRec(9, new ArrayBytes(new byte[]{127}), false));
o = BlueSteelBagIndex.spliceEditsIntoSegmentPush(edits, push);
compareSegments(o, new long[]{3,5,6,7,9,9});
edits = new ArrayList<EditRec>();
edits.add(new EditRec(7, new ArrayBytes(new byte[]{0}), false));
o = BlueSteelBagIndex.spliceEditsIntoSegmentPush(edits, push);
compareSegments(o, new long[]{3,5,6,7,7,9});
edits = new ArrayList<EditRec>();
edits.add(new EditRec(3, new ArrayBytes(new byte[]{127}), false));
o = BlueSteelBagIndex.spliceEditsIntoSegmentPush(edits, push);
compareSegments(o, new long[]{3,3,5,6,7,9});
edits = new ArrayList<EditRec>();
edits.add(new EditRec(5, new ArrayBytes(new byte[]{127}), false));
o = BlueSteelBagIndex.spliceEditsIntoSegmentPush(edits, push);
compareSegments(o, new long[]{3,5,5,6,7,9});
edits = new ArrayList<EditRec>();
edits.add(new EditRec(6, new ArrayBytes(new byte[]{127}), false));
o = BlueSteelBagIndex.spliceEditsIntoSegmentPush(edits, push);
compareSegments(o, new long[]{3,5,6,6,7,9});
edits = new ArrayList<EditRec>();
edits.add(new EditRec(8, new ArrayBytes(new byte[]{127}), false));
o = BlueSteelBagIndex.spliceEditsIntoSegmentPush(edits, push);
compareSegments(o, new long[]{3,5,6,7,8,9});
edits = new ArrayList<EditRec>();
edits.add(makeEdit(node3, true));
o = BlueSteelBagIndex.spliceEditsIntoSegmentPush(edits, push);
compareSegments(o, new long[]{5,6,7,9});
edits = new ArrayList<EditRec>();
edits.add(makeEdit(node5, true));
o = BlueSteelBagIndex.spliceEditsIntoSegmentPush(edits, push);
compareSegments(o, new long[]{3,6,7,9});
edits = new ArrayList<EditRec>();
edits.add(makeEdit(node6, true));
o = BlueSteelBagIndex.spliceEditsIntoSegmentPush(edits, push);
compareSegments(o, new long[]{3,5,7,9});
edits = new ArrayList<EditRec>();
edits.add(makeEdit(node7, true));
o = BlueSteelBagIndex.spliceEditsIntoSegmentPush(edits, push);
compareSegments(o, new long[]{3,5,6,9});
edits = new ArrayList<EditRec>();
edits.add(makeEdit(node9, true));
o = BlueSteelBagIndex.spliceEditsIntoSegmentPush(edits, push);
compareSegments(o, new long[]{3,5,6,7});
edits = new ArrayList<EditRec>();
edits.add(new EditRec(2, new ArrayBytes(new byte[]{0}), false));
edits.add(makeEdit(node3, true));
o = BlueSteelBagIndex.spliceEditsIntoSegmentPush(edits, push);
compareSegments(o, new long[]{2,5,6,7,9});
edits = new ArrayList<EditRec>();
edits.add(makeEdit(node3, true));
edits.add(new EditRec(4, new ArrayBytes(new byte[]{0}), false));
o = BlueSteelBagIndex.spliceEditsIntoSegmentPush(edits, push);
compareSegments(o, new long[]{4,5,6,7,9});
edits = new ArrayList<EditRec>();
edits.add(new EditRec(7, new ArrayBytes(new byte[]{0}), false));
edits.add(makeEdit(node7, true));
o = BlueSteelBagIndex.spliceEditsIntoSegmentPush(edits, push);
compareSegments(o, new long[]{3,5,6,7,9});
edits = new ArrayList<EditRec>();
edits.add(makeEdit(node9, true));
edits.add(new EditRec(10, new ArrayBytes(new byte[]{0}), false));
o = BlueSteelBagIndex.spliceEditsIntoSegmentPush(edits, push);
compareSegments(o, new long[]{3,5,6,7,10});
edits = new ArrayList<EditRec>();
edits.add(new EditRec(8, new ArrayBytes(new byte[]{0}), false));
edits.add(makeEdit(node9, true));
o = BlueSteelBagIndex.spliceEditsIntoSegmentPush(edits, push);
compareSegments(o, new long[]{3,5,6,7,8});
edits = new ArrayList<EditRec>();