-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* remove trailing separator in header * - make only one of route_short_name and route_long_name required - implement the optionality of agency if there only is one * add the remaining stop types and the proper restrictions --------- authored-by: Tobias Kohl <[email protected]>
- Loading branch information
1 parent
b43b440
commit 2da717f
Showing
68 changed files
with
751 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
src/test/java/org/matsim/pt2matsim/gtfs/GtfsMinimalCaseTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* *********************************************************************** * | ||
* project: org.matsim.* | ||
* *********************************************************************** * | ||
* * | ||
* copyright : (C) 2016 by the members listed in the COPYING, * | ||
* LICENSE and WARRANTY file. * | ||
* email : info at matsim dot org * | ||
* * | ||
* *********************************************************************** * | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* See also COPYING, LICENSE and WARRANTY file * | ||
* * | ||
* *********************************************************************** */ | ||
|
||
package org.matsim.pt2matsim.gtfs; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.matsim.core.utils.geometry.transformations.TransformationFactory; | ||
import org.matsim.pt2matsim.gtfs.lib.GtfsDefinitions; | ||
|
||
/** | ||
* This test should check that ftfs datasets, that only do the bare minimum (i.e. do our best | ||
* do not meet the conditions in "conditionally required" and omit the corresponding fields) | ||
* are still converted correctly | ||
* | ||
* @author Tobias Kohl / Senozon | ||
*/ | ||
class GtfsMinimalCaseTest { | ||
|
||
@Test | ||
void noAgencyId() { | ||
GtfsFeed feed = new GtfsFeedImpl("test/gtfs-feed-min/noAgencyId"); | ||
feed.getRoutes().values().forEach(route -> Assertions.assertNotNull(route.getAgency(), "no agency in route " + route.getId())); | ||
Assertions.assertEquals("pt2matsim", feed.getRoutes().get("lineA").getAgency().getAgencyName()); | ||
Assertions.assertEquals("https://github.com/matsim-org/pt2matsim", feed.getRoutes().get("lineB").getAgency().getAgencyUrl()); | ||
Assertions.assertEquals("Europe/Zurich", feed.getRoutes().get("lineC").getAgency().getAgencyTimeZone()); | ||
} | ||
|
||
@Test | ||
void noShortName() { | ||
GtfsFeed feed = new GtfsFeedImpl("test/gtfs-feed-min/noShortName"); | ||
Assertions.assertEquals("Bus Line A", feed.getRoutes().get("lineA").getShortName()); | ||
Assertions.assertEquals("Bus Line A", feed.getRoutes().get("lineA").getLongName()); | ||
Assertions.assertEquals(GtfsDefinitions.RouteType.BUS, feed.getRoutes().get("lineA").getRouteType()); | ||
Assertions.assertEquals("P2M", feed.getRoutes().get("lineB").getAgency().getId()); | ||
} | ||
|
||
@Test | ||
void noLongName() { | ||
GtfsFeed feed = new GtfsFeedImpl("test/gtfs-feed-min/noLongName"); | ||
Assertions.assertEquals("Line A", feed.getRoutes().get("lineA").getShortName()); | ||
Assertions.assertEquals("Line A", feed.getRoutes().get("lineA").getLongName()); | ||
Assertions.assertEquals(GtfsDefinitions.RouteType.BUS, feed.getRoutes().get("lineA").getRouteType()); | ||
Assertions.assertEquals("P2M", feed.getRoutes().get("lineB").getAgency().getId()); | ||
} | ||
|
||
@Test | ||
void noNameAtAll() { | ||
Assertions.assertThrows(IllegalArgumentException.class, () -> new GtfsFeedImpl("test/gtfs-feed-min/noNameAtAll")); | ||
} | ||
|
||
@Test | ||
void multipleAgencies() { | ||
Assertions.assertThrows(IllegalArgumentException.class, () -> new GtfsFeedImpl("test/gtfs-feed-min/multipleAgencies")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
route_id,route_short_name,route_long_name,route_type,agency_id, | ||
route_id,route_short_name,route_long_name,route_type,agency_id | ||
lineA,Line A,Bus Line A,3,S42 | ||
lineB,Line B,Tram Line B,0,P2M | ||
lineC,Line C,Something else,907,P2M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
agency_id,agency_name,agency_url,agency_timezone | ||
P2M,pt2matsim,https://github.com/matsim-org/pt2matsim,Europe/Zurich |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday,start_date,end_date | ||
WEEK,1,1,1,1,1,0,0,20181001,20181007 | ||
EXPR,0,0,0,0,0,0,0,20181001,20181007 | ||
WEND,0,0,0,0,0,1,1,20181001,20181007 | ||
EMPT,1,0,1,1,0,1,0,20181001,20181007 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
service_id,date,exception_type | ||
WEEK,20181006,2 | ||
WEEK,20181007,2 | ||
EXPR,20181005,1 | ||
EMPT,20181002,1 | ||
EMPT,20181001,2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
trip_id,start_time,end_time,headway_secs,exact_times | ||
routeA1,08:00:00,14:00:01,10800,0 | ||
routeA2,09:00:00,15:00:01,10800,0 | ||
routeB,07:00:00,16:00:01,10800,0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
agency_id,agency_name,agency_url,agency_timezone | ||
P2M,pt2matsim,https://github.com/matsim-org/pt2matsim,Europe/Zurich | ||
S42,Service 42,htpps://google.com,Europe/Berlin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday,start_date,end_date | ||
WEEK,1,1,1,1,1,0,0,20181001,20181007 | ||
EXPR,0,0,0,0,0,0,0,20181001,20181007 | ||
WEND,0,0,0,0,0,1,1,20181001,20181007 | ||
EMPT,1,0,1,1,0,1,0,20181001,20181007 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
service_id,date,exception_type | ||
WEEK,20181006,2 | ||
WEEK,20181007,2 | ||
EXPR,20181005,1 | ||
EMPT,20181002,1 | ||
EMPT,20181001,2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
trip_id,start_time,end_time,headway_secs,exact_times | ||
routeA1,08:00:00,14:00:01,10800,0 | ||
routeA2,09:00:00,15:00:01,10800,0 | ||
routeB,07:00:00,16:00:01,10800,0 |
Oops, something went wrong.