use of net.countercraft.movecraft.util.hitboxes.SetHitBox in project Movecraft by APDevTeam.
the class TreeHitBoxTest method testDoubleAdd.
@Test
public void testDoubleAdd() {
SetHitBox box = new SetHitBox();
assertTrue(box.add(new MovecraftLocation(0, 1, 0)), "first");
assertFalse(box.add(new MovecraftLocation(0, 1, 0)), "second");
assertEquals(1, box.size());
}
use of net.countercraft.movecraft.util.hitboxes.SetHitBox in project Movecraft by APDevTeam.
the class TreeHitBoxTest method testSinglePointIterator.
@Test
public void testSinglePointIterator() {
for (var location : new SolidHitBox(new MovecraftLocation(-3, -3, -3), new MovecraftLocation(3, 3, 3))) {
SetHitBox box = new SetHitBox();
box.add(location);
assertEquals(location, box.iterator().next());
}
}
use of net.countercraft.movecraft.util.hitboxes.SetHitBox in project Movecraft by APDevTeam.
the class TreeHitBoxTest method testRemoveThanIterate.
@Test
public void testRemoveThanIterate() {
SetHitBox hitBox = createTestHitbox();
SetHitBox other = createTestHitbox();
int size = other.size();
for (var location : hitBox) {
other.remove(location);
size -= 1;
assertEquals(size, Iterators.size(other.iterator()));
}
assertTrue(other.isEmpty());
}
use of net.countercraft.movecraft.util.hitboxes.SetHitBox in project Movecraft by APDevTeam.
the class TreeHitBoxTest method testIteratorBitPosition.
@Test
public void testIteratorBitPosition() {
long l = 1;
for (int i = 0; i < 64; i++) {
long shifted = l << i;
MovecraftLocation unpacked = MovecraftLocation.unpack(shifted);
SetHitBox box = new SetHitBox();
box.add(unpacked);
for (var iterLoc : box) {
assertEquals(unpacked, iterLoc);
}
}
}
use of net.countercraft.movecraft.util.hitboxes.SetHitBox in project Movecraft by APDevTeam.
the class TreeHitBoxTest method testRemove.
@Test
public void testRemove() {
SetHitBox hitBox = createTestHitbox();
SetHitBox other = createTestHitbox();
for (var location : hitBox) {
other.remove(location);
}
assertTrue(other.isEmpty());
}
Aggregations