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

Don't truncate path line segment lengths to integers

For very detailed paths this can accumulated to relevant errors.
parent 46418498
Pipeline #97454 passed with stage
in 2 minutes and 18 seconds
......@@ -65,7 +65,6 @@
},
{
"disruptionEffect": "NormalService",
"scheduledPlatform": "1",
"expectedDepartureTime": "2019-11-11T21:33:00",
"scheduledDepartureTime": "2019-11-11T21:33:00",
"scheduledPlatform": "1",
......@@ -127,7 +126,7 @@
],
"mode": "PublicTransport",
"notes": [
"Some construction works. More info on some website."
"Some construction works. More info on some website."
],
"path": {
"sections": [
......@@ -182,7 +181,7 @@
},
{
"disruptionEffect": "NormalService",
"distance": 4156,
"distance": 4158,
"from": {
"identifier": {
"ifopt": "de:09564:510:11:U1_2",
......
......@@ -3,7 +3,7 @@
"sections": [
{
"disruptionEffect": "NormalService",
"distance": 306,
"distance": 317,
"expectedArrivalPlatform": "",
"expectedArrivalTime": "2020-04-27T22:13:00",
"expectedDeparturePlatform": "",
......
......@@ -76,7 +76,7 @@
},
{
"disruptionEffect": "NormalService",
"distance": 17665,
"distance": 17667,
"expectedArrivalPlatform": "",
"expectedArrivalTime": "2019-11-11T22:09:00",
"expectedDeparturePlatform": "",
......
......@@ -3,7 +3,7 @@
"sections": [
{
"disruptionEffect": "NoService",
"distance": 163559,
"distance": 163708,
"from": {
"identifier": {
"unit-test": "8011113"
......
......@@ -4,7 +4,7 @@
{
"co2Emission": 0,
"disruptionEffect": "NormalService",
"distance": 350,
"distance": 359,
"from": {
"latitude": 43.61124801635742,
"locality": "Toulouse",
......@@ -414,7 +414,7 @@
{
"co2Emission": 2,
"disruptionEffect": "NormalService",
"distance": 772,
"distance": 773,
"from": {
"latitude": 43.61016845703125,
"locality": "Toulouse",
......@@ -491,7 +491,7 @@
{
"co2Emission": 0,
"disruptionEffect": "NormalService",
"distance": 67,
"distance": 68,
"from": {
"latitude": 43.60560607910156,
"locality": "Toulouse",
......@@ -653,7 +653,7 @@
{
"co2Emission": 0,
"disruptionEffect": "NormalService",
"distance": 142,
"distance": 148,
"from": {
"latitude": 43.61124801635742,
"locality": "Toulouse",
......@@ -1001,7 +1001,7 @@
{
"co2Emission": 0,
"disruptionEffect": "NormalService",
"distance": 946,
"distance": 967,
"from": {
"identifier": {
"osm": "n890433076"
......@@ -1521,7 +1521,7 @@
{
"co2Emission": 0,
"disruptionEffect": "NormalService",
"distance": 73,
"distance": 74,
"from": {
"latitude": 43.604793548583984,
"locality": "Toulouse",
......
......@@ -57,7 +57,7 @@
{
"co2Emission": 147,
"disruptionEffect": "NormalService",
"distance": 23839,
"distance": 23841,
"from": {
"latitude": 49.00468826293945,
"locality": "Le Mesnil-Amelot",
......@@ -281,7 +281,7 @@
{
"co2Emission": 0,
"disruptionEffect": "NormalService",
"distance": 621,
"distance": 631,
"from": {
"latitude": 48.844139099121094,
"locality": "Paris",
......@@ -572,7 +572,7 @@
{
"co2Emission": 162,
"disruptionEffect": "NormalService",
"distance": 26122,
"distance": 26127,
"from": {
"latitude": 49.00468826293945,
"locality": "Le Mesnil-Amelot",
......@@ -833,7 +833,7 @@
{
"co2Emission": 581,
"disruptionEffect": "NormalService",
"distance": 4474,
"distance": 4480,
"from": {
"latitude": 48.87947463989258,
"locality": "Paris",
......@@ -1120,7 +1120,7 @@
{
"co2Emission": 0,
"disruptionEffect": "NormalService",
"distance": 451,
"distance": 453,
"from": {
"latitude": 48.842533111572266,
"locality": "Paris",
......@@ -1275,7 +1275,7 @@
{
"co2Emission": 191,
"disruptionEffect": "NormalService",
"distance": 30922,
"distance": 30929,
"from": {
"latitude": 49.00468826293945,
"locality": "Le Mesnil-Amelot",
......@@ -1592,7 +1592,7 @@
{
"co2Emission": 370,
"disruptionEffect": "NormalService",
"distance": 2852,
"distance": 2855,
"from": {
"latitude": 48.83872985839844,
"locality": "Paris",
......@@ -1739,7 +1739,7 @@
{
"co2Emission": 0,
"disruptionEffect": "NormalService",
"distance": 362,
"distance": 366,
"from": {
"latitude": 48.845741271972656,
"locality": "Paris",
......@@ -1885,7 +1885,7 @@
{
"co2Emission": 0,
"disruptionEffect": "NormalService",
"distance": 511,
"distance": 514,
"from": {
"latitude": 49.00423812866211,
"locality": "Le Mesnil-Amelot",
......@@ -2022,7 +2022,7 @@
{
"co2Emission": 3171,
"disruptionEffect": "NormalService",
"distance": 24445,
"distance": 24446,
"from": {
"latitude": 49.003387451171875,
"locality": "Tremblay-en-France",
......@@ -2098,7 +2098,7 @@
{
"co2Emission": 0,
"disruptionEffect": "NormalService",
"distance": 334,
"distance": 337,
"from": {
"latitude": 48.845794677734375,
"locality": "Paris",
......
......@@ -230,7 +230,7 @@
},
{
"disruptionEffect": "NormalService",
"distance": 5990,
"distance": 6089,
"expectedArrivalTime": "2021-10-07T17:49:16+02:00",
"expectedDepartureTime": "2021-10-07T17:37:16+02:00",
"from": {
......
......@@ -4,6 +4,8 @@
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "testhelpers.h"
#include "backends/efacompactparser.h"
#include "backends/efaxmlparser.h"
......@@ -207,11 +209,8 @@ private Q_SLOTS:
const auto ref = QJsonDocument::fromJson(readFile(refFileName)).array();
if (jsonRes != ref) {
qDebug().noquote() << QJsonDocument(jsonRes).toJson();
}
QVERIFY(!jsonRes.empty());
QCOMPARE(jsonRes, ref);
QVERIFY(Test::compareJson(refFileName, jsonRes, ref));
QVERIFY(!parser.requestContext().isEmpty());
QCOMPARE(parser.requestContext().sessionId, QLatin1String("123456789"));
......@@ -241,11 +240,8 @@ private Q_SLOTS:
const auto ref = QJsonDocument::fromJson(readFile(refFileName)).array();
if (jsonRes != ref) {
qDebug().noquote() << QJsonDocument(jsonRes).toJson();
}
QVERIFY(!jsonRes.empty());
QCOMPARE(jsonRes, ref);
QVERIFY(Test::compareJson(refFileName, jsonRes, ref));
QVERIFY(!parser.requestContext().isEmpty());
QCOMPARE(parser.requestContext().sessionId, QLatin1String("123456789"));
......
......@@ -36,7 +36,7 @@ int PathSection::distance() const
return 0;
}
int dist = 0;
float dist = 0;
for (auto it = d->path.begin(); it != std::prev(d->path.end()); ++it) {
const auto nextIt = std::next(it);
dist += Location::distance((*it).y(), (*it).x(), (*nextIt).y(), (*nextIt).x());
......
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