|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Assert |
|
|
// Assert |
|
|
assertEquals(TriangleChecker.TriangleType.NORMAL, type); |
|
|
assertEquals(TriangleChecker.TriangleType.NORMAL, type); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
@Test |
|
|
|
|
|
public void testEquilateralTriangle() { |
|
|
|
|
|
|
|
|
|
|
|
// Arrange |
|
|
|
|
|
float a = 2; |
|
|
|
|
|
float b = 2; |
|
|
|
|
|
float c = 2; |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
|
TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c); |
|
|
|
|
|
|
|
|
|
|
|
// Assert |
|
|
assertEquals(TriangleChecker.TriangleType.EQUILATERAL, type); |
|
|
assertEquals(TriangleChecker.TriangleType.EQUILATERAL, type); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
public void testIsoscelesTriangle() { |
|
|
|
|
|
|
|
|
|
|
|
// Arrange |
|
|
|
|
|
float a = 2; |
|
|
|
|
|
float b = 2; |
|
|
|
|
|
float c = 3; |
|
|
|
|
|
|
|
|
|
|
|
float d = 3; |
|
|
|
|
|
float e = 2; |
|
|
|
|
|
float f = 2; |
|
|
|
|
|
|
|
|
|
|
|
float g = 2; |
|
|
|
|
|
float h = 3; |
|
|
|
|
|
float i = 2; |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
|
TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c); |
|
|
|
|
|
TriangleChecker.TriangleType typeOne = TriangleChecker.checkTriangle(d, e, f); |
|
|
|
|
|
TriangleChecker.TriangleType typeTwo = TriangleChecker.checkTriangle(g, h, i); |
|
|
|
|
|
|
|
|
|
|
|
// Assert |
|
|
assertEquals(TriangleChecker.TriangleType.ISOSCELES, type); |
|
|
assertEquals(TriangleChecker.TriangleType.ISOSCELES, type); |
|
|
|
|
|
assertEquals(TriangleChecker.TriangleType.ISOSCELES, typeOne); |
|
|
|
|
|
assertEquals(TriangleChecker.TriangleType.ISOSCELES, typeTwo); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
@Test |
|
|
|
|
|
public void testNoTriangle() { |
|
|
|
|
|
|
|
|
|
|
|
// Arrange |
|
|
|
|
|
float a = 3; //überlange Seite |
|
|
|
|
|
float b = 1; |
|
|
|
|
|
float c = 1; |
|
|
|
|
|
|
|
|
|
|
|
float d = 0; |
|
|
|
|
|
float e = 0; |
|
|
|
|
|
float f = 0; |
|
|
|
|
|
|
|
|
|
|
|
float g = -1;//negative Zahlen |
|
|
|
|
|
float h = -1; |
|
|
|
|
|
float i = -1; |
|
|
|
|
|
|
|
|
|
|
|
float j = 4; |
|
|
|
|
|
float k = 8; |
|
|
|
|
|
float l = 12; |
|
|
|
|
|
|
|
|
|
|
|
float m = 3; |
|
|
|
|
|
float n = 0; |
|
|
|
|
|
float o = 4; |
|
|
|
|
|
|
|
|
|
|
|
float p = 3; |
|
|
|
|
|
float q = -5; |
|
|
|
|
|
float r = 4; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
|
TriangleChecker.TriangleType caseOne = TriangleChecker.checkTriangle(a, b, c); |
|
|
|
|
|
TriangleChecker.TriangleType caseTwo = TriangleChecker.checkTriangle(d, e, f); |
|
|
|
|
|
TriangleChecker.TriangleType caseThree = TriangleChecker.checkTriangle(g, h, i); |
|
|
|
|
|
TriangleChecker.TriangleType caseFour = TriangleChecker.checkTriangle(j, k, l); |
|
|
|
|
|
TriangleChecker.TriangleType caseFive = TriangleChecker.checkTriangle(m,n,o); |
|
|
|
|
|
TriangleChecker.TriangleType caseSix = TriangleChecker.checkTriangle(p, q, r); |
|
|
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
|
assertEquals(TriangleChecker.TriangleType.NONE, caseOne); |
|
|
|
|
|
assertEquals(TriangleChecker.TriangleType.NONE, caseTwo); |
|
|
|
|
|
assertEquals(TriangleChecker.TriangleType.NONE, caseThree); |
|
|
|
|
|
assertEquals(TriangleChecker.TriangleType.NONE, caseFour); |
|
|
|
|
|
assertEquals(TriangleChecker.TriangleType.NONE, caseFive); |
|
|
|
|
|
assertEquals(TriangleChecker.TriangleType.NONE, caseSix); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |