@@ -189,7 +189,7 @@ public void testCalcShortestPath() {
189
189
GraphHopperStorage ghStorage = createTestStorage ();
190
190
RoutingAlgorithm algo = createAlgo (ghStorage );
191
191
Path p = algo .calcPath (0 , 7 );
192
- assertEquals (p .toString (), IntArrayList .from (new int []{ 0 , 4 , 5 , 7 } ), p .calcNodes ());
192
+ assertEquals (p .toString (), IntArrayList .from (0 , 4 , 5 , 7 ), p .calcNodes ());
193
193
assertEquals (p .toString (), 62.1 , p .getDistance (), .1 );
194
194
}
195
195
@@ -218,7 +218,7 @@ public void testSimpleAlternative() {
218
218
graph .edge (4 , 1 , 9 , true );
219
219
Path p = createAlgo (graph ).calcPath (0 , 4 );
220
220
assertEquals (p .toString (), 20 , p .getDistance (), 1e-4 );
221
- assertEquals (IntArrayList .from (new int []{ 0 , 2 , 1 , 4 } ), p .calcNodes ());
221
+ assertEquals (IntArrayList .from (0 , 2 , 1 , 4 ), p .calcNodes ());
222
222
}
223
223
224
224
@ Test
@@ -231,7 +231,7 @@ public void testBidirectionalLinear() {
231
231
graph .edge (4 , 1 , 9 , true );
232
232
Path p = createAlgo (graph ).calcPath (3 , 5 );
233
233
assertEquals (p .toString (), 28 , p .getDistance (), 1e-4 );
234
- assertEquals (IntArrayList .from (new int []{ 3 , 2 , 1 , 4 , 5 } ), p .calcNodes ());
234
+ assertEquals (IntArrayList .from (3 , 2 , 1 , 4 , 5 ), p .calcNodes ());
235
235
}
236
236
237
237
// see calc-fastest-graph.svg
@@ -241,7 +241,7 @@ public void testCalcFastestPath() {
241
241
initDirectedAndDiffSpeed (graphShortest , carEncoder );
242
242
Path p1 = createAlgo (graphShortest , defaultOpts ).
243
243
calcPath (0 , 3 );
244
- assertEquals (IntArrayList .from (new int []{ 0 , 1 , 5 , 2 , 3 } ), p1 .calcNodes ());
244
+ assertEquals (IntArrayList .from (0 , 1 , 5 , 2 , 3 ), p1 .calcNodes ());
245
245
assertEquals (p1 .toString (), 402.3 , p1 .getDistance (), .1 );
246
246
assertEquals (p1 .toString (), 144823 , p1 .getTime ());
247
247
@@ -251,7 +251,7 @@ public void testCalcFastestPath() {
251
251
initDirectedAndDiffSpeed (graphFastest , carEncoder );
252
252
Path p2 = createAlgo (graphFastest , opts ).
253
253
calcPath (0 , 3 );
254
- assertEquals (IntArrayList .from (new int []{ 0 , 4 , 6 , 7 , 5 , 3 } ), p2 .calcNodes ());
254
+ assertEquals (IntArrayList .from (0 , 4 , 6 , 7 , 5 , 3 ), p2 .calcNodes ());
255
255
assertEquals (p2 .toString (), 1261.7 , p2 .getDistance (), 0.1 );
256
256
assertEquals (p2 .toString (), 111442 , p2 .getTime ());
257
257
}
@@ -306,7 +306,7 @@ public void testCalcFootPath() {
306
306
calcPath (0 , 7 );
307
307
assertEquals (p1 .toString (), 17000 , p1 .getDistance (), 1e-6 );
308
308
assertEquals (p1 .toString (), 12240 * 1000 , p1 .getTime ());
309
- assertEquals (IntArrayList .from (new int []{ 0 , 4 , 5 , 7 } ), p1 .calcNodes ());
309
+ assertEquals (IntArrayList .from (0 , 4 , 5 , 7 ), p1 .calcNodes ());
310
310
}
311
311
312
312
protected void initFootVsCar (Graph graph ) {
@@ -415,14 +415,14 @@ public void testNoPathFound() {
415
415
public void testWikipediaShortestPath () {
416
416
GraphHopperStorage ghStorage = createWikipediaTestGraph ();
417
417
Path p = createAlgo (ghStorage ).calcPath (0 , 4 );
418
- assertEquals (p .toString (), IntArrayList .from (new int []{ 0 , 2 , 5 , 4 } ), p .calcNodes ());
418
+ assertEquals (p .toString (), IntArrayList .from (0 , 2 , 5 , 4 ), p .calcNodes ());
419
419
assertEquals (p .toString (), 20 , p .getDistance (), 1e-4 );
420
420
}
421
421
422
422
@ Test
423
423
public void testCalcIf1EdgeAway () {
424
424
Path p = createAlgo (createTestStorage ()).calcPath (1 , 2 );
425
- assertEquals (IntArrayList .from (new int []{ 1 , 2 } ), p .calcNodes ());
425
+ assertEquals (IntArrayList .from (1 , 2 ), p .calcNodes ());
426
426
assertEquals (p .toString (), 35.1 , p .getDistance (), .1 );
427
427
}
428
428
@@ -449,12 +449,12 @@ public void testBidirectional() {
449
449
// PrepareTowerNodesShortcutsTest.printEdges((CHGraph) graph);
450
450
Path p = createAlgo (graph ).calcPath (0 , 4 );
451
451
// PrepareTowerNodesShortcutsTest.printEdges((CHGraph) graph);
452
- assertEquals (p .toString (), IntArrayList .from (new int []{ 0 , 7 , 6 , 8 , 3 , 4 } ), p .calcNodes ());
452
+ assertEquals (p .toString (), IntArrayList .from (0 , 7 , 6 , 8 , 3 , 4 ), p .calcNodes ());
453
453
assertEquals (p .toString (), 335.8 , p .getDistance (), .1 );
454
454
455
455
p = createAlgo (graph ).calcPath (1 , 2 );
456
456
// the other way around is even larger as 0-1 is already 11008.452
457
- assertEquals (p .toString (), IntArrayList .from (new int []{ 1 , 2 } ), p .calcNodes ());
457
+ assertEquals (p .toString (), IntArrayList .from (1 , 2 ), p .calcNodes ());
458
458
assertEquals (p .toString (), 10007.7 , p .getDistance (), .1 );
459
459
}
460
460
@@ -518,7 +518,7 @@ public void testBidirectional2() {
518
518
Path p = createAlgo (graph ).calcPath (0 , 4 );
519
519
assertEquals (p .toString (), 40 , p .getDistance (), 1e-4 );
520
520
assertEquals (p .toString (), 5 , p .calcNodes ().size ());
521
- assertEquals (IntArrayList .from (new int []{ 0 , 7 , 6 , 5 , 4 } ), p .calcNodes ());
521
+ assertEquals (IntArrayList .from (0 , 7 , 6 , 5 , 4 ), p .calcNodes ());
522
522
}
523
523
524
524
@ Test
@@ -529,9 +529,9 @@ public void testRekeyBugOfIntBinHeap() {
529
529
assertEquals (12 , p .calcNodes ().size ());
530
530
531
531
IntIndexedContainer list = p .calcNodes ();
532
- if (!IntArrayList .from (new int []{ 36 , 46 , 56 , 66 , 76 , 86 , 85 , 84 , 94 , 93 , 92 , 91 } ).equals (list )
533
- && !IntArrayList .from (new int []{ 36 , 46 , 56 , 66 , 76 , 86 , 85 , 84 , 83 , 82 , 92 , 91 } ).equals (list )) {
534
- assertTrue ("wrong locations: " + list .toString (), false );
532
+ if (!IntArrayList .from (36 , 46 , 56 , 66 , 76 , 86 , 85 , 84 , 94 , 93 , 92 , 91 ).equals (list )
533
+ && !IntArrayList .from (36 , 46 , 56 , 66 , 76 , 86 , 85 , 84 , 83 , 82 , 92 , 91 ).equals (list )) {
534
+ fail ("wrong locations: " + list .toString ());
535
535
}
536
536
assertEquals (66f , p .getDistance (), 1e-3 );
537
537
@@ -541,14 +541,14 @@ public void testRekeyBugOfIntBinHeap() {
541
541
542
542
public void testBug1 (GraphHopperStorage g ) {
543
543
Path p = createAlgo (g ).calcPath (34 , 36 );
544
- assertEquals (IntArrayList .from (new int []{ 34 , 35 , 36 } ), p .calcNodes ());
544
+ assertEquals (IntArrayList .from (34 , 35 , 36 ), p .calcNodes ());
545
545
assertEquals (3 , p .calcNodes ().size ());
546
546
assertEquals (17 , p .getDistance (), 1e-5 );
547
547
}
548
548
549
549
public void testCorrectWeight (GraphHopperStorage g ) {
550
550
Path p = createAlgo (g ).calcPath (45 , 72 );
551
- assertEquals (IntArrayList .from (new int []{ 45 , 44 , 54 , 64 , 74 , 73 , 72 } ), p .calcNodes ());
551
+ assertEquals (IntArrayList .from (45 , 44 , 54 , 64 , 74 , 73 , 72 ), p .calcNodes ());
552
552
assertEquals (38f , p .getDistance (), 1e-3 );
553
553
}
554
554
@@ -573,7 +573,7 @@ public void testDirectedGraphBug1() {
573
573
graph .edge (4 , 2 , 1 , false );
574
574
575
575
Path p = createAlgo (graph ).calcPath (0 , 2 );
576
- assertEquals (IntArrayList .from (new int []{ 0 , 1 , 2 } ), p .calcNodes ());
576
+ assertEquals (IntArrayList .from (0 , 1 , 2 ), p .calcNodes ());
577
577
assertEquals (p .toString (), 5.99 , p .getDistance (), 1e-4 );
578
578
assertEquals (p .toString (), 3 , p .calcNodes ().size ());
579
579
}
@@ -588,7 +588,7 @@ public void testDirectedGraphBug2() {
588
588
graph .edge (3 , 1 , 4 , true );
589
589
590
590
Path p = createAlgo (graph ).calcPath (0 , 3 );
591
- assertEquals (IntArrayList .from (new int []{ 0 , 1 , 2 , 3 } ), p .calcNodes ());
591
+ assertEquals (IntArrayList .from (0 , 1 , 2 , 3 ), p .calcNodes ());
592
592
}
593
593
594
594
// a-b-0-c-1
@@ -620,12 +620,12 @@ public void testWithCoordinates() {
620
620
AlgorithmOptions opts = new AlgorithmOptions (DIJKSTRA_BI , weighting );
621
621
RoutingAlgorithmFactory prepare = createFactory (graph , opts );
622
622
Path p = prepare .createAlgo (getGraph (graph , opts .getWeighting ()), opts ).calcPath (4 , 0 );
623
- assertEquals (IntArrayList .from (new int []{ 4 , 1 , 0 } ), p .calcNodes ());
623
+ assertEquals (IntArrayList .from (4 , 1 , 0 ), p .calcNodes ());
624
624
assertEquals (Helper .createPointList (0 , 2 , 1 , 1.5 , 1.5 , 1 , 1 , 0.6 ), p .calcPoints ());
625
625
assertEquals (274128 , p .calcPoints ().calcDistance (new DistanceCalcEarth ()), 1 );
626
626
627
627
p = prepare .createAlgo (getGraph (graph , opts .getWeighting ()), opts ).calcPath (2 , 1 );
628
- assertEquals (IntArrayList .from (new int []{ 2 , 0 , 1 } ), p .calcNodes ());
628
+ assertEquals (IntArrayList .from (2 , 0 , 1 ), p .calcNodes ());
629
629
assertEquals (Helper .createPointList (0 , 0 , 1 , 0.6 , 1.5 , 1 , 1 , 1.5 ), p .calcPoints ());
630
630
assertEquals (279482 , p .calcPoints ().calcDistance (new DistanceCalcEarth ()), 1 );
631
631
}
@@ -643,20 +643,20 @@ public void testViaEdges_FromEqualsTo() {
643
643
// identical tower nodes
644
644
Path p = calcPathViaQuery (ghStorage , 0.001 , 0.000 , 0.001 , 0.000 );
645
645
assertTrue (p .isFound ());
646
- assertEquals (IntArrayList .from (new int []{ 0 } ), p .calcNodes ());
646
+ assertEquals (IntArrayList .from (0 ), p .calcNodes ());
647
647
// assertEquals(1, p.calcPoints().size());
648
648
assertEquals (p .toString (), 0 , p .getDistance (), 1e-4 );
649
649
650
650
// identical query points on edge
651
651
p = calcPath (ghStorage , 0 , 1 , 0 , 1 );
652
652
assertTrue (p .isFound ());
653
- assertEquals (IntArrayList .from (new int []{ 8 } ), p .calcNodes ());
653
+ assertEquals (IntArrayList .from (8 ), p .calcNodes ());
654
654
// assertEquals(1, p.calcPoints().size());
655
655
assertEquals (p .toString (), 0 , p .getDistance (), 1e-4 );
656
656
657
657
// very close
658
658
p = calcPathViaQuery (ghStorage , 0.00092 , 0 , 0.00091 , 0 );
659
- assertEquals (IntArrayList .from (new int []{ 8 , 9 } ), p .calcNodes ());
659
+ assertEquals (IntArrayList .from (8 , 9 ), p .calcNodes ());
660
660
assertEquals (p .toString (), 1.11 , p .getDistance (), .1 );
661
661
}
662
662
@@ -667,20 +667,20 @@ public void testViaEdges_BiGraph() {
667
667
668
668
// 0-7 to 4-3
669
669
Path p = calcPathViaQuery (graph , 0.0009 , 0 , 0.001 , 0.001105 );
670
- assertEquals (p .toString (), IntArrayList .from (new int []{ 10 , 7 , 6 , 8 , 3 , 9 } ), p .calcNodes ());
670
+ assertEquals (p .toString (), IntArrayList .from (10 , 7 , 6 , 8 , 3 , 9 ), p .calcNodes ());
671
671
assertEquals (p .toString (), 324.11 , p .getDistance (), 0.01 );
672
672
673
673
// 0-1 to 2-3
674
674
p = calcPathViaQuery (graph , 0.001 , 0.0001 , 0.010 , 0.0011 );
675
- assertEquals (p .toString (), IntArrayList .from (new int []{ 0 , 7 , 6 , 8 , 3 , 9 } ), p .calcNodes ());
675
+ assertEquals (p .toString (), IntArrayList .from (0 , 7 , 6 , 8 , 3 , 9 ), p .calcNodes ());
676
676
assertEquals (p .toString (), 1335.35 , p .getDistance (), 0.01 );
677
677
}
678
678
679
679
@ Test
680
680
public void testViaEdges_WithCoordinates () {
681
681
GraphHopperStorage ghStorage = createTestStorage ();
682
682
Path p = calcPath (ghStorage , 0 , 1 , 2 , 3 );
683
- assertEquals (IntArrayList .from (new int []{ 8 , 1 , 2 , 9 } ), p .calcNodes ());
683
+ assertEquals (IntArrayList .from (8 , 1 , 2 , 9 ), p .calcNodes ());
684
684
assertEquals (p .toString (), 56.7 , p .getDistance (), .1 );
685
685
}
686
686
@@ -704,17 +704,17 @@ public void testViaEdges_SpecialCases() {
704
704
705
705
// 0-1 to 3-4
706
706
Path p = calcPathViaQuery (graph , 0.00010 , 0.00001 , 0 , 0.00009 );
707
- assertEquals (IntArrayList .from (new int []{ 5 , 1 , 2 , 3 , 6 } ), p .calcNodes ());
707
+ assertEquals (IntArrayList .from (5 , 1 , 2 , 3 , 6 ), p .calcNodes ());
708
708
assertEquals (p .toString (), 26.81 , p .getDistance (), .1 );
709
709
710
710
// overlapping edges: 2-3 and 3-2
711
711
p = calcPathViaQuery (graph , 0.000049 , 0.00014 , 0.00001 , 0.0001 );
712
- assertEquals (IntArrayList .from (new int []{ 5 , 6 } ), p .calcNodes ());
712
+ assertEquals (IntArrayList .from (5 , 6 ), p .calcNodes ());
713
713
assertEquals (p .toString (), 6.2 , p .getDistance (), .1 );
714
714
715
715
// 'from' and 'to' edge share one node '2': 1-2 to 3-2
716
716
p = calcPathViaQuery (graph , 0.00009 , 0.00011 , 0.00001 , 0.00011 );
717
- assertEquals (p .toString (), IntArrayList .from (new int []{ 6 , 2 , 5 } ), p .calcNodes ());
717
+ assertEquals (p .toString (), IntArrayList .from (6 , 2 , 5 ), p .calcNodes ());
718
718
assertEquals (p .toString (), 12.57 , p .getDistance (), .1 );
719
719
}
720
720
@@ -724,7 +724,7 @@ public void testQueryGraphAndFastest() {
724
724
GraphHopperStorage graph = createGHStorage (encodingManager , Arrays .asList (weighting ), false );
725
725
initDirectedAndDiffSpeed (graph , carEncoder );
726
726
Path p = calcPathViaQuery (weighting , graph , 0.002 , 0.0005 , 0.0017 , 0.0031 );
727
- assertEquals (IntArrayList .from (new int []{ 8 , 1 , 5 , 3 , 9 } ), p .calcNodes ());
727
+ assertEquals (IntArrayList .from (8 , 1 , 5 , 3 , 9 ), p .calcNodes ());
728
728
assertEquals (602.98 , p .getDistance (), 1e-1 );
729
729
}
730
730
@@ -814,7 +814,7 @@ public void test0SpeedButUnblocked_Issue242() {
814
814
RoutingAlgorithm algo = createAlgo (graph );
815
815
try {
816
816
Path p = algo .calcPath (0 , 2 );
817
- assertTrue ( false );
817
+ fail ( "there should have been an exception" );
818
818
} catch (Exception ex ) {
819
819
assertTrue (ex .getMessage (), ex .getMessage ().startsWith ("Speed cannot be 0" ));
820
820
}
@@ -878,7 +878,7 @@ public String getName() {
878
878
initEleGraph (graph );
879
879
Path p = createAlgo (graph , opts ).calcPath (0 , 10 );
880
880
// GHUtility.printEdgeInfo(graph, carEncoder);
881
- assertEquals (IntArrayList .from (new int []{ 0 , 4 , 6 , 10 } ), p .calcNodes ());
881
+ assertEquals (IntArrayList .from (0 , 4 , 6 , 10 ), p .calcNodes ());
882
882
883
883
AlgorithmOptions fakeOpts = AlgorithmOptions .start ().weighting (fakeWeighting ).build ();
884
884
graph = createGHStorage (encodingManager , Arrays .asList (fakeOpts .getWeighting ()), true );
@@ -889,7 +889,7 @@ public String getName() {
889
889
RoutingAlgorithmFactory factory = createFactory (graph , fakeOpts );
890
890
QueryGraph qGraph = new QueryGraph (getGraph (graph , fakeWeighting )).lookup (from , to );
891
891
p = factory .createAlgo (qGraph , fakeOpts ).calcPath (from .getClosestNode (), to .getClosestNode ());
892
- assertEquals (IntArrayList .from (new int []{ 12 , 0 , 1 , 2 , 11 , 7 , 10 , 13 } ), p .calcNodes ());
892
+ assertEquals (IntArrayList .from (12 , 0 , 1 , 2 , 11 , 7 , 10 , 13 ), p .calcNodes ());
893
893
assertEquals (37009621 , p .getTime ());
894
894
assertEquals (616827 , p .getDistance (), 1 );
895
895
assertEquals (493462 , p .getWeight (), 1 );
@@ -918,7 +918,7 @@ public void testMultipleVehicles_issue548() {
918
918
RoutingAlgorithm algoCar = createFactory (ghStorage , carOptions ).
919
919
createAlgo (getGraph (ghStorage , carWeighting ), carOptions );
920
920
Path p1 = algoCar .calcPath (0 , 7 );
921
- assertEquals (IntArrayList .from (new int []{ 0 , 1 , 5 , 6 , 7 } ), p1 .calcNodes ());
921
+ assertEquals (IntArrayList .from (0 , 1 , 5 , 6 , 7 ), p1 .calcNodes ());
922
922
assertEquals (p1 .toString (), 26000 , p1 .getDistance (), 1e-6 );
923
923
}
924
924
0 commit comments