Make tests to go all possible combinations
This commit is contained in:
parent
6e584b4913
commit
d9e76169fe
1 changed files with 43 additions and 37 deletions
|
@ -15,13 +15,11 @@ import java.util.TreeSet;
|
||||||
|
|
||||||
import net.osmand.binary.BinaryMapIndexReader;
|
import net.osmand.binary.BinaryMapIndexReader;
|
||||||
|
|
||||||
import net.osmand.data.LatLon;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
|
|
||||||
|
@ -76,15 +74,22 @@ public class RouteTestingTest {
|
||||||
} else {
|
} else {
|
||||||
binaryMapIndexReaders = new BinaryMapIndexReader[]{new BinaryMapIndexReader(raf, new File(fl))};
|
binaryMapIndexReaders = new BinaryMapIndexReader[]{new BinaryMapIndexReader(raf, new File(fl))};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int planRoadDirection = -1; planRoadDirection <= 1; planRoadDirection++) {
|
||||||
|
if (params.containsKey("onlyPlanRoadDirection")) {
|
||||||
|
if (!params.get("onlyPlanRoadDirection").equals(planRoadDirection + "")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
RoutingConfiguration config = builder.build(params.containsKey("vehicle") ? params.get("vehicle") : "car",
|
RoutingConfiguration config = builder.build(params.containsKey("vehicle") ? params.get("vehicle") : "car",
|
||||||
RoutingConfiguration.DEFAULT_MEMORY_LIMIT * 3, params);
|
RoutingConfiguration.DEFAULT_MEMORY_LIMIT * 3, params);
|
||||||
if (params.containsKey("planRoadDirection")) {
|
|
||||||
config.planRoadDirection = Integer.parseInt(params.get("planRoadDirection"));
|
config.planRoadDirection = planRoadDirection;
|
||||||
}
|
|
||||||
RoutingContext ctx = fe.buildRoutingContext(config, null, binaryMapIndexReaders,
|
RoutingContext ctx = fe.buildRoutingContext(config, null, binaryMapIndexReaders,
|
||||||
RoutePlannerFrontEnd.RouteCalculationMode.NORMAL);
|
RoutePlannerFrontEnd.RouteCalculationMode.NORMAL);
|
||||||
ctx.leftSideNavigation = false;
|
ctx.leftSideNavigation = false;
|
||||||
List<RouteSegmentResult> routeSegments = fe.searchRoute(ctx, te.getStartPoint(), te.getEndPoint(), te.getTransitPoint());
|
List<RouteSegmentResult> routeSegments = fe.searchRoute(ctx, te.getStartPoint(), te.getEndPoint(),
|
||||||
|
te.getTransitPoint());
|
||||||
Set<Long> reachedSegments = new TreeSet<Long>();
|
Set<Long> reachedSegments = new TreeSet<Long>();
|
||||||
Assert.assertNotNull(routeSegments);
|
Assert.assertNotNull(routeSegments);
|
||||||
int prevSegment = -1;
|
int prevSegment = -1;
|
||||||
|
@ -92,7 +97,8 @@ public class RouteTestingTest {
|
||||||
if (i == routeSegments.size() || routeSegments.get(i).getTurnType() != null) {
|
if (i == routeSegments.size() || routeSegments.get(i).getTurnType() != null) {
|
||||||
if (prevSegment >= 0) {
|
if (prevSegment >= 0) {
|
||||||
String name = routeSegments.get(prevSegment).getDescription();
|
String name = routeSegments.get(prevSegment).getDescription();
|
||||||
long segmentId = routeSegments.get(prevSegment).getObject().getId() >> (RouteResultPreparation.SHIFT_ID);
|
long segmentId = routeSegments.get(prevSegment).getObject()
|
||||||
|
.getId() >> (RouteResultPreparation.SHIFT_ID);
|
||||||
System.out.println("segmentId: " + segmentId + " description: " + name);
|
System.out.println("segmentId: " + segmentId + " description: " + name);
|
||||||
}
|
}
|
||||||
prevSegment = i;
|
prevSegment = i;
|
||||||
|
@ -113,7 +119,7 @@ public class RouteTestingTest {
|
||||||
+ reachedSegments.toString(), reachedSegments.contains(es.getKey()));
|
+ reachedSegments.toString(), reachedSegments.contains(es.getKey()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue