Unit tests for the MCP2515Configurator class. More...
#include "MCP2515Configurator.hpp"
#include "MockSPIController.hpp"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
Go to the source code of this file.
Data Structures | |
class | MCP2515ConfiguratorTest |
Test fixture for testing the MCP2515Configurator class. More... | |
Functions | |
TEST_F (MCP2515ConfiguratorTest, ResetChipSuccess) | |
Ensures that resetChip() returns true when the reset is successful. | |
TEST_F (MCP2515ConfiguratorTest, ResetChipFailure) | |
Ensures that resetChip() returns false when the reset fails. | |
TEST_F (MCP2515ConfiguratorTest, ConfigureBaudRate) | |
Ensures that configureBaudRate() writes the correct values to the registers. | |
TEST_F (MCP2515ConfiguratorTest, ConfigureTXBuffer) | |
Ensures that configureTXBuffer() writes the correct value to the TXB0CTRL register. | |
TEST_F (MCP2515ConfiguratorTest, ConfigureRXBuffer) | |
Ensures that configureRXBuffer() writes the correct value to the RXB0CTRL register. | |
TEST_F (MCP2515ConfiguratorTest, ConfigureFiltersAndMasks) | |
Ensures that configureFiltersAndMasks() writes the correct values to the registers. | |
TEST_F (MCP2515ConfiguratorTest, ConfigureInterrupts) | |
Ensures that configureInterrupts() writes the correct value to the CANINTE register. | |
TEST_F (MCP2515ConfiguratorTest, SetMode) | |
Ensures that setMode() writes the correct value to the CANCTRL register. | |
TEST_F (MCP2515ConfiguratorTest, VerifyModeSuccess) | |
Ensures that verifyMode() returns true when the mode is correct. | |
TEST_F (MCP2515ConfiguratorTest, VerifyModeFailure) | |
Ensures that verifyMode() returns false when the mode is incorrect. | |
TEST_F (MCP2515ConfiguratorTest, ReadCANMessageWithData) | |
Ensures that readCANMessage() reads the correct frame ID and data. | |
TEST_F (MCP2515ConfiguratorTest, ReadCANMessageNoData) | |
Ensures that readCANMessage() returns an empty data vector when no CAN message is available. | |
Unit tests for the MCP2515Configurator class.
This file contains unit tests for the MCP2515Configurator class, using Google Test and Google Mock frameworks.
Definition in file test_MCP2515Configurator.cpp.
TEST_F | ( | MCP2515ConfiguratorTest | , |
ConfigureBaudRate | ) |
Ensures that configureBaudRate() writes the correct values to the registers.
Verifies that configureBaudRate() writes the correct values to the CNF1, CNF2, and CNF3 registers.
Definition at line 73 of file test_MCP2515Configurator.cpp.
TEST_F | ( | MCP2515ConfiguratorTest | , |
ConfigureFiltersAndMasks | ) |
Ensures that configureFiltersAndMasks() writes the correct values to the registers.
Verifies that configureFiltersAndMasks() writes the correct values to the registers.
Definition at line 114 of file test_MCP2515Configurator.cpp.
TEST_F | ( | MCP2515ConfiguratorTest | , |
ConfigureInterrupts | ) |
Ensures that configureInterrupts() writes the correct value to the CANINTE register.
Verifies that configureInterrupts() writes the correct value to the CANINTE register.
Definition at line 128 of file test_MCP2515Configurator.cpp.
TEST_F | ( | MCP2515ConfiguratorTest | , |
ConfigureRXBuffer | ) |
Ensures that configureRXBuffer() writes the correct value to the RXB0CTRL register.
Verifies that configureRXBuffer() writes the correct value to the RXB0CTRL register.
Definition at line 101 of file test_MCP2515Configurator.cpp.
TEST_F | ( | MCP2515ConfiguratorTest | , |
ConfigureTXBuffer | ) |
Ensures that configureTXBuffer() writes the correct value to the TXB0CTRL register.
Verifies that configureTXBuffer() writes the correct value to the TXB0CTRL register.
Definition at line 88 of file test_MCP2515Configurator.cpp.
TEST_F | ( | MCP2515ConfiguratorTest | , |
ReadCANMessageNoData | ) |
Ensures that readCANMessage() returns an empty data vector when no CAN message is available.
Verifies that readCANMessage() returns an empty data vector when no CAN message is available.
Definition at line 207 of file test_MCP2515Configurator.cpp.
TEST_F | ( | MCP2515ConfiguratorTest | , |
ReadCANMessageWithData | ) |
Ensures that readCANMessage() reads the correct frame ID and data.
Verifies that readCANMessage() reads the correct frame ID and data when a CAN message with data is available.
Definition at line 177 of file test_MCP2515Configurator.cpp.
TEST_F | ( | MCP2515ConfiguratorTest | , |
ResetChipFailure | ) |
Ensures that resetChip() returns false when the reset fails.
Verifies that resetChip() returns false when the chip reset fails.
Definition at line 58 of file test_MCP2515Configurator.cpp.
TEST_F | ( | MCP2515ConfiguratorTest | , |
ResetChipSuccess | ) |
Ensures that resetChip() returns true when the reset is successful.
Verifies that resetChip() returns true when the chip reset is successful.
Definition at line 45 of file test_MCP2515Configurator.cpp.
TEST_F | ( | MCP2515ConfiguratorTest | , |
SetMode | ) |
Ensures that setMode() writes the correct value to the CANCTRL register.
Verifies that setMode() writes the correct value to the CANCTRL register.
Definition at line 141 of file test_MCP2515Configurator.cpp.
TEST_F | ( | MCP2515ConfiguratorTest | , |
VerifyModeFailure | ) |
Ensures that verifyMode() returns false when the mode is incorrect.
Verifies that verifyMode() returns false when the mode is incorrect.
Definition at line 164 of file test_MCP2515Configurator.cpp.
TEST_F | ( | MCP2515ConfiguratorTest | , |
VerifyModeSuccess | ) |
Ensures that verifyMode() returns true when the mode is correct.
Verifies that verifyMode() returns true when the mode is correct.
Definition at line 152 of file test_MCP2515Configurator.cpp.