assertTrue ("wrong value", list[i] == i * 42);
}
public void testInsert ()
{
PageIndex index;
double d;
int n;
int pos;
int[] list;
index = new PageIndex (null);
for (int i = 0; i < 10000; i++)
{
d = Math.random ();
d -= 0.5;
n = (int)(d * 100838);
pos = index.row (n);
// test for correct position
if (0 <= pos - 1)
assertTrue ("search error less " + pos + " " + index.elementAt (pos - 1) + " " + n, index.elementAt (pos - 1) <= n);
if (pos + 1 < index.size ())
assertTrue ("search error greater " + pos + " " + index.elementAt (pos + 1) + " " + n, index.elementAt (pos + 1) > n);
}
list = index.get ();
n = Integer.MIN_VALUE;
for (int i = 0; i < list.length; i++)
{
assertTrue ("wrong order", list[i] > n);
n = list[i];