overhaul betterblockpostest

This commit is contained in:
Leijurv 2018-09-24 15:58:02 -07:00
parent 239a95961e
commit 76f287582e
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
1 changed files with 27 additions and 2 deletions

View File

@ -17,14 +17,16 @@
package baritone.utils.pathing;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
public class BetterBlockPosTest {
@Test
// disabled since this is a benchmark, not really a test. also including it makes the tests take 50 seconds for no reason
/*@Test
public void benchMulti() {
System.out.println("Benching up()");
for (int i = 0; i < 10; i++) {
@ -37,7 +39,30 @@ public class BetterBlockPosTest {
benchN();
assertTrue(i<10);
}
}*/
/**
* Make sure BetterBlockPos behaves just like BlockPos
*/
@Test
public void testSimple() {
BlockPos pos = new BlockPos(1, 2, 3);
BetterBlockPos better = new BetterBlockPos(1, 2, 3);
assertEquals(pos, better);
assertEquals(pos.up(), better.up());
assertEquals(pos.down(), better.down());
assertEquals(pos.north(), better.north());
assertEquals(pos.south(), better.south());
assertEquals(pos.east(), better.east());
assertEquals(pos.west(), better.west());
for (EnumFacing dir : EnumFacing.values()) {
assertEquals(pos.offset(dir), better.offset(dir));
assertEquals(pos.offset(dir, 0), pos);
assertEquals(better.offset(dir, 0), better);
for (int i = -10; i < 10; i++) {
assertEquals(pos.offset(dir, i), better.offset(dir, i));
}
}
}
public void benchOne() {