File indexing completed on 2024-10-13 06:30:10

0001 /*
0002     File                 : BLFFilterTest.h
0003     Project              : LabPlot
0004     Description          : Tests for the BLF filter
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2023 Martin Marmsoler <martin.marmsoler@gmail.com>
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 #ifndef BLFFILTERTEST_H
0011 #define BLFFILTERTEST_H
0012 
0013 #include "../../CommonTest.h"
0014 #include <QtTest>
0015 
0016 namespace Vector {
0017 namespace BLF {
0018 struct CanMessage2;
0019 } // namespace BLF
0020 } // namespace Vector
0021 
0022 class BLFFilterTest : public CommonTest {
0023     Q_OBJECT
0024 
0025 private Q_SLOTS:
0026 #ifdef HAVE_VECTOR_BLF
0027     void testInvalidBLF();
0028     void testNotFoundBLF();
0029     void testInvalidDBC();
0030 
0031     void testTimeNative();
0032 
0033     void testValidBLFValidDBCSingleMessageBigEndian();
0034     void testUsePreviousValueBigEndian();
0035     void testUseNANBigEndian();
0036 
0037     void testUseNANLittleEndian();
0038     void testUsePreviousValueLittleEndian();
0039     void testBigNumberNotByteAlignedLittleEndian();
0040 
0041 private:
0042     // Helper functions
0043     void createDBCFile(const QString& filename, const std::string& content);
0044     Vector::BLF::CanMessage2* createCANMessage(uint32_t id, uint64_t timestamp, const std::vector<uint8_t>& data);
0045     void createBLFFile(const QString& filename, QVector<Vector::BLF::CanMessage2*> messages);
0046 #endif
0047 };
0048 #endif // BLFFILTERTEST_H