mirror of https://github.com/apache/lucene.git
Make TestShapesGeo a base class and randomize selection of distance calculator instead of testing all of them every time.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene3795_lsp_spatial_module@1291615 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8fc20e2b77
commit
5db69b3be6
|
@ -218,7 +218,7 @@ public abstract class AbstractTestShapes extends LuceneTestCase {
|
|||
default: fail(""+ic);
|
||||
}
|
||||
}
|
||||
System.out.println("Laps: "+laps);
|
||||
//System.out.println("Laps: "+laps);
|
||||
|
||||
//TODO deliberately test INTERSECTS based on known intersection point
|
||||
}
|
||||
|
|
|
@ -19,17 +19,17 @@ package org.apache.lucene.spatial.base.shape;
|
|||
|
||||
import org.apache.lucene.spatial.base.context.SpatialContext;
|
||||
import org.apache.lucene.spatial.base.context.simple.SimpleSpatialContext;
|
||||
import org.apache.lucene.spatial.base.distance.*;
|
||||
import org.junit.Ignore;
|
||||
import org.apache.lucene.spatial.base.distance.DistanceCalculator;
|
||||
import org.apache.lucene.spatial.base.distance.DistanceUnits;
|
||||
import org.apache.lucene.spatial.base.distance.GeodesicSphereDistCalc;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.apache.lucene.spatial.base.shape.SpatialRelation.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* @author David Smiley - dsmiley@mitre.org
|
||||
*/
|
||||
public abstract class TestShapesGeo extends AbstractTestShapes {
|
||||
public class TestShapesGeo extends AbstractTestShapes {
|
||||
|
||||
@Test
|
||||
public void testGeoRectangle() {
|
||||
|
@ -129,37 +129,22 @@ public abstract class TestShapesGeo extends AbstractTestShapes {
|
|||
return ctx.getDistCalc().degreesToDistance(deg);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
public static class TestLawOfCosines extends TestShapesGeo {
|
||||
|
||||
@Override
|
||||
protected SpatialContext getContext() {
|
||||
DistanceUnits units = DistanceUnits.KILOMETERS;
|
||||
return new SimpleSpatialContext(units,
|
||||
new GeodesicSphereDistCalc.LawOfCosines(units.earthRadius()),
|
||||
SpatialContext.GEO_WORLDBOUNDS);
|
||||
@Override
|
||||
protected SpatialContext getContext() {
|
||||
DistanceUnits units = DistanceUnits.KILOMETERS;
|
||||
DistanceCalculator distCalc = new GeodesicSphereDistCalc.Haversine(units.earthRadius());//default
|
||||
switch(random.nextInt(3)) {
|
||||
case 2:
|
||||
//TODO ENABLE WHEN WORKING
|
||||
//distCalc = new GeodesicSphereDistCalc.LawOfCosines(units.earthRadius());
|
||||
break;
|
||||
case 1:
|
||||
distCalc = new GeodesicSphereDistCalc.Vincenty(units.earthRadius());
|
||||
break;
|
||||
}
|
||||
return new SimpleSpatialContext(units,
|
||||
distCalc,
|
||||
SpatialContext.GEO_WORLDBOUNDS);
|
||||
}
|
||||
|
||||
public static class TestHaversine extends TestShapesGeo {
|
||||
|
||||
@Override
|
||||
protected SpatialContext getContext() {
|
||||
DistanceUnits units = DistanceUnits.KILOMETERS;
|
||||
return new SimpleSpatialContext(units,
|
||||
new GeodesicSphereDistCalc.Haversine(units.earthRadius()),
|
||||
SpatialContext.GEO_WORLDBOUNDS);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TestVincentySphere extends TestShapesGeo {
|
||||
|
||||
@Override
|
||||
protected SpatialContext getContext() {
|
||||
DistanceUnits units = DistanceUnits.KILOMETERS;
|
||||
return new SimpleSpatialContext(units,
|
||||
new GeodesicSphereDistCalc.Vincenty(units.earthRadius()),
|
||||
SpatialContext.GEO_WORLDBOUNDS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue