Ensure that loop order stays the same

This commit is contained in:
themode 2022-01-04 05:55:29 +01:00 committed by TheMode
parent 703255e786
commit 33e1b4b157

View File

@ -142,23 +142,17 @@ public class PaletteTest {
// Ensure that the lambda is called for every entry
// even if the array is initialized
palette.getAll((x, y, z, value) -> count.getAndIncrement());
palette.getAll((x, y, z, value) -> count.incrementAndGet());
assertEquals(count.get(), palette.maxSize());
// Fill all entries
count.set(0);
palette.setAll((x, y, z) -> {
count.getAndIncrement();
return x + y + z + 1;
});
palette.setAll((x, y, z) -> count.incrementAndGet());
assertEquals(palette.maxSize(), palette.size());
assertEquals(count.get(), palette.size());
count.set(0);
palette.getAll((x, y, z, value) -> {
count.getAndIncrement();
assertEquals(x + y + z + 1, value);
});
palette.getAll((x, y, z, value) -> assertEquals(count.incrementAndGet(), value));
assertEquals(count.get(), palette.size());
}
}