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

// Analyse der Dreiecksart // Analyse der Dreiecksart
public static TriangleType checkTriangle(float a, float b, float c) { 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) { if (a==b && b==c) {
return TriangleType.EQUILATERAL; return TriangleType.EQUILATERAL;

+ 3
- 3
test/TriangleCheckerTest.java View File

public void testValidTriangle() { public void testValidTriangle() {


// Arrange // Arrange
float a = 2;
float b = 2;
float a = 0;
float b = 0;
float c = 2; 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.EQUILATERAL, type);
assertEquals(TriangleChecker.TriangleType.NONE, type);


} }



Loading…
Cancel
Save