65 lines
1.2 KiB
Java
65 lines
1.2 KiB
Java
package Presenter.Algorithms;
|
|
|
|
|
|
import Model.Line;
|
|
import Model.Point;
|
|
import org.junit.Before;
|
|
import org.junit.Test;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.LinkedList;
|
|
|
|
import static org.junit.Assert.*;
|
|
|
|
/**
|
|
* Implementierung verschiedener Algorithmen zur Berechnung von Ausgleichsgeraden.
|
|
*
|
|
* @Author: Armin Wolf
|
|
* @Email: a_wolf28@uni-muenster.de
|
|
* @Date: 12.06.2017.
|
|
*/
|
|
public class LeastMedianOfSquaresEstimatorTest {
|
|
|
|
private LeastMedianOfSquaresEstimator lms;
|
|
|
|
@Before
|
|
public void setUp() throws Exception {
|
|
|
|
LinkedList<Line> line = new LinkedList<>();
|
|
LinkedList<Point> intersections = new LinkedList<>();
|
|
|
|
|
|
|
|
lms = new LeastMedianOfSquaresEstimator(line, intersections);
|
|
}
|
|
|
|
@Test
|
|
public void approximateLMS() throws Exception {
|
|
|
|
}
|
|
|
|
|
|
@Test
|
|
public void mergeSort() throws Exception {
|
|
double[] umin = {1,5,6,4,20};
|
|
double[] umax = {1,4,6,5,20};
|
|
|
|
ArrayList<Double> a = new ArrayList<>();
|
|
ArrayList<Double> b = new ArrayList<>();
|
|
|
|
for (double d :umin) {
|
|
a.add(d);
|
|
}
|
|
|
|
for (double d :umax) {
|
|
b.add(d);
|
|
}
|
|
|
|
|
|
int ret = lms.mergeSort(a,0,a.size()-1,b);
|
|
assertEquals(2, ret);
|
|
|
|
}
|
|
|
|
} |