Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* This enum defines the railway class of an edge. It maps the railway=* key of OSM to an enum. All edges that do not fit get OTHER as value.
*/
public enum RailwayClass {
OTHER, RAIL, SUBWAY, TRAM, NARROW_GAUGE, LIGHT_RAIL, FUNICULAR, CONSTRUCTION;
OTHER, RAIL, SUBWAY, TRAM, LIGHT_RAIL, FUNICULAR, CONSTRUCTION, MONORAIL, PROPOSED;

public static final String KEY = "railway_class";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void railwayClass() {
way = new ReaderWay(29L);
way.setTag("railway", "narrow_gauge");
parser.handleWayTags(edgeId, edgeIntAccess, way, relFlags);
assertEquals(RailwayClass.NARROW_GAUGE, classEnc.getEnum(false, edgeId, edgeIntAccess));
assertEquals(RailwayClass.OTHER, classEnc.getEnum(false, edgeId, edgeIntAccess));

edgeIntAccess = new ArrayEdgeIntAccess(1);
way = new ReaderWay(29L);
Expand All @@ -76,6 +76,18 @@ void railwayClass() {
way.setTag("railway", "construction");
parser.handleWayTags(edgeId, edgeIntAccess, way, relFlags);
assertEquals(RailwayClass.CONSTRUCTION, classEnc.getEnum(false, edgeId, edgeIntAccess));

edgeIntAccess = new ArrayEdgeIntAccess(1);
way = new ReaderWay(29L);
way.setTag("railway", "proposed");
parser.handleWayTags(edgeId, edgeIntAccess, way, relFlags);
assertEquals(RailwayClass.PROPOSED, classEnc.getEnum(false, edgeId, edgeIntAccess));

edgeIntAccess = new ArrayEdgeIntAccess(1);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these tests that came with open rail routing? I don't find them particularly readable 😅 are they just asserting that the values exist in the enum?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, they mostly came with the project. We added some additional ones as well. The test is actually exercising the class and making expectations on the output based on the inputs.

way = new ReaderWay(29L);
way.setTag("railway", "monorail");
parser.handleWayTags(edgeId, edgeIntAccess, way, relFlags);
assertEquals(RailwayClass.MONORAIL, classEnc.getEnum(false, edgeId, edgeIntAccess));
}

}
Loading