algorithms-for-computing-li.../LinearRegressionTool/src/test/java/de/wwwu/awolf/presenter/util/IntersectionCounterTest.java

40 lines
1.1 KiB
Java

package de.wwwu.awolf.presenter.util;
import de.wwwu.awolf.model.Line;
import de.wwwu.awolf.model.LineModel;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
/**
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
*
* @Author: Armin Wolf
* @Email: a_wolf28@uni-muenster.de
* @Date: 23.10.2017.
*/
public class IntersectionCounterTest {
private LineModel lineModel;
@Before
public void setUp() throws Exception {
lineModel = new LineModel();
lineModel.addLine(new Line(3,13,10,3));
lineModel.addLine(new Line(1,9,1,9));
lineModel.addLine(new Line(1,12,4,6));
for (Line l :lineModel.getLines()) {
System.out.println("Steigung: "+l.getM()+"\t y-Achsenabschnitt: "+l.getB());
}
}
@Test
public void run() throws Exception {
IntersectionComputer instance = IntersectionComputer.getInstance();
assertEquals(3, IntersectionComputer.getInstance().compute(new ArrayList<>(lineModel.getLines()), -9999,9999).size());
}
}