int[] maxNumItems = { 1, 1, 2, 2, 3, 3, 3, 3, 1, 1 };
int[] minNumItems = { 1, 1, 0, 1, 0, 0, 2, 3, 1, 0 };
int[] count = new int[maxId];
BigIntBuffer buffer = new BigIntBuffer();
BufferedLoader loader = null;
BigNestedIntArray nestedArray = new BigNestedIntArray();
Random rand = new Random();
for (int i = 0; i < maxNumItems.length; i++) {
loader = new BufferedLoader(maxId, BigNestedIntArray.MAX_ITEMS, buffer);
for (int id = 0; id < maxId; id++) {
count[id] = 0;
int cnt = Math.max(rand.nextInt(maxNumItems[i] + 1), minNumItems[i]);
for (int val = 0; val < cnt; val++) {
if (loader.add(id, val)) count[id]++;
}
}
nestedArray.load(maxId, loader);
int[] buf = new int[1024];
for (int id = 0; id < maxId; id++) {
int cnt = nestedArray.getData(id, buf);
assertEquals("count[" + i + "," + id + "]", count[id], cnt);
if (cnt > 0) {
for (int val = 0; val < cnt; val++) {
assertEquals("item[" + i + "," + id + "," + val + "]", val, buf[val]);