Skip to content

Instantly share code, notes, and snippets.

@jbclements
Created April 18, 2012 03:19
Show Gist options
  • Save jbclements/2410860 to your computer and use it in GitHub Desktop.
Save jbclements/2410860 to your computer and use it in GitHub Desktop.
shuffled 01
package edu.calpoly.cpe102sp12;
import static org.junit.Assert.*;
import org.bukkit.Material;
import org.junit.Test;
public class Testing
{
@Test
public void test()
{
RectangularPrism block4 = new RectangularPrism(2, 2, 2, 1, 1, 1);
SimpleWorld world1 = new TestingWorld(2, 2, 2);
SimpleWorld testWorld = block4.render(world1, Material.DIRT);
assertEquals(Material.DIRT, testWorld.getBlockType(1, 1, 1));
assertEquals(Material.DIRT, testWorld.getBlockType(0, 1, 0));
assertEquals(Material.DIRT, testWorld.getBlockType(0, 1, 1));
assertEquals(Material.DIRT, testWorld.getBlockType(1, 1, 0));
RectangularPrism block5 = new RectangularPrism(2, 1, 1, 1, 1, 1);
SimpleWorld world2 = new TestingWorld(2, 1, 1);
SimpleWorld rendered = block5.render(world2, Material.DIRT);
assertEquals(Material.DIRT, rendered.getBlockType(0, 0, 0));
assertEquals(Material.DIRT, rendered.getBlockType(1, 0, 0));
SimpleWorld world3 = new TestingWorld(100, 100, 100);
RectangularPrism block6 = new RectangularPrism(50, 50, 50, 49, 49, 49);
SimpleWorld testWorld2 = block6.render(world3, Material.DIRT);
for(int c = 24; c < 74; c++)
{
for(int b = 24; b < 74; b++)
{
for(int a = 24; a < 74; a++)
{
assertEquals(Material.DIRT, testWorld2.getBlockType(a, b, c));
}
}
}
RectangularPrism block1 = new RectangularPrism(1, 1, 1, 8, 64, 4);
RectangularPrism block2 = new RectangularPrism(3, 4, 5, -5, 10, -50);
RectangularPrism block3 = new RectangularPrism(6, 2, 7, 0, 100, 20);
assertEquals(new RectangularPrism(4, 4, 4, 8, 64, 4), block1.scale(4.4));
assertEquals(new RectangularPrism(5, 5, 5, 8, 64, 4), block1.scale(4.5));
assertEquals(new RectangularPrism(8, 11, 14, -5, 10, -50), block2.scale(2.8));
assertEquals(new RectangularPrism(37, 12, 43, 0, 100, 20), block3.scale(6.1));
assertEquals(new RectangularPrism(-12, -16, -20, -5, 10, -50), block2.scale(-4));
assertEquals(new RectangularPrism(1, 1, 1, 13, 65, 4), block1.translate(5, 1, 0));
assertEquals(new RectangularPrism(3, 4, 5, -55, 0, 150), block2.translate(-50, -10, 200));
//testing automatically generated methods...
assertEquals(true, block1.equals(block1));
assertEquals(923612330, block1.hashCode());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment