2
0

+ Implementierte UnitTests

Signed-off-by: Johannes Theiner <j.theiner@live.de>
This commit is contained in:
Johannes Theiner 2020-04-16 11:22:23 +02:00
parent ce2ce5d880
commit 453c238d22

View File

@ -0,0 +1,39 @@
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
* @since 0.1
**/
public class WhiteboxTest {
@Test
public void instruction() {
assertEquals(TriangleChecker.checkTriangle(-1, 2, 5), TriangleType.NO_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(5, 5, 5), TriangleType.EQUILATERAL_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(3, 3, 4), TriangleType.ISOSCELESS_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(7, 15, 10), TriangleType.SCALENE_TRIANGLE);
}
@Test
public void branch() {
assertEquals(TriangleChecker.checkTriangle(-1, 5, 3), TriangleType.NO_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(5, 5, 5), TriangleType.EQUILATERAL_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(2, 2, 5), TriangleType.ISOSCELESS_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(7, 15, 10), TriangleType.SCALENE_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(7, 18, 10), TriangleType.NO_TRIANGLE);
}
@Test
public void defined() {
assertEquals(TriangleChecker.checkTriangle(-1, 5, 3), TriangleType.NO_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(5, 5, 5), TriangleType.EQUILATERAL_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(2, 2, 5), TriangleType.ISOSCELESS_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(7, 15, 10), TriangleType.SCALENE_TRIANGLE);
assertEquals(TriangleChecker.checkTriangle(8, 2, 3), TriangleType.NO_TRIANGLE);
}
}