Changeset View
Changeset View
Standalone View
Standalone View
autotests/bcbpparsertest.cpp
Show All 9 Lines | 1 | /* | |||
---|---|---|---|---|---|
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | ||
12 | License for more details. | 12 | License for more details. | ||
13 | 13 | | |||
14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | 16 | */ | ||
17 | 17 | | |||
18 | #include "iatabcbpparser.h" | 18 | #include <KItinerary/IataBcbpParser> | ||
19 | #include <KItinerary/Init> | ||||
19 | #include <KItinerary/JsonLdDocument> | 20 | #include <KItinerary/JsonLdDocument> | ||
20 | #include <KItinerary/Organization> | 21 | #include <KItinerary/Organization> | ||
21 | #include <KItinerary/Place> | 22 | #include <KItinerary/Place> | ||
22 | 23 | | |||
23 | #include <QDebug> | 24 | #include <QDebug> | ||
24 | #include <QFile> | 25 | #include <QFile> | ||
25 | #include <QJsonArray> | 26 | #include <QJsonArray> | ||
26 | #include <QJsonDocument> | 27 | #include <QJsonDocument> | ||
27 | #include <QObject> | 28 | #include <QObject> | ||
28 | #include <QTest> | 29 | #include <QTest> | ||
29 | 30 | | |||
30 | using namespace KItinerary; | 31 | using namespace KItinerary; | ||
31 | 32 | | |||
32 | class BcbpParserTest : public QObject | 33 | class BcbpParserTest : public QObject | ||
33 | { | 34 | { | ||
34 | Q_OBJECT | 35 | Q_OBJECT | ||
35 | private Q_SLOTS: | 36 | private Q_SLOTS: | ||
37 | void initTestCase() | ||||
38 | { | ||||
39 | KItinerary::init(); | ||||
40 | } | ||||
41 | | ||||
36 | void testParserValid_data() | 42 | void testParserValid_data() | ||
37 | { | 43 | { | ||
38 | QTest::addColumn<QString>("message"); | 44 | QTest::addColumn<QString>("message"); | ||
39 | QTest::addColumn<QString>("refFile"); | 45 | QTest::addColumn<QString>("refFile"); | ||
40 | 46 | | |||
41 | // example data from IATA resolution 792 version 5 Attachment B (with security sections shortended or omitted) | 47 | // example data from IATA resolution 792 version 5 Attachment B (with security sections shortended or omitted) | ||
42 | QTest::newRow("single leg, mandatory only") << QStringLiteral("M1DESMARAIS/LUC EABC123 YULFRAAC 0834 326J001A0025 100") << QStringLiteral("iata-resolution792-example1.json"); | 48 | QTest::newRow("single leg, mandatory only") << QStringLiteral("M1DESMARAIS/LUC EABC123 YULFRAAC 0834 326J001A0025 100") << QStringLiteral("iata-resolution792-example1.json"); | ||
43 | QTest::newRow("single leg, all fields") << QStringLiteral("M1DESMARAIS/LUC EAB12C3 YULFRAAC 0834 326J003A0027 167>5321WW1325BAC 0014123456002001412346700100141234789012A0141234567890 1AC AC 1234567890123 4PCYLX58Z^108ABCDEFGH") << QStringLiteral("iata-resolution792-example2.json"); | 49 | QTest::newRow("single leg, all fields") << QStringLiteral("M1DESMARAIS/LUC EAB12C3 YULFRAAC 0834 326J003A0027 167>5321WW1325BAC 0014123456002001412346700100141234789012A0141234567890 1AC AC 1234567890123 4PCYLX58Z^108ABCDEFGH") << QStringLiteral("iata-resolution792-example2.json"); | ||
▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines |