Created
October 22, 2013 17:47
-
-
Save TimWolla/7104912 to your computer and use it in GitHub Desktop.
This file contains 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
import static org.junit.Assert.*; | |
import org.junit.Test; | |
public class KreisTest { | |
@Test | |
public final void testBerechneFlaeche() { | |
assertEquals(Math.PI, (new Kreis(1, 0, 0)).berechneFlaeche(), 5); | |
assertEquals(Math.PI * 4, (new Kreis(2, 0, 0)).berechneFlaeche(), 5); | |
} | |
@Test | |
public final void testSchneidet() { | |
assertTrue((new Kreis(1, 0, 0)).schneidet(new Kreis(1, 1, 0))); | |
assertFalse((new Kreis(1, 0, 0)).schneidet(new Kreis(1, 100, 0))); | |
assertTrue((new Kreis(1, 0, 0)).schneidet(new Kreis(1, 1, 1))); | |
assertTrue((new Kreis(1, 0, 0)).schneidet(new Kreis(1, -1, -1))); | |
assertTrue((new Kreis(1, 0, 0)).schneidet(new Kreis(1, 0, 0))); | |
assertTrue((new Kreis(1, 0, 0)).schneidet(new Kreis(0.5, 0, 0))); | |
assertFalse((new Kreis(0, 0, 0)).schneidet(new Kreis(0, 0.1, 0))); | |
assertTrue((new Kreis(1.5, 0, 0)).schneidet(new Kreis(0.1, 1.3, 0))); | |
assertTrue((new Kreis(1.5, 0, 0)).schneidet(new Kreis(0.25, 1.3, 0))); | |
} | |
@Test | |
public final void testGetRadius() { | |
assertEquals(1, (new Kreis(1, 0, 0)).getRadius(), 5); | |
assertEquals(2, (new Kreis(2, 0, 0)).getRadius(), 5); | |
assertEquals(3, (new Kreis(3, 0, 0)).getRadius(), 5); | |
assertEquals(4.5, (new Kreis(4.5, 0, 0)).getRadius(), 5); | |
assertEquals(3.1415926535, (new Kreis(3.1415926535, 0, 0)).getRadius(), 5); | |
} | |
@Test | |
public final void testGetX() { | |
assertEquals(1, (new Kreis(0, 1, 0)).getX(), 5); | |
assertEquals(2, (new Kreis(0, 2, 0)).getX(), 5); | |
assertEquals(3, (new Kreis(0, 3, 0)).getX(), 5); | |
assertEquals(4.5, (new Kreis(0, 4.5, 0)).getX(), 5); | |
assertEquals(3.1415926535, (new Kreis(0, 3.1415926535, 0)).getX(), 5); | |
} | |
@Test | |
public final void testGetY() { | |
assertEquals(1, (new Kreis(0, 1, 0)).getY(), 5); | |
assertEquals(2, (new Kreis(0, 2, 0)).getY(), 5); | |
assertEquals(3, (new Kreis(0, 3, 0)).getY(), 5); | |
assertEquals(4.5, (new Kreis(0, 4.5, 0)).getY(), 5); | |
assertEquals(3.1415926535, (new Kreis(0, 3.1415926535, 0)).getY(), 5); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment