Permalink
Browse files

fix tests: add routing context null checks, default to no path parsers

  • Loading branch information...
1 parent 9478501 commit d355e8d9523f747b23e62217d201e51c479b26b6 @abyrd abyrd committed May 21, 2012
@@ -74,7 +74,7 @@
*/
public long searchAbortTime = 0;
- public PathParser[] pathParsers = new PathParser[] {new BasicPathParser()};
+ public PathParser[] pathParsers = new PathParser[]{}; // { new BasicPathParser() };
/* CONSTRUCTORS */
@@ -97,8 +97,10 @@ public State(Vertex vertex, long time, RoutingRequest options) {
this.stateData.tripSeqHash = 0;
this.stateData.usingRentedBike = false;
this.time = time;
- this.pathParserStates = new int[options.rctx.pathParsers.length];
- Arrays.fill(this.pathParserStates, AutomatonState.START);
+ if (options.rctx != null) {
+ this.pathParserStates = new int[options.rctx.pathParsers.length];
+ Arrays.fill(this.pathParserStates, AutomatonState.START);
+ }
}
/**
@@ -457,7 +457,10 @@ private void cloneStateDataAsNeeded() {
child.stateData = child.stateData.clone();
}
+ /** return true if all PathParsers advanced to a state other than REJECT */
public boolean parsePath(State state) {
+ if (state.stateData.opt.rctx == null)
+ return true; // a lot of tests don't set a routing context
PathParser[] parsers = state.stateData.opt.rctx.pathParsers;
int[] parserStates = state.pathParserStates;
boolean accept = true;
@@ -27,10 +27,8 @@ public void testAddToExistingResultChain() {
/* note: times are rounded to seconds toward zero */
- //TraverseOptions opt = new TraverseOptions();
-
for (int i = 0; i < 4; i++) {
- State r = new State(null, i * 1000, null);
+ State r = new State(null, i * 1000, new RoutingRequest());
resultChain = r.addToExistingResultChain(resultChain);
}

0 comments on commit d355e8d

Please sign in to comment.