Created
April 18, 2012 03:27
-
-
Save jbclements/2410910 to your computer and use it in GitHub Desktop.
shuffled 10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package edu.calpoly.cpe102sp12; | |
import static org.junit.Assert.*; | |
import org.bukkit.Material; | |
import org.junit.Test; | |
public class Testing { | |
@Test | |
public void myTest(){ | |
RectangularPrism rp1 = new RectangularPrism(15,4,6,9,10,11); | |
RectangularPrism rp2 = new RectangularPrism(30,2,3,4,5,6); | |
assertEquals(new RectangularPrism(48,13,19,9,10,11), | |
rp1.scale(3.2)); | |
assertEquals(new RectangularPrism(30,2,3,17,19,-94), | |
rp2.translate(13,14,-100)); | |
} | |
@Test | |
public void testEquals(){ | |
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); | |
} | |
@Test | |
public void testWorldTest(){ | |
SimpleWorld sw = new TestingWorld(30,30,30); | |
assertEquals(Material.AIR,sw.getBlockType(5,6,7)); | |
assertEquals(Material.AIR,sw.getBlockType(29,29,29)); | |
assertEquals(Material.AIR,sw.getBlockType(14, 0, 29)); | |
} | |
@Test | |
public void testOutOfBounds(){ | |
SimpleWorld sw = new TestingWorld(10,10,10); | |
try { | |
sw.getBlockType(3, 14, 2); | |
fail(); | |
} catch (RuntimeException exn) { | |
// success | |
return; | |
} | |
} | |
@Test | |
public void worldSetting(){ | |
SimpleWorld sw = new TestingWorld(30,30,30); | |
assertEquals("air before",Material.AIR,sw.getBlockType(9,14,26)); | |
sw.setBlockType(9,14,26,Material.DIAMOND); | |
assertEquals("diamond after",Material.DIAMOND,sw.getBlockType(9, 14, 26)); | |
assertEquals("air before",Material.AIR,sw.getBlockType(29,29,29)); | |
sw.setBlockType(29,29,29,Material.DIAMOND); | |
assertEquals("diamond after",Material.DIAMOND,sw.getBlockType(29,29,29)); | |
} | |
@Test | |
public void rendering(){ | |
SimpleWorld sw = new TestingWorld(30,30,30); | |
RectangularPrism rp = new RectangularPrism(5,6,3,14,13,19); | |
//[11,15],[10,15],[17,19] | |
assertEquals(Material.AIR,sw.getBlockType(10, 10, 16)); | |
assertEquals(Material.AIR,sw.getBlockType(11,11,17)); | |
assertEquals(Material.AIR,sw.getBlockType(14,13,19)); | |
assertEquals(Material.AIR,sw.getBlockType(15, 11, 19)); | |
assertEquals(Material.AIR,sw.getBlockType(16,11,19)); | |
assertEquals(Material.AIR,sw.getBlockType(15,10,19)); | |
assertEquals(Material.AIR,sw.getBlockType(15,11,20)); | |
rp.render(sw,Material.BEDROCK); | |
assertEquals(Material.AIR,sw.getBlockType(10, 10, 16)); | |
assertEquals(Material.BEDROCK,sw.getBlockType(11,11,17)); | |
assertEquals(Material.BEDROCK,sw.getBlockType(14, 13, 19)); | |
assertEquals(Material.BEDROCK,sw.getBlockType(15, 10, 19)); | |
assertEquals(Material.AIR,sw.getBlockType(16,10,19)); | |
assertEquals(Material.AIR,sw.getBlockType(15,9,19)); | |
assertEquals(Material.AIR,sw.getBlockType(15,11,20)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment