//printf("Pkey %llu/%llu %llu %llu %llu\n", (unsigned long long)2*i+1, (unsigned long long)2*limit, (unsigned long long)less, (unsigned long long)equal, (unsigned long long)greater);
// It's an estimate, and it the values don't even change monotonically.
// And all the leaves are in main memory so it's always present.
if(ms!=CLOSE_AND_REOPEN_LEAVE_ON_DISK){
assert(equal==1);
// The first few items are exact for less.
if(i<70){
assert(less==i);
}
// The last few items are exact for greater.
if(limit-i<70){
assert(greater==limit-i-1);
}
}else{
// If we closed it, it's not in main memory, and so the less and greater estimates are wrong, and we set equal to 0.
assert(equal==0);
if(i<10){
assert(less==0);
}
if(limit-i<10){
assert(greater==0);
}
}
// Count the number of times that prev_less is 1 less than less.
if(prev_less+1==less){
count_less_adjacent++;
}
if(prev_greater-1==greater){
count_greater_adjacent++;
}
// the best we can do: It's an estimate. At least in the current implementation for this test (which has small rows)
// the estimate grows monotonically as the leaf grows.
prev_less=less;
prev_greater=greater;
}
if(ms!=CLOSE_AND_REOPEN_LEAVE_ON_DISK){
// If we were doing the in-memory case then most keys are adjacent.
assert(count_less_adjacent>=0.9*limit);// we expect at least 90% to be right.
assert(count_greater_adjacent>=0.9*limit);// we expect at least 90% to be right.
//printf("Akey %llu/%llu %llu %llu %llu\n", (unsigned long long)2*i, (unsigned long long)2*limit, (unsigned long long)less, (unsigned long long)equal, (unsigned long long)greater);