Browse Source

Test2 gleichschenklig

finished
master
Moritz Neumeier 3 years ago
parent
commit
37ece7ec9f

BIN
out/production/TriangleCheckerAssignment/TriangleChecker.class View File


BIN
out/test/TriangleCheckerAssignment/TriangleCheckerTest.class View File


+ 3
- 5
src/TriangleChecker.java View File

@@ -49,17 +49,15 @@ public class TriangleChecker {
public static TriangleType checkTriangle(float a, float b, float c) {

if(a >= (b+c) || c >= (b+a) || b >= (a+c) || a<=0 || b<=0 || c<=0){

return TriangleType.NONE;
}

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


}


}

+ 18
- 0
test/TriangleCheckerTest.java View File

@@ -54,4 +54,22 @@ public class TriangleCheckerTest {

}

@Test
public void testISOSCELESTriangle() {

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

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

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


}


}

Loading…
Cancel
Save