test getAll for empty palette

This commit is contained in:
themode 2022-01-04 03:57:54 +01:00 committed by TheMode
parent 1556bf8586
commit 703255e786

View File

@ -139,6 +139,14 @@ public class PaletteTest {
var palettes = testPalettes();
for (Palette palette : palettes) {
AtomicInteger count = new AtomicInteger();
// Ensure that the lambda is called for every entry
// even if the array is initialized
palette.getAll((x, y, z, value) -> count.getAndIncrement());
assertEquals(count.get(), palette.maxSize());
// Fill all entries
count.set(0);
palette.setAll((x, y, z) -> {
count.getAndIncrement();
return x + y + z + 1;