CANdevStudio
Development tool for CAN bus simulation
|
#include "candevice.h"
#include <QApplication>
#include <QSignalSpy>
#include <QtSerialBus/QCanBusDevice>
#include <candeviceinterface.h>
#include <catch.hpp>
#include <context.h>
#include <fakeit.hpp>
#include <log.h>
Macros | |
#define | CATCH_CONFIG_RUNNER |
#define | testConfig_Expect0(mock, dev, str) |
#define | testConfig_Expect1(mock, dev, key, val, str) |
Functions | |
Q_DECLARE_METATYPE (QCanBusFrame) | |
TEST_CASE ("Initialization failed", "[candevice]") | |
TEST_CASE ("Initialization succeeded", "[candevice]") | |
TEST_CASE ("Start failed", "[candevice]") | |
TEST_CASE ("Start failed - could not connect to device", "[candevice]") | |
TEST_CASE ("Start succeeded", "[candevice]") | |
TEST_CASE ("Stop uninitialized", "[candevice]") | |
TEST_CASE ("Stop initialized", "[candevice]") | |
TEST_CASE ("Config changed", "[candevice]") | |
TEST_CASE ("writeFrame results in error", "[candevice]") | |
TEST_CASE ("sendFrame, writeframe returns true, no signal emitted", "[candevice]") | |
TEST_CASE ("sendFrame, no device available, frameSent is not emitted", "[candevice]") | |
TEST_CASE ("sendFrame defers FrameSent until backend emits frameWritten", "[candevice]") | |
TEST_CASE ("Emits all available frames when notified by backend", "[candevice]") | |
TEST_CASE ("WriteError causes emitting frameSent with frameSent=false", "[candevice]") | |
TEST_CASE ("read configuration to json format", "[candevice]") | |
TEST_CASE ("setConfig using JSON read with QObject", "[candevice]") | |
TEST_CASE ("Stubbed methods", "[candevice]") | |
void | prepareConfigTestMock (fakeit::Mock< CanDeviceInterface > &deviceMock, std::vector< std::pair< int, QVariant > > &ver) |
void | testConfig (fakeit::Mock< CanDeviceInterface > &deviceMock, CanDevice &canDevice, const QString &configStr) |
TEST_CASE ("Config parameter - invalid format and unsupported", "[candevice]") | |
TEST_CASE ("Config parameter - LoopbackKey", "[candevice]") | |
TEST_CASE ("Config parameter - ReceiveOwnKey", "[candevice]") | |
TEST_CASE ("Config parameter - CanFdKey", "[candevice]") | |
TEST_CASE ("Config parameter - BitRateKey", "[candevice]") | |
TEST_CASE ("Config parameter - UserKey", "[candevice]") | |
TEST_CASE ("Config parameter - multiple keys", "[candevice]") | |
int | main (int argc, char *argv[]) |
Variables | |
std::shared_ptr< spdlog::logger > | kDefaultLogger |
#define CATCH_CONFIG_RUNNER |
#define testConfig_Expect0 | ( | mock, | |
dev, | |||
str | |||
) |
#define testConfig_Expect1 | ( | mock, | |
dev, | |||
key, | |||
val, | |||
str | |||
) |
int main | ( | int | argc, |
char * | argv[] | ||
) |
void prepareConfigTestMock | ( | fakeit::Mock< CanDeviceInterface > & | deviceMock, |
std::vector< std::pair< int, QVariant > > & | ver | ||
) |
Q_DECLARE_METATYPE | ( | QCanBusFrame | ) |
TEST_CASE | ( | "Config changed" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | "Config parameter - BitRateKey" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | "Config parameter - CanFdKey" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | "Config parameter - invalid format and unsupported" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | "Config parameter - LoopbackKey" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | "Config parameter - multiple keys" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | "Config parameter - ReceiveOwnKey" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | "Config parameter - UserKey" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | "Emits all available frames when notified by backend" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | "Initialization failed" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | "Initialization succeeded" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | "read configuration to json format" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | "sendFrame defers FrameSent until backend emits frameWritten" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | " | sendFrame, |
no device | available, | ||
frameSent is not emitted" | , | ||
"" | [candevice] | ||
) |
TEST_CASE | ( | " | sendFrame, |
writeframe returns | true, | ||
no signal emitted" | , | ||
"" | [candevice] | ||
) |
TEST_CASE | ( | "setConfig using JSON read with QObject" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | "Start failed - could not connect to device" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | "Start failed" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | "Start succeeded" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | "Stop initialized" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | "Stop uninitialized" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | "Stubbed methods" | , |
"" | [candevice] | ||
) |
TEST_CASE | ( | ) |
TEST_CASE | ( | "writeFrame results in error" | , |
"" | [candevice] | ||
) |
void testConfig | ( | fakeit::Mock< CanDeviceInterface > & | deviceMock, |
CanDevice & | canDevice, | ||
const QString & | configStr | ||
) |
std::shared_ptr<spdlog::logger> kDefaultLogger |