Skip to content

Instantly share code, notes, and snippets.

@jbclements
Created April 18, 2012 03:20
Show Gist options
  • Save jbclements/2410882 to your computer and use it in GitHub Desktop.
Save jbclements/2410882 to your computer and use it in GitHub Desktop.
shuffled 02
package edu.calpoly.cpe102sp12;
import static org.junit.Assert.*;
import org.bukkit.Material;
import org.junit.Test;
public class Testing
{
TestingWorld world = new TestingWorld(45, 45, 45);
RectangularPrism rp1 = new RectangularPrism(1,1,1,0,0,0);
RectangularPrism rp2 = new RectangularPrism(5,2,7,2,7,10);
RectangularPrism rp3 = new RectangularPrism(-4,80,759,6,14,120);
RectangularPrism rp4 = new RectangularPrism(5,5,5,15,5,5);
RectangularPrism rp5 = new RectangularPrism(3,5,2,20,7,10);
@Test
public void scaleTest(){
assertEquals(rp1.scale(5), new RectangularPrism(5,5,5,0,0,0));
assertEquals(rp2.scale(7.3), new RectangularPrism(37,15,51,2,7,10));
assertEquals(rp3.scale(.5), new RectangularPrism(-2,40,380,6,14,120));
}
@Test
public void translateTest(){
assertEquals(rp1.translate(7,8,20), new RectangularPrism(1,1,1,7,8,20));
assertEquals(rp2.translate(1000,-1,27), new RectangularPrism(5,2,7,1002,6,37));
assertEquals(rp3.translate(0,10,-4), new RectangularPrism(-4,80,759,6,24,116));
}
@Test
public void getBlockTypeTest(){
assertEquals(Material.AIR, world.getBlockType(1, 1, 1));
}
@Test
public void renderTest()
{
rp1.render(world, Material.DIRT);
assertEquals(world.blocks[0], Material.DIRT);
rp4.render(world, Material.BEDROCK);
assertEquals(world.blocks[10365], Material.BEDROCK);
rp5.render(world, Material.DIAMOND);
assertEquals(world.blocks[20585], Material.DIAMOND);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment