Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Libraries
KPublicTransport
Commits
becded57
Commit
becded57
authored
Sep 04, 2021
by
Volker Krause
Browse files
Fix build: add forgotten file
parent
fabf539f
Pipeline
#78419
passed with stage
in 18 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
autotests/gbfsreadertest.cpp
0 → 100644
View file @
becded57
/*
SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include
"../src/lib/gbfs/gbfsreader.cpp"
#include
<QJsonDocument>
#include
<QJsonObject>
#include
<QTest>
#include
<cmath>
using
namespace
KPublicTransport
;
class
GBFSReaderTest
:
public
QObject
{
Q_OBJECT
private
Q_SLOTS
:
void
testReadCoords
()
{
auto
obj
=
QJsonDocument
::
fromJson
(
"{
\"
lat
\"
:48.396619,
\"
lon
\"
:9.990212}"
).
object
();
QCOMPARE
(
obj
.
size
(),
2
);
QCOMPARE
(
GBFSReader
::
readLatitude
(
obj
),
48.396619
);
QCOMPARE
(
GBFSReader
::
readLongitude
(
obj
),
9.990212
);
obj
=
QJsonDocument
::
fromJson
(
"{
\"
lat
\"
:
\"
41.4852
\"
,
\"
lon
\"
:
\"
-81.8039
\"
,
\"
vehicle_type
\"
:
\"
scooter
\"
}"
).
object
();
QCOMPARE
(
obj
.
size
(),
3
);
QCOMPARE
(
GBFSReader
::
readLatitude
(
obj
),
41.4852
);
QCOMPARE
(
GBFSReader
::
readLongitude
(
obj
),
-
81.8039
);
obj
=
{};
QCOMPARE
(
GBFSReader
::
readLatitude
(
obj
),
NAN
);
QCOMPARE
(
GBFSReader
::
readLongitude
(
obj
),
NAN
);
}
};
QTEST_APPLESS_MAIN
(
GBFSReaderTest
)
#include
"gbfsreadertest.moc"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment