Skip to content

Instantly share code, notes, and snippets.

@jbclements
Created April 18, 2012 03:18
Show Gist options
  • Save jbclements/2410856 to your computer and use it in GitHub Desktop.
Save jbclements/2410856 to your computer and use it in GitHub Desktop.
shuffled 00
package edu.calpoly.cpe102sp12;
import static org.junit.Assert.*;
import org.junit.Test;
import org.bukkit.Material;
public class Testing
{
RectangularPrism cube1 = new RectangularPrism(5,5,5,5,5,5);
RectangularPrism cube2 = new RectangularPrism(7,7,7,7,7,7);
RectangularPrism cube3 = new RectangularPrism(10,10,10,5,5,5);
RectangularPrism cube4 = new RectangularPrism(7,7,7,9,10,11);
RectangularPrism cube5 = new RectangularPrism(13,13,13,5,5,5);
int x, y, z;
TestingWorld tWorld = new TestingWorld(30,30,30);
SimpleWorld tWorld2= new TestingWorld(20,20,20);
@Test
public void test()
{
//creates a prism of DIRT for testing purposes
for(int i=0; i<20; i++)
{
for(int j=0; j<20; j++)
{
for(int k=0; k<20; k++)
{
tWorld.setBlockType(i,j,k,Material.DIRT);
}
}
}
assertEquals(cube5, cube1.scale(2.58));
assertEquals(cube3.xLoc, cube1.scale(2.0).xLoc);
assertEquals(cube4, cube2.translate(2,3,4));
assertEquals(Material.DIRT, tWorld.getBlockType(2,2,2));
assertEquals(tWorld.getBlockType(1,1,1), tWorld.getBlockType(2,2,2));
assertEquals(Material.DIRT, tWorld.getBlockType(15,15,15));
cube1.render(tWorld, Material.WATER);
assertEquals(Material.WATER, tWorld.getBlockType(5,5,5));
assertEquals(Material.WATER, tWorld.getBlockType(6,6,3));
assertEquals(Material.WATER, tWorld.getBlockType(2,6,3));
assertEquals(Material.WATER, tWorld.getBlockType(5,6,3));
assertEquals(Material.AIR, tWorld.getBlockType(29,29,29));
assertEquals(Material.DIRT,tWorld.getBlockType(19, 19, 19));
assertEquals(true, new RectangularPrism(1,1,1,1,1,1).equals(new RectangularPrism(1,1,1,1,1,1)));
assertTrue(new RectangularPrism(1,1,1,1,1,1).hashCode() != 0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment