Fix tests
This commit is contained in:
parent
c5e3a5080a
commit
c9859cc9fc
3 changed files with 37 additions and 12 deletions
|
@ -29,16 +29,12 @@ 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;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by yurkiss on 04.03.16.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
public class RouteTestingTestIgnore {
|
public class RouteTestingTest {
|
||||||
private TestEntry te;
|
private TestEntry te;
|
||||||
|
|
||||||
|
|
||||||
public RouteTestingTestIgnore(String name, TestEntry te) {
|
public RouteTestingTest(String name, TestEntry te) {
|
||||||
this.te = te;
|
this.te = te;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,11 +46,14 @@ public class RouteTestingTestIgnore {
|
||||||
@Parameterized.Parameters(name = "{index}: {0}")
|
@Parameterized.Parameters(name = "{index}: {0}")
|
||||||
public static Iterable<Object[]> data() throws IOException {
|
public static Iterable<Object[]> data() throws IOException {
|
||||||
String fileName = "/test_routing.json";
|
String fileName = "/test_routing.json";
|
||||||
Reader reader = new InputStreamReader(RouteTestingTestIgnore.class.getResourceAsStream(fileName));
|
Reader reader = new InputStreamReader(RouteTestingTest.class.getResourceAsStream(fileName));
|
||||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
TestEntry[] testEntries = gson.fromJson(reader, TestEntry[].class);
|
TestEntry[] testEntries = gson.fromJson(reader, TestEntry[].class);
|
||||||
ArrayList<Object[]> arrayList = new ArrayList<>();
|
ArrayList<Object[]> arrayList = new ArrayList<>();
|
||||||
for(TestEntry te : testEntries) {
|
for(TestEntry te : testEntries) {
|
||||||
|
if(te.isIgnore()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
arrayList.add(new Object[] {te.getTestName(), te});
|
arrayList.add(new Object[] {te.getTestName(), te});
|
||||||
}
|
}
|
||||||
reader.close();
|
reader.close();
|
||||||
|
@ -76,7 +75,7 @@ public class RouteTestingTestIgnore {
|
||||||
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(), null);
|
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;
|
|
@ -2,6 +2,8 @@ package net.osmand.router;
|
||||||
|
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,6 +14,9 @@ public class TestEntry {
|
||||||
private String testName;
|
private String testName;
|
||||||
private LatLon startPoint;
|
private LatLon startPoint;
|
||||||
private LatLon endPoint;
|
private LatLon endPoint;
|
||||||
|
private LatLon transitPoint1;
|
||||||
|
private LatLon transitPoint2;
|
||||||
|
private LatLon transitPoint3;
|
||||||
private boolean ignore;
|
private boolean ignore;
|
||||||
private Map<Long, String> expectedResults;
|
private Map<Long, String> expectedResults;
|
||||||
private Map<String, String> params;
|
private Map<String, String> params;
|
||||||
|
@ -27,6 +32,21 @@ public class TestEntry {
|
||||||
return shortWay;
|
return shortWay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<LatLon> getTransitPoint() {
|
||||||
|
ArrayList<LatLon> arrayList = new ArrayList<>();
|
||||||
|
if(transitPoint1 != null) {
|
||||||
|
arrayList.add(transitPoint1);
|
||||||
|
}
|
||||||
|
if(transitPoint2 != null) {
|
||||||
|
arrayList.add(transitPoint2);
|
||||||
|
}
|
||||||
|
if(transitPoint3 != null) {
|
||||||
|
arrayList.add(transitPoint3);
|
||||||
|
}
|
||||||
|
return arrayList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public int getPlanRoadDirection() {
|
public int getPlanRoadDirection() {
|
||||||
return planRoadDirection;
|
return planRoadDirection;
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
"params": {
|
"params": {
|
||||||
"vehicle": "car",
|
"vehicle": "car",
|
||||||
"short_way": "true",
|
"short_way": "true",
|
||||||
"planRoadDirection": "0"
|
"planRoadDirection": "-1"
|
||||||
},
|
},
|
||||||
"ignore":true,
|
|
||||||
"startPoint": {
|
"startPoint": {
|
||||||
"latitude": 45.90810929390909,
|
"latitude": 45.90810929390909,
|
||||||
"longitude": 35.25023227930072
|
"longitude": 35.25023227930072
|
||||||
|
@ -24,6 +24,7 @@
|
||||||
{
|
{
|
||||||
"testName": "5.Route depends on the distance to a junction, if routing engine takes the longer way https://github.com/osmandapp/Osmand/issues/1200",
|
"testName": "5.Route depends on the distance to a junction, if routing engine takes the longer way https://github.com/osmandapp/Osmand/issues/1200",
|
||||||
"description": "Подтверждается только неверный маршрут. От дистанции не зависит, но зависит от planRoadDirection. При -1 маршрут верный, при 0 - нет",
|
"description": "Подтверждается только неверный маршрут. От дистанции не зависит, но зависит от planRoadDirection. При -1 маршрут верный, при 0 - нет",
|
||||||
|
"ignore" : "true",
|
||||||
"params": {
|
"params": {
|
||||||
"vehicle": "car",
|
"vehicle": "car",
|
||||||
"short_way": "true",
|
"short_way": "true",
|
||||||
|
@ -64,6 +65,7 @@
|
||||||
{
|
{
|
||||||
"testName": "6.Intermediate destination is not routed on residential ways https://github.com/osmandapp/Osmand/issues/2362",
|
"testName": "6.Intermediate destination is not routed on residential ways https://github.com/osmandapp/Osmand/issues/2362",
|
||||||
"description": "Не воспроизводится",
|
"description": "Не воспроизводится",
|
||||||
|
|
||||||
"params": {
|
"params": {
|
||||||
"vehicle": "car",
|
"vehicle": "car",
|
||||||
"short_way": "true",
|
"short_way": "true",
|
||||||
|
@ -73,7 +75,7 @@
|
||||||
"latitude": 45.897651835396935,
|
"latitude": 45.897651835396935,
|
||||||
"longitude": 35.38294060528281
|
"longitude": 35.38294060528281
|
||||||
},
|
},
|
||||||
"transitPoint": {
|
"transitPoint1": {
|
||||||
"latitude": 45.89895,
|
"latitude": 45.89895,
|
||||||
"longitude": 35.3849
|
"longitude": 35.3849
|
||||||
},
|
},
|
||||||
|
@ -88,6 +90,7 @@
|
||||||
{
|
{
|
||||||
"testName": "10.Longer route preferred? https://github.com/osmandapp/Osmand/issues/1941",
|
"testName": "10.Longer route preferred? https://github.com/osmandapp/Osmand/issues/1941",
|
||||||
"description": "short_way строит не самый короткий путь. Транзит через MEX 261 короче.",
|
"description": "short_way строит не самый короткий путь. Транзит через MEX 261 короче.",
|
||||||
|
"ignore" : "true",
|
||||||
"params": {
|
"params": {
|
||||||
"vehicle": "car",
|
"vehicle": "car",
|
||||||
"short_way": "true",
|
"short_way": "true",
|
||||||
|
@ -107,6 +110,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"testName": "12.Bizarre navigation at Sundance dr & Sentinel dr in Fremont, CA, USA https://github.com/osmandapp/Osmand/issues/1743",
|
"testName": "12.Bizarre navigation at Sundance dr & Sentinel dr in Fremont, CA, USA https://github.com/osmandapp/Osmand/issues/1743",
|
||||||
|
"ignore" : "true",
|
||||||
"params": {
|
"params": {
|
||||||
"vehicle": "car",
|
"vehicle": "car",
|
||||||
"short_way": "true",
|
"short_way": "true",
|
||||||
|
@ -127,6 +131,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"testName": "12.1.Bizarre navigation at Sundance dr & Sentinel dr in Fremont, CA, USA (transit2 point) https://github.com/osmandapp/Osmand/issues/1743",
|
"testName": "12.1.Bizarre navigation at Sundance dr & Sentinel dr in Fremont, CA, USA (transit2 point) https://github.com/osmandapp/Osmand/issues/1743",
|
||||||
|
"ignore" : "true",
|
||||||
"params": {
|
"params": {
|
||||||
"vehicle": "car",
|
"vehicle": "car",
|
||||||
"short_way": "true",
|
"short_way": "true",
|
||||||
|
@ -136,7 +141,7 @@
|
||||||
"latitude": 45.84882743070033,
|
"latitude": 45.84882743070033,
|
||||||
"longitude": 35.2621882259846
|
"longitude": 35.2621882259846
|
||||||
},
|
},
|
||||||
"transitPoint": {
|
"transitPoint1": {
|
||||||
"latitude": 45.84813,
|
"latitude": 45.84813,
|
||||||
"longitude": 35.275932
|
"longitude": 35.275932
|
||||||
},
|
},
|
||||||
|
@ -150,6 +155,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"testName": "12.2.Bizarre navigation at Sundance dr & Sentinel dr in Fremont, CA, USA (reverse) https://github.com/osmandapp/Osmand/issues/1743",
|
"testName": "12.2.Bizarre navigation at Sundance dr & Sentinel dr in Fremont, CA, USA (reverse) https://github.com/osmandapp/Osmand/issues/1743",
|
||||||
|
"ignore" : "true",
|
||||||
"params": {
|
"params": {
|
||||||
"vehicle": "car",
|
"vehicle": "car",
|
||||||
"short_way": "true",
|
"short_way": "true",
|
||||||
|
|
Loading…
Reference in a new issue