Commit df3fc8c1 authored by Volker Krause's avatar Volker Krause
Browse files

Remove unused train station timezone helper method

This is meanwhile done more generically in the post-processing code.
parent ef761bfe
......@@ -106,26 +106,21 @@ private Q_SLOTS:
{
auto station = KnowledgeDb::stationForIbnr(IBNR{1234567});
QVERIFY(!station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone());
station = KnowledgeDb::stationForIbnr({});
QVERIFY(!station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone());
station = KnowledgeDb::stationForIbnr(IBNR{8011160});
QVERIFY(station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone("Europe/Berlin"));
QCOMPARE(station.country, CountryId{"DE"});
station = KnowledgeDb::stationForIbnr(IBNR{8501687});
QVERIFY(station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone("Europe/Zurich"));
QCOMPARE(station.country, CountryId{"CH"});
// Aachen West, very close to the NL border, should be in DE timezone
station = KnowledgeDb::stationForIbnr(IBNR{8000404});
QVERIFY(station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone("Europe/Berlin"));
QCOMPARE(station.country, CountryId{"DE"});
}
......@@ -133,15 +128,12 @@ private Q_SLOTS:
{
auto station = KnowledgeDb::stationForUic(UICStation{1234567});
QVERIFY(!station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone());
station = KnowledgeDb::stationForUic({});
QVERIFY(!station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone());
station = KnowledgeDb::stationForUic(UICStation{1001332});
QVERIFY(station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone("Europe/Helsinki"));
QCOMPARE(station.country, CountryId{"FI"});
}
......@@ -149,34 +141,27 @@ private Q_SLOTS:
{
auto station = KnowledgeDb::stationForSncfStationId({});
QVERIFY(!station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone());
station = KnowledgeDb::stationForSncfStationId(SncfStationId{"XXXXX"});
QVERIFY(!station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone());
station = KnowledgeDb::stationForSncfStationId(SncfStationId{"FRAES"});
QVERIFY(station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone("Europe/Paris"));
QCOMPARE(station.country, CountryId{"FR"});
station = KnowledgeDb::stationForSncfStationId(SncfStationId{QStringLiteral("FRXYT")});
QVERIFY(station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone("Europe/Paris"));
QCOMPARE(station.country, CountryId{"FR"});
station = KnowledgeDb::stationForSncfStationId(SncfStationId{"CHGVA"});
QVERIFY(station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone("Europe/Zurich"));
QCOMPARE(station.country, CountryId{"CH"});
station = KnowledgeDb::stationForSncfStationId(SncfStationId{"FRHWO"}); // alias for CHGVA...
QVERIFY(station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone("Europe/Zurich"));
QCOMPARE(station.country, CountryId{"CH"});
station = KnowledgeDb::stationForSncfStationId(SncfStationId{"NLAMA"}); // vs. SNCB ID of NLASC
QVERIFY(station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone("Europe/Amsterdam"));
QCOMPARE(station.country, CountryId{"NL"});
}
......@@ -184,15 +169,12 @@ private Q_SLOTS:
{
auto station = KnowledgeDb::stationForBenerailId({});
QVERIFY(!station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone());
station = KnowledgeDb::stationForBenerailId(BenerailStationId{"XXXXX"});
QVERIFY(!station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone());
station = KnowledgeDb::stationForBenerailId(BenerailStationId{"NLASC"});
QVERIFY(station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone("Europe/Amsterdam"));
QCOMPARE(station.country, CountryId{"NL"});
}
......@@ -375,27 +357,22 @@ private Q_SLOTS:
{
auto station = KnowledgeDb::stationForIndianRailwaysStationCode(QString());
QVERIFY(!station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone());
station = KnowledgeDb::stationForIndianRailwaysStationCode(QStringLiteral("NDLS"));
QVERIFY(station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone("Asia/Kolkata"));
QCOMPARE(station.country, CountryId{"IN"});
station = KnowledgeDb::stationForIndianRailwaysStationCode(QStringLiteral("ndls"));
QVERIFY(!station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone());
}
void testFinishStationCodeLookup()
{
auto station = KnowledgeDb::stationForVRStationCode(VRStationCode(QStringLiteral("HKI")));
QVERIFY(station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone("Europe/Helsinki"));
station = KnowledgeDb::stationForVRStationCode(VRStationCode(QStringLiteral("BLÄ")));
QVERIFY(!station.coordinate.isValid());
QCOMPARE(toQTimeZone(station.timezone()), QTimeZone());
}
};
......
......@@ -24,11 +24,6 @@ static_assert(trainstation_table_size < (1 << (sizeof(TrainStationIndex) * 8)),
}
}
Tz TrainStation::timezone() const
{
return timezoneForLocation(coordinate.latitude, coordinate.longitude, country);
}
template <typename Id, std::size_t Size>
static TrainStation lookupStation(Id id, const TrainStationIdIndex<Id>(&tab)[Size])
{
......
......@@ -47,8 +47,6 @@ struct TrainStationIdIndex {
struct TrainStation {
Coordinate coordinate;
CountryId country;
KITINERARY_EXPORT Tz timezone() const;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment