+ unit tests
Signed-off-by: Johannes Theiner <j.theiner@live.de>
This commit is contained in:
parent
4dc8bee48e
commit
ed0708ad84
@ -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
|
||||
* @version 0.1
|
||||
@ -5,5 +11,37 @@
|
||||
**/
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user