Hotwheels-Cluster 1.2
Creation of Cluster APP for SEA:ME project.
 
Loading...
Searching...
No Matches
test_SPIController.cpp File Reference

Unit tests for the SPIController class. More...

#include "MockSysCalls.hpp"
#include "SPIController.hpp"
#include <gtest/gtest.h>
#include <linux/spi/spidev.h>

Go to the source code of this file.

Data Structures

class  SPIControllerTest
 Test fixture for testing the SPIController class. More...
 

Functions

 TEST_F (SPIControllerTest, OpenDeviceSuccess)
 Ensures that the device opens without throwing an exception.
 
 TEST_F (SPIControllerTest, OpenDeviceFailure)
 Ensures that openDevice() throws an exception when the device fails to open.
 
 TEST_F (SPIControllerTest, ConfigureSPIValidParameters)
 Ensures that configure() does not throw an exception with valid parameters.
 
 TEST_F (SPIControllerTest, WriteByteSuccess)
 Ensures that writeByte() does not throw an exception.
 
 TEST_F (SPIControllerTest, ReadByteSuccess)
 Ensures that readByte() does not throw an exception.
 
 TEST_F (SPIControllerTest, SpiTransferSuccess)
 Ensures that spiTransfer() does not throw an exception.
 
 TEST_F (SPIControllerTest, CloseDeviceSuccess)
 Ensures that closeDevice() does not throw an exception.
 

Detailed Description

Unit tests for the SPIController class.

Version
0.1
Date
2025-01-30
Author
Félix LE BIHAN (@Fle-bihh)
Ricardo Melo (@reomelo)
Tiago Pereira (@t-pereira06)
Michel Batista (@MicchelFAB)

This file contains unit tests for the SPIController class, using Google Test and Google Mock frameworks.

Definition in file test_SPIController.cpp.

Function Documentation

◆ TEST_F() [1/7]

TEST_F ( SPIControllerTest ,
CloseDeviceSuccess  )

Ensures that closeDevice() does not throw an exception.

Test
Tests if the device closes successfully.

This test verifies that closeDevice() does not throw an exception when the device closes successfully.

See also
SPIController::closeDevice

Definition at line 180 of file test_SPIController.cpp.

Here is the call graph for this function:

◆ TEST_F() [2/7]

TEST_F ( SPIControllerTest ,
ConfigureSPIValidParameters  )

Ensures that configure() does not throw an exception with valid parameters.

Test
Tests if the SPI configuration is successful with valid parameters.

This test verifies that configure() does not throw an exception when called with valid parameters.

See also
SPIController::configure

Definition at line 97 of file test_SPIController.cpp.

Here is the call graph for this function:

◆ TEST_F() [3/7]

TEST_F ( SPIControllerTest ,
OpenDeviceFailure  )

Ensures that openDevice() throws an exception when the device fails to open.

Test
Tests if the device fails to open.

This test verifies that openDevice() throws a runtime_error when the device fails to open.

See also
SPIController::openDevice

Definition at line 79 of file test_SPIController.cpp.

Here is the call graph for this function:

◆ TEST_F() [4/7]

TEST_F ( SPIControllerTest ,
OpenDeviceSuccess  )

Ensures that the device opens without throwing an exception.

Test
Tests if the device opens successfully.

Verifies that openDevice() does not throw an exception when the device opens successfully.

See also
SPIController::openDevice

Definition at line 61 of file test_SPIController.cpp.

Here is the call graph for this function:

◆ TEST_F() [5/7]

TEST_F ( SPIControllerTest ,
ReadByteSuccess  )

Ensures that readByte() does not throw an exception.

Test
Tests if reading a byte is successful.

This test verifies that readByte() does not throw an exception when reading a byte.

See also
SPIController::readByte

Definition at line 139 of file test_SPIController.cpp.

Here is the call graph for this function:

◆ TEST_F() [6/7]

TEST_F ( SPIControllerTest ,
SpiTransferSuccess  )

Ensures that spiTransfer() does not throw an exception.

Test
Tests if SPI transfer is successful.

This test verifies that spiTransfer() does not throw an exception when performing an SPI transfer.

See also
SPIController::spiTransfer

Definition at line 158 of file test_SPIController.cpp.

Here is the call graph for this function:

◆ TEST_F() [7/7]

TEST_F ( SPIControllerTest ,
WriteByteSuccess  )

Ensures that writeByte() does not throw an exception.

Test
Tests if writing a byte is successful.

This test verifies that writeByte() does not throw an exception when writing a byte.

See also
SPIController::writeByte

Definition at line 120 of file test_SPIController.cpp.

Here is the call graph for this function: