Browse Source

"Gleichseitig" eingefügt und positiver Test

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

+ 1
- 1
src/TriangleChecker.java View File

@@ -48,7 +48,7 @@ public class TriangleChecker {
// Analyse der Dreiecksart
public static TriangleType checkTriangle(float a, float b, float c) {

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

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

+ 3
- 3
test/TriangleCheckerTest.java View File

@@ -7,15 +7,15 @@ public class TriangleCheckerTest {
public void testValidTriangle() {

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

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

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

}


Loading…
Cancel
Save