_testIteration(new SeqnoList(8).add(3).add(5, 5).add(7), Arrays.asList(3L,5L,7L));
}
public void testSerialization() throws Exception {
SeqnoList list=new SeqnoList(1000).add(1, 10, 50)
.add(100,150).add(152,153).add(200,205).add(300,304,306).add(400,450).add(500);
for(int i=502; i < 550; i+=2)
list.add(i);
System.out.println("list.size()=" + list.size() + "\nlist = " + list);
int expected_size=list.serializedSize();
byte[] buf=Util.streamableToByteBuffer(list);
SeqnoList list2=(SeqnoList)Util.streamableFromByteBuffer(SeqnoList.class,buf);
System.out.println("list2.size()=" + list2.size() + "\nlist2 = " + list2);
assert list.size() == list2.size();
System.out.println("expected size=" + expected_size + ", buf size=" + buf.length);
assert buf.length == expected_size;
Iterator<Long> it1=list.iterator(), it2=list2.iterator();
while(it1.hasNext()) {
long seq1=it1.next(), seq2=it2.next();
assert seq1 == seq2;
}
}