public void testMinMaxOnFloatArrayPartition() {
float min = Float.MAX_VALUE;
float max = Float.MIN_VALUE;
// Normal case
FloatArrayPartition p = new StaticFloatArrayPartition(rand.nextInt(1000), 1000);
for(int i = p.getIndexStart(), end = p.getIndexEnd(); i < end; i++) {
float val = rand.nextFloat();
if(val > max) max = val;
if(val < min) min = val;
p.set(i, val);
}
assertEquals(max, Stores.max(p));
assertEquals(min, Stores.min(p));
// Corner cases
p = null;
assertEquals(0f, Stores.max(p));
assertEquals(0f, Stores.min(p));
p = new StaticFloatArrayPartition(rand.nextInt(1000), 0);
assertEquals(0f, Stores.max(p));
assertEquals(0f, Stores.min(p));
}