int srcPos = rnd.nextInt(len + 1) / blockSize * blockSize;
int count = rnd.nextInt(len + 1 - srcPos) / blockSize * blockSize;
PArray pa = (PArray) (a.subArr(srcPos, count));
Arrays.MinMaxInfo info = new Arrays.MinMaxInfo();
int numberOfTasks = DefaultThreadPoolFactory.getDefaultThreadPoolFactory().recommendedNumberOfTasks(pa);
Range range = Arrays.rangeOf(pa, info);
if (count > 0) {
for (int k = 0; k < info.indexOfMin(); k++)
if (numberOfTasks <= 1 ? pa.getDouble(k) <= range.min()
: pa.getDouble(k) < range.min())
throw new AssertionError("The bug A in rangeOf found in test #" + testCount + ": "
+ "srcPos = " + srcPos + ", count = " + count + ", " + info
+ ", pa.getDouble(" + k + ") = " + pa.getDouble(k));
if (pa.getDouble(info.indexOfMin()) != range.min())
throw new AssertionError("The bug B in rangeOf found in test #" + testCount + ": "
+ "srcPos = " + srcPos + ", count = " + count + ", " + info);
for (int k = (int) info.indexOfMin() + 1; k < count; k++)
if (pa.getDouble(k) < range.min())
throw new AssertionError("The bug C in rangeOf found in test #" + testCount + ": "
+ "srcPos = " + srcPos + ", count = " + count + ", " + info);
for (int k = 0; k < info.indexOfMax(); k++)
if (numberOfTasks <= 1 ? pa.getDouble(k) >= range.max()
: pa.getDouble(k) > range.max())
throw new AssertionError("The bug D in rangeOf found in test #" + testCount + ": "
+ "srcPos = " + srcPos + ", count = " + count + ", " + info
+ ", pa.getDouble(" + k + ") = " + pa.getDouble(k));
if (pa.getDouble(info.indexOfMax()) != range.max())
throw new AssertionError("The bug E in rangeOf found in test #" + testCount + ": "
+ "srcPos = " + srcPos + ", count = " + count + ", " + info);
for (int k = (int) info.indexOfMax() + 1; k < count; k++)
if (pa.getDouble(k) > range.max())
throw new AssertionError("The bug F in rangeOf found in test #" + testCount + ": "
+ "srcPos = " + srcPos + ", count = " + count + ", " + info);
}
showProgress(testCount, numberOfTests);
}