Skip to content

Instantly share code, notes, and snippets.

@jbclements
Created April 18, 2012 03:29
Show Gist options
  • Save jbclements/2410916 to your computer and use it in GitHub Desktop.
Save jbclements/2410916 to your computer and use it in GitHub Desktop.
shuffled 11
package edu.calpoly.cpe102sp12;
import org.bukkit.Material;
import org.junit.Test;
import static org.junit.Assert.*;
public class Testing {
@Test
public void test(){
//Testing scale()
assertEquals (new RectangularPrism (20,50,70,10,25,35),
new RectangularPrism (2,5,7,10,25,35).scale(10));
assertEquals (new RectangularPrism (2,4,6,10,25,35),
new RectangularPrism (2,5,7,10,25,35).scale(0.8));
//Testing translate()
assertEquals (new RectangularPrism (20,50,70,10,25,35),
new RectangularPrism (20,50,70,20,30,40).translate(-10,-5,-5));
//Testing setBlockType()
TestingWorld case1 = new TestingWorld (10,50,10);
assertEquals(Material.AIR, case1.getBlockType(5, 25, 5));
case1.setBlockType(5, 25, 5, Material.DIRT);
assertEquals(Material.DIRT, case1.getBlockType(5, 25, 5));
//Testing render()
new RectangularPrism(2, 3, 4, 5, 25, 5).render(case1, Material.STONE);
assertEquals(Material.STONE, case1.getBlockType(4, 23, 3));
assertEquals(Material.STONE, case1.getBlockType(5, 23, 3));
assertEquals(Material.STONE, case1.getBlockType(4, 25, 3));
assertEquals(Material.STONE, case1.getBlockType(5, 25, 3));
assertEquals(Material.STONE, case1.getBlockType(4, 23, 6));
assertEquals(Material.STONE, case1.getBlockType(5, 23, 6));
assertEquals(Material.STONE, case1.getBlockType(4, 25, 6));
assertEquals(Material.STONE, case1.getBlockType(5, 25, 6));
new RectangularPrism(3, 4, 5, 5, 25, 5).render(case1, Material.CACTUS);
assertEquals(Material.CACTUS, case1.getBlockType(3, 23, 2));
assertEquals(Material.CACTUS, case1.getBlockType(5, 23, 2));
assertEquals(Material.CACTUS, case1.getBlockType(3, 26, 2));
assertEquals(Material.CACTUS, case1.getBlockType(5, 26, 2));
assertEquals(Material.CACTUS, case1.getBlockType(3, 23, 6));
assertEquals(Material.CACTUS, case1.getBlockType(5, 23, 6));
assertEquals(Material.CACTUS, case1.getBlockType(3, 26, 6));
assertEquals(Material.CACTUS, case1.getBlockType(5, 26, 6));
new RectangularPrism(10, 50, 10, 5, 25, 5).render(case1, Material.DIRT);
assertEquals(Material.DIRT, case1.getBlockType(0, 0, 0));
assertEquals(Material.DIRT, case1.getBlockType(9, 0, 0));
assertEquals(Material.DIRT, case1.getBlockType(0, 49, 0));
assertEquals(Material.DIRT, case1.getBlockType(9, 49, 0));
assertEquals(Material.DIRT, case1.getBlockType(0, 0, 9));
assertEquals(Material.DIRT, case1.getBlockType(9, 0, 9));
assertEquals(Material.DIRT, case1.getBlockType(0, 49, 9));
assertEquals(Material.DIRT, case1.getBlockType(9, 49, 9));
//Testing hashcode
assertEquals(954170425, new RectangularPrism (2,5,7,10,25,35).hashCode());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment