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

Unit tests for the MileageManager class. More...

#include <QSignalSpy>
#include "MileageManager.hpp"
#include "MockMileageCalculator.hpp"
#include "MockMileageFileHandler.hpp"
#include <gmock/gmock.h>
#include <gtest/gtest.h>

Go to the source code of this file.

Data Structures

class  MileageManagerTest
 Class to test the integration between the MileageManager and the MileageCalculator and MileageFileHandler. More...
 

Functions

 TEST_F (MileageManagerTest, Initialize_LoadsMileageFromFile)
 Ensures that the mileage manager initializes correctly.
 
 TEST_F (MileageManagerTest, OnSpeedUpdated_CallsCalculator)
 Ensures that the mileage manager calls the calculator when the speed is updated.
 
 TEST_F (MileageManagerTest, UpdateMileage_EmitsMileageUpdatedSignal)
 Ensures that the mileage manager updates the mileage correctly.
 
 TEST_F (MileageManagerTest, SaveMileage_CallsFileHandler)
 Ensures that the mileage manager saves the mileage correctly.
 

Detailed Description

Unit tests for the MileageManager class.

Version
0.1
Date
2025-02-12

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

Author
Félix LE BIHAN (@Fle-bihh)
Tiago Pereira (@t-pereira06)
Ricardo Melo (@reomelo)
Michel Batista (@MicchelFAB)

Definition in file test_MileageManager.cpp.

Function Documentation

◆ TEST_F() [1/4]

TEST_F ( MileageManagerTest ,
Initialize_LoadsMileageFromFile  )

Ensures that the mileage manager initializes correctly.

Test
Tests if the mileage manager initializes correctly.

This test verifies that the mileage manager initializes correctly.

See also
MileageManager::initialize

Definition at line 57 of file test_MileageManager.cpp.

◆ TEST_F() [2/4]

TEST_F ( MileageManagerTest ,
OnSpeedUpdated_CallsCalculator  )

Ensures that the mileage manager calls the calculator when the speed is updated.

Test
Test OnSpeedUpdated method.

This test verifies that the mileage manager calls the calculator when the speed is updated.

See also
MileageManager::onSpeedUpdated

Definition at line 75 of file test_MileageManager.cpp.

◆ TEST_F() [3/4]

TEST_F ( MileageManagerTest ,
SaveMileage_CallsFileHandler  )

Ensures that the mileage manager saves the mileage correctly.

Test
Test SaveMileage method.

This test verifies that the mileage manager saves the mileage correctly.

See also
MileageManager::saveMileage

Definition at line 109 of file test_MileageManager.cpp.

◆ TEST_F() [4/4]

TEST_F ( MileageManagerTest ,
UpdateMileage_EmitsMileageUpdatedSignal  )

Ensures that the mileage manager updates the mileage correctly.

Test
Test UpdateMileage method.

This test verifies that the mileage manager updates the mileage correctly.

See also
MileageManager::updateMileage

Definition at line 88 of file test_MileageManager.cpp.

Here is the call graph for this function: