File indexing completed on 2024-05-12 05:17:32

0001 /*
0002     SPDX-FileCopyrightText: 2023 Volker Krause <vkrause@kde.org>
0003     SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 
0006 #include "../lib/rsp/rsp6decoder.cpp"
0007 
0008 #include <KItinerary/ExtractorEngine>
0009 
0010 #include <QDebug>
0011 #include <QObject>
0012 #include <QTest>
0013 
0014 using namespace KItinerary;
0015 
0016 class Rsp6DecoderTest : public QObject
0017 {
0018     Q_OBJECT
0019 private Q_SLOTS:
0020     void initTestCase()
0021     {
0022         // work around to get the qrc data with the RSP-6 keys loaded,
0023         // which would be omitted when linking with --as-needed here
0024         ExtractorEngine engine;
0025     }
0026 
0027     void testDecode()
0028     {
0029         const QByteArray input("06DNQL4XHVK00TTRCGPUQWNTHPGHWBPOUTKRWXAJKGHFBAPBCTOGUZQVTZTKKDEBQXPGRWZJRJBXJZPOHNJGIPDJWEGYWJXLVPGEEZBCUUELIJMOINPRZMSDQCZJGLIZLUTQHXMTPKWCMJISUXQLORAOVYXSOLGXXGMVUDXTMHAYMBLUTKPUPFCRNNTDBBDLNWSBPDUXYKSIMJSBYBURSCPUMFBZPEUTECHTIOXAH");
0030 
0031         const auto output = Rsp6Decoder::decode(input);
0032         QVERIFY(!output.isEmpty());
0033         QCOMPARE(output, QByteArray::fromHex("0092ec6c538a36ad00c30c39c99a6c24826ca0828c2ec800c07d128a00000000000000000000000000000000000000018251466a000a530b800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007737378f24651de7"));
0034     }
0035 };
0036 
0037 QTEST_GUILESS_MAIN(Rsp6DecoderTest)
0038 
0039 #include "rsp6decodertest.moc"