2
0

+ unit tests

Signed-off-by: Johannes Theiner <j.theiner@live.de>
This commit is contained in:
Johannes Theiner 2020-04-07 18:55:45 +02:00
parent 4dc8bee48e
commit ed0708ad84

View File

@ -1,3 +1,9 @@
import de.hsel.sqs.TriangleChecker;
import de.hsel.sqs.TriangleType;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
/** /**
* @author Johannes Theiner * @author Johannes Theiner
* @version 0.1 * @version 0.1
@ -5,5 +11,37 @@
**/ **/
public class TriangleTest { public class TriangleTest {
@Test
public void noTriangle() {
assertEquals(TriangleChecker.checkTriangle(8, 2, 3), TriangleType.NO_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(2, 8, 3), TriangleType.NO_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(2, 3, 8), TriangleType.NO_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(-1, 5, -3), TriangleType.NO_TRIANGLE);
}
@Test
public void equilateralTriangle() {
assertEquals(TriangleChecker.checkTriangle(5, 5, 5), TriangleType.EQUILATERAL_TRIANGLE);
}
@Test
public void isocelessTriangle() {
assertEquals(TriangleChecker.checkTriangle(7, 7, 2), TriangleType.ISOSCELESS_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(6, 10, 10), TriangleType.ISOSCELESS_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(4, 3, 4), TriangleType.ISOSCELESS_TRIANGLE);
}
@Test
public void scaleneTriangle() {
assertEquals(TriangleChecker.checkTriangle(5, 7, 9), TriangleType.SCALENE_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(3, 5, 4), TriangleType.SCALENE_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(7, 15, 10), TriangleType.SCALENE_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(9, 5, 7), TriangleType.SCALENE_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(4, 3, 5), TriangleType.SCALENE_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(10, 7, 15), TriangleType.SCALENE_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(7, 9, 5), TriangleType.SCALENE_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(5, 4, 3), TriangleType.SCALENE_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(15, 10, 7), TriangleType.SCALENE_TRIANGLE);
}
} }