Skip to content

Commit 1342b98

Browse files
Improve tests
1 parent 4397d79 commit 1342b98

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

application/src/test/java/org/opentripplanner/gtfs/mapping/CompactShapeTest.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@ void simple() {
2323
assertEquals("[1 (1.0, 2.0), 2 (2.0, 2.0), 3 (3.0, 3.0), 4 (4.0, 4.0)]", points.toString());
2424
}
2525

26+
@Test
27+
void outOfSequence() {
28+
var builder = new CompactShape();
29+
30+
builder.addPoint(shapePoint(4, 4, 4));
31+
builder.addPoint(shapePoint(1, 1, 2));
32+
builder.addPoint(shapePoint(3, 3, 3));
33+
builder.addPoint(shapePoint(2, 2, 2));
34+
35+
var points = ImmutableList.copyOf(builder);
36+
37+
assertEquals("[1 (1.0, 2.0), 2 (2.0, 2.0), 3 (3.0, 3.0), 4 (4.0, 4.0)]", points.toString());
38+
}
39+
2640
@Test
2741
void hole() {
2842
var builder = new CompactShape();
@@ -77,10 +91,10 @@ void holeInDistTraveled() {
7791

7892
builder.addPoint(shapePoint(1, 1, 1, 1d));
7993
builder.addPoint(shapePoint(2, 2, 2, 2d));
80-
builder.addPoint(shapePoint(10, 3, 3, 4d));
8194
builder.addPoint(shapePoint(51, 4, 4));
8295
builder.addPoint(shapePoint(102, 5, 5, 10d));
8396
builder.addPoint(shapePoint(150, 6, 6));
97+
builder.addPoint(shapePoint(10, 3, 3, 4d));
8498

8599
var points = ImmutableList.copyOf(builder);
86100

0 commit comments

Comments
 (0)