|
|
@@ -5,24 +5,43 @@ import static org.junit.jupiter.api.Assertions.*; |
|
|
|
class TriangleCheckerTest { |
|
|
|
|
|
|
|
@Test |
|
|
|
void checkTriangle() { |
|
|
|
public void testNegativeSide() { |
|
|
|
assertEquals(TriangleChecker.TriangleType.NONE, TriangleChecker.checkTriangle(-1, 2, 3)); |
|
|
|
} |
|
|
|
|
|
|
|
float a = 3; |
|
|
|
float b = 4; |
|
|
|
float c = 5; |
|
|
|
@Test |
|
|
|
public void testTwoNegativeSides() { |
|
|
|
assertEquals(TriangleChecker.TriangleType.NONE, TriangleChecker.checkTriangle(-1, -2, 3)); |
|
|
|
} |
|
|
|
|
|
|
|
TriangleChecker.TriangleType result = TriangleChecker.checkTriangle(a, b, c); |
|
|
|
System.out.println(result); |
|
|
|
@Test |
|
|
|
public void testAllNegativeSides() { |
|
|
|
assertEquals(TriangleChecker.TriangleType.NONE, TriangleChecker.checkTriangle(-1, -2, -3)); |
|
|
|
} |
|
|
|
|
|
|
|
assertEquals(TriangleChecker.TriangleType.NORMAL, result, "Normales Dreieck"); |
|
|
|
@Test |
|
|
|
public void testOneZeroSide() { |
|
|
|
assertEquals(TriangleChecker.TriangleType.NONE, TriangleChecker.checkTriangle(0, 3, 4)); |
|
|
|
} |
|
|
|
|
|
|
|
float d = 4; |
|
|
|
float e = 4; |
|
|
|
float f = 4; |
|
|
|
@Test |
|
|
|
public void testTwoZeroSides() { |
|
|
|
assertEquals(TriangleChecker.TriangleType.NONE, TriangleChecker.checkTriangle(0, 0, 5)); |
|
|
|
} |
|
|
|
|
|
|
|
TriangleChecker.TriangleType result2 = TriangleChecker.checkTriangle(d, e, f); |
|
|
|
System.out.println(result2); |
|
|
|
@Test |
|
|
|
public void testOneOversizedSide() { |
|
|
|
assertEquals(TriangleChecker.TriangleType.NONE, TriangleChecker.checkTriangle(10, 2, 3)); |
|
|
|
} |
|
|
|
|
|
|
|
assertEquals(TriangleChecker.TriangleType.EQUILATERAL, result2, "Gleichseitiges"); |
|
|
|
// Testfälle für gleichschenklige und gleichseitige Dreiecke |
|
|
|
@Test |
|
|
|
public void testEquilateralTriangle() { |
|
|
|
assertEquals(TriangleChecker.TriangleType.EQUILATERAL, TriangleChecker.checkTriangle(5, 5, 5)); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
public void testIsoscelesTriangle() { |
|
|
|
assertEquals(TriangleChecker.TriangleType.ISOSCELES, TriangleChecker.checkTriangle(5, 5, 3)); |
|
|
|
} |
|
|
|
} |