Browse Source

"Gleichseitig" eingefügt und positiver Test

-> Test jetzt für alle Fälle positiv
master
Sarah Baumann 2 years ago
parent
commit
bf3372930f
2 changed files with 6 additions and 2 deletions
  1. 4
    0
      src/TriangleChecker.java
  2. 2
    2
      test/TriangleCheckerTest.java

+ 4
- 0
src/TriangleChecker.java View File



if (a+b>c || b+c>a || a+c>b) { if (a+b>c || b+c>a || a+c>b) {


if (a==b && b==c) {
return TriangleType.EQUILATERAL;
}

if (a == b || a == c || b == c) { if (a == b || a == c || b == c) {
return TriangleType.ISOSCELES; return TriangleType.ISOSCELES;
} }

+ 2
- 2
test/TriangleCheckerTest.java View File

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


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


// Assert // Assert
assertEquals(TriangleChecker.TriangleType.ISOSCELES, type);
assertEquals(TriangleChecker.TriangleType.EQUILATERAL, type);


} }



Loading…
Cancel
Save