21222324252627
public static final int TEST_ITERATIONS = 2; // default is 5, but this can be annoying for dev public static Model world; @BeforeClass public static void testSetup() { world = new Model(new Camera(new Vector3(0f, 0f, 0f), 0f, 0f, 0f, false)); }
262728293031323334
world = new Model(new Camera(new Vector3(0f, 0f, 0f), 0f, 0f, 0f, false)); } @Test public void getBlock() { Block block = world.chunks.getBlock(new Vector3(0.5f, 0.5f, 0.5f)); assertEquals(true, new Vector3(0f, 0f, 0f).equals(block.a)); }
333435363738394041
assertEquals(true, new Vector3(0f, 0f, 0f).equals(block.a)); } @Test public void getBlockNegative() { Block block = world.chunks.getBlock(new Vector3(-0.5f, 0.5f, -0.5f)); assertEquals(true, new Vector3(-1f, 0f, -1f).equals(block.a)); }
404142434445464748
assertEquals(true, new Vector3(-1f, 0f, -1f).equals(block.a)); } @Test public void getBlockOrigin() { Block block = world.chunks.getBlock(new Vector3(0f, 0f, 0f)); assertEquals(true, new Vector3(0f, 0f, 0f).equals(block.a)); }
47484950515253
assertEquals(true, new Vector3(0f, 0f, 0f).equals(block.a)); } @Test(expected=IllegalArgumentException.class) public void getBlockHigh() { world.chunks.getBlock(new Vector3(0f, 100000f, 0f)); }
52535455565758
world.chunks.getBlock(new Vector3(0f, 100000f, 0f)); } @Test(expected=IllegalArgumentException.class) public void getBlockLow() { world.chunks.getBlock(new Vector3(0f, -1000000f, 0f)); }
57585960616263
world.chunks.getBlock(new Vector3(0f, -1000000f, 0f)); } @Test(expected=IllegalArgumentException.class) public void setBlockHigh() { world.chunks.setBlock(new Block(new Vector3(0f, 100000f, 0f), 1f, null)); }
62636465666768
world.chunks.setBlock(new Block(new Vector3(0f, 100000f, 0f), 1f, null)); } @Test(expected=IllegalArgumentException.class) public void setBlockLow() { world.chunks.setBlock(new Block(new Vector3(0f, -1000000f, 0f), 1f, null)); }
67686970717273
world.chunks.setBlock(new Block(new Vector3(0f, -1000000f, 0f), 1f, null)); } @Test(expected=IllegalArgumentException.class) public void setBlockFloat() { world.chunks.setBlock(new Block(new Vector3(0f, 0.1f, 0f), 1f, null)); }
129130131132133134135
assertEquals(expected, results.size()); } @Test public void inBoundsBelow() { assertEquals(false, world.chunks.inBounds(new Vector3(0f, -1f, 0f))); }