Skip to content

Instantly share code, notes, and snippets.

@jbclements
Created April 18, 2012 03:25
Show Gist options
  • Save jbclements/2410905 to your computer and use it in GitHub Desktop.
Save jbclements/2410905 to your computer and use it in GitHub Desktop.
shuffled 07
package edu.calpoly.cpe102sp12;
import static org.junit.Assert.*;
import org.bukkit.*;
import org.junit.Test;
public class Testing {
@Test
public void test() {
//examples of prisms
RectangularPrism RP1 = new RectangularPrism(5,5,5,5,5,5);
RectangularPrism RP2 = new RectangularPrism(10,10,10,25,25,25);
RectangularPrism RP3 = new RectangularPrism(10,10,10,15,15,15);
RectangularPrism RP4 = new RectangularPrism(10,10,10,5,5,5);
RectangularPrism RP5 = new RectangularPrism(10,10,10,115,114,91);
//test cases for scale method
assertEquals(RP4, RP1.scale(2.0));
assertEquals(RP1, RP4.scale(0.5));
assertEquals(new RectangularPrism(60,60,60,25,25,25), RP2.scale(6));
//test cases for translate method
assertEquals(RP4, RP2.translate(-20,-20,-20));
assertEquals(RP5, RP3.translate(100,99,76));
//examples of TestingWorld
TestingWorld T1 = new TestingWorld(25, 25, 25);
TestingWorld T2 = new TestingWorld(20, 20, 20);
//test cases for getBlockType
T2.setBlockType(7, 7, 7, Material.DIRT);
T1.setBlockType(14,14,14, Material.CACTUS);
assertEquals(Material.AIR, T2.getBlockType(5, 5, 5));
assertEquals(Material.DIRT, T2.getBlockType(7, 7, 7));
assertEquals(Material.CACTUS, T1.getBlockType(14, 14, 14));
assertEquals(Material.AIR, T1.getBlockType(13,14,14));
//testing for render method
TestingWorld T3 = new TestingWorld(30,30,30);
TestingWorld T4 = new TestingWorld(100,100,100);
RectangularPrism RP6 = new RectangularPrism(5,5,5,10,10,10);
RectangularPrism RP7 = new RectangularPrism(5,5,5,32,32,32);
RP3.render(T3, Material.BEDROCK);
RP6.render(T2, Material.GLOWSTONE);
RP7.render(T4, Material.STONE);
assertEquals(Material.BEDROCK, T3.getBlockType(17,17,18));
assertEquals(Material.GLOWSTONE, T2.getBlockType(11, 11, 11));
assertEquals(Material.STONE, T4.getBlockType(33, 33, 33));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment