Browse Source

Weiter Testfälle in "TestValidTriangle"

master
Mikko Winkler 3 years ago
parent
commit
d0ba75612c
2 changed files with 67 additions and 0 deletions
  1. 1
    0
      src/TriangleChecker.java
  2. 66
    0
      test/TriangleCheckerTest.java

+ 1
- 0
src/TriangleChecker.java View File

@@ -54,6 +54,7 @@ public class TriangleChecker {
if(a==b || b==c|| a==c) {
//Gleichseitiges Dreieck
if (a == b && b == c && a == c) return TriangleType.EQUILATERAL;

return TriangleType.ISOSCELES;
}
return TriangleType.NORMAL;

+ 66
- 0
test/TriangleCheckerTest.java View File

@@ -16,6 +16,72 @@ public class TriangleCheckerTest {

// Assert
assertEquals(TriangleChecker.TriangleType.NORMAL, type);

// Arrange
a = -2;
b = 3;
c = 4;

// Act
type = TriangleChecker.checkTriangle(a, b, c);

// Assert
assertEquals(TriangleChecker.TriangleType.NONE, type);

// Arrange
a = 2;
b = -3;
c = 4;

// Act
type = TriangleChecker.checkTriangle(a, b, c);

// Assert
assertEquals(TriangleChecker.TriangleType.NONE, type);

// Arrange
a = 2;
b = 3;
c = -4;

// Act
type = TriangleChecker.checkTriangle(a, b, c);

// Assert
assertEquals(TriangleChecker.TriangleType.NONE, type);

// Arrange
a = 2;
b = 3;
c = 10;

// Act
type = TriangleChecker.checkTriangle(a, b, c);

// Assert
assertEquals(TriangleChecker.TriangleType.NONE, type);

// Arrange
a = 10;
b = 3;
c = 4;

// Act
type = TriangleChecker.checkTriangle(a, b, c);

// Assert
assertEquals(TriangleChecker.TriangleType.NONE, type);

// Arrange
a = 2;
b = 10;
c = 4;

// Act
type = TriangleChecker.checkTriangle(a, b, c);

// Assert
assertEquals(TriangleChecker.TriangleType.NONE, type);
}

@Test

Loading…
Cancel
Save