public static TriangleType checkTriangle(float a, float b, float c) { | public static TriangleType checkTriangle(float a, float b, float c) { | ||||
if(a + b > c && a + c > b && b + c > a){ | if(a + b > c && a + c > b && b + c > a){ | ||||
if (a == b || b == c || a == c){ | |||||
return TriangleType.ISOSCELES; | |||||
} | |||||
return TriangleType.NORMAL; | return TriangleType.NORMAL; | ||||
} else { | |||||
return TriangleType.NONE; | |||||
} | } | ||||
return TriangleType.NONE; | |||||
} | } |
void checkTriangleNone(){ | void checkTriangleNone(){ | ||||
assertEquals(TriangleChecker.TriangleType.NONE,TriangleChecker.checkTriangle(6,2.9f, 2)); | assertEquals(TriangleChecker.TriangleType.NONE,TriangleChecker.checkTriangle(6,2.9f, 2)); | ||||
} | } | ||||
@Test | |||||
void checkTriangleISOSCELES(){ | |||||
assertEquals(TriangleChecker.TriangleType.ISOSCELES,TriangleChecker.checkTriangle(6,6, 2)); | |||||
} | |||||
} | } |