mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-08 03:40:27 +01:00
Ensure that loop order stays the same
This commit is contained in:
parent
703255e786
commit
33e1b4b157
@ -142,23 +142,17 @@ public class PaletteTest {
|
|||||||
|
|
||||||
// Ensure that the lambda is called for every entry
|
// Ensure that the lambda is called for every entry
|
||||||
// even if the array is initialized
|
// 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());
|
assertEquals(count.get(), palette.maxSize());
|
||||||
|
|
||||||
// Fill all entries
|
// Fill all entries
|
||||||
count.set(0);
|
count.set(0);
|
||||||
palette.setAll((x, y, z) -> {
|
palette.setAll((x, y, z) -> count.incrementAndGet());
|
||||||
count.getAndIncrement();
|
|
||||||
return x + y + z + 1;
|
|
||||||
});
|
|
||||||
assertEquals(palette.maxSize(), palette.size());
|
assertEquals(palette.maxSize(), palette.size());
|
||||||
assertEquals(count.get(), palette.size());
|
assertEquals(count.get(), palette.size());
|
||||||
|
|
||||||
count.set(0);
|
count.set(0);
|
||||||
palette.getAll((x, y, z, value) -> {
|
palette.getAll((x, y, z, value) -> assertEquals(count.incrementAndGet(), value));
|
||||||
count.getAndIncrement();
|
|
||||||
assertEquals(x + y + z + 1, value);
|
|
||||||
});
|
|
||||||
assertEquals(count.get(), palette.size());
|
assertEquals(count.get(), palette.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user