Skip to content

Instantly share code, notes, and snippets.

@jbclements
Created April 18, 2012 03:26
Show Gist options
  • Save jbclements/2410908 to your computer and use it in GitHub Desktop.
Save jbclements/2410908 to your computer and use it in GitHub Desktop.
shuffled 08
package edu.calpoly.cpe102sp12;
import static org.junit.Assert.*;
import org.bukkit.Material;
import org.junit.Test;
public class Testing {
@Test
public void testRect() {
RectangularPrism TestRec1 = new RectangularPrism(2, 4, 8, 3, 5, 21);
RectangularPrism TestRec2 = new RectangularPrism(7, 5, 2, 3, 1, 5);
RectangularPrism TestRec3 = new RectangularPrism(9, 18, 27, 23, 33, 43);
assertEquals(TestRec1.scale(0.5000), new RectangularPrism(1, 2, 4, 3, 5, 21));
assertEquals(TestRec2, new RectangularPrism(65, 49, 20, 3, 1, 5).scale(0.1000));
assertEquals(TestRec3, new RectangularPrism(1, 2, 3, 23, 33, 43).scale(9.0000));
assertEquals(TestRec1, new RectangularPrism(2, 4, 8, 34, 23, 1).translate(-31, -18, 20));
assertEquals(TestRec2, new RectangularPrism(7, 5, 2, 1, 3, 5).translate(2, -2, 0));
assertEquals(TestRec3, new RectangularPrism(9, 18, 27, 34, 23, 1).translate(-11, 10, 42));
TestingWorld renderTest = new TestingWorld(100, 100, 100);
new RectangularPrism(6, 8, 5, 32, 67, 5).render(renderTest, Material.GOLD_HOE);
assertEquals(Material.GOLD_HOE, renderTest.getBlockType(29, 63, 2));
assertEquals(Material.GOLD_HOE, renderTest.getBlockType(29, 63, 6));
assertEquals(Material.GOLD_HOE, renderTest.getBlockType(29, 70, 2));
assertEquals(Material.GOLD_HOE, renderTest.getBlockType(29, 70, 6));
assertEquals(Material.GOLD_HOE, renderTest.getBlockType(34, 63, 2));
assertEquals(Material.GOLD_HOE, renderTest.getBlockType(34, 63, 6));
assertEquals(Material.GOLD_HOE, renderTest.getBlockType(34, 70, 2));
assertEquals(Material.GOLD_HOE, renderTest.getBlockType(34, 70, 6));
}
@Test
public void testWorld() {
TestingWorld TestWorld1 = new TestingWorld(34, 65, 11);
assertEquals(Material.AIR, TestWorld1.getBlockType(23, 64, 2));
TestingWorld TestWorld2 = TestWorld1;
TestWorld2.setBlockType(23, 64, 2, Material.BLAZE_ROD);
assertEquals(Material.BLAZE_ROD, (TestWorld2.getBlockType(23, 64, 2)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment