Gitlab service upgraded. Please report any problems to dl_gitadmin@cs.lth.se

Commit 342a0fe5 authored by Noric Couderc's avatar Noric Couderc

Moved test to its more relevant file.

parent cf80ad75
import org.junit.Assert;
import org.junit.Test;
import se.lth.cs.ApplicationGeneration.ListApplicationGenerator;
import se.lth.cs.ApplicationRunner;
import se.lth.cs.TrainingSetValue;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class ApplicationRunnerTest {
@Test
public void TestApplicationGeneratorSpread() throws InvocationTargetException, IllegalAccessException {
ApplicationRunner r = new ApplicationRunner();
Long threshold = 3l;
List<TrainingSetValue> values =
r.createListApplicationsSpread(threshold, 10,new ListApplicationGenerator());
Map<String, Long> histogram = values.stream().collect(
Collectors.groupingBy(TrainingSetValue::getBestDataStructure, Collectors.counting())
);
Assert.assertEquals(3, histogram.keySet().size());
Assert.assertTrue( histogram.values().stream().min(Long::compareTo).orElse(0l) >= threshold);
}
}
......@@ -217,22 +217,6 @@ public class ApplicationTest {
values1.add(3.0);
Assert.assertEquals(3.5, UtilsKt.median(values1), 0.0001);
}
@Test
public void TestApplicationGeneratorSpread() throws InvocationTargetException, IllegalAccessException {
ApplicationRunner r = new ApplicationRunner();
Long threshold = 3l;
List<TrainingSetValue> values =
r.createListApplicationsSpread(threshold, 10,new ListApplicationGenerator());
Map<String, Long> histogram = values.stream().collect(
Collectors.groupingBy(TrainingSetValue::getBestDataStructure, Collectors.counting())
);
Assert.assertEquals(3, histogram.keySet().size());
Assert.assertTrue( histogram.values().stream().min(Long::compareTo).orElse(0l) >= threshold);
}
@Test
public void testHistogram2() {
for (int seed = 0; seed < 100; seed++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment