Unit tests for the MileageFileHandler class. More...
#include "MileageFileHandler.hpp"
#include "MockFileController.hpp"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
Go to the source code of this file.
Data Structures | |
class | MileageFileHandlerTest |
Test fixture for testing the MileageFileHandler class. More... | |
Functions | |
TEST_F (MileageFileHandlerTest, EnsureFileExists_FileDoesNotExist_CreatesFileWithZeroMileage) | |
Ensures that the mileage file handler creates the file if it does not exist. | |
TEST_F (MileageFileHandlerTest, ReadMileage_ValidNumber_ReturnsParsedValue) | |
Ensures that the mileage file handler does not create the file if it already exists. | |
TEST_F (MileageFileHandlerTest, ReadMileage_InvalidNumber_ReturnsZero) | |
Ensures that the mileage file handler reads zero mileage if the file is empty. | |
TEST_F (MileageFileHandlerTest, WriteMileage_ValidNumber_WritesToFile) | |
Ensures that the mileage file handler writes the mileage to the file. | |
Unit tests for the MileageFileHandler class.
This file contains unit tests for the MileageFileHandler class, using Google Test and Google Mock frameworks.
Definition in file test_MileageFileHandler.cpp.
TEST_F | ( | MileageFileHandlerTest | , |
EnsureFileExists_FileDoesNotExist_CreatesFileWithZeroMileage | ) |
Ensures that the mileage file handler creates the file if it does not exist.
This test verifies that the mileage file handler creates the file if it does not exist.
Definition at line 65 of file test_MileageFileHandler.cpp.
TEST_F | ( | MileageFileHandlerTest | , |
ReadMileage_InvalidNumber_ReturnsZero | ) |
Ensures that the mileage file handler reads zero mileage if the file is empty.
This test verifies that the mileage file handler reads zero mileage if the file is empty.
Definition at line 116 of file test_MileageFileHandler.cpp.
TEST_F | ( | MileageFileHandlerTest | , |
ReadMileage_ValidNumber_ReturnsParsedValue | ) |
Ensures that the mileage file handler does not create the file if it already exists.
This test verifies that the mileage file handler does not create the file if it already exists.
Definition at line 97 of file test_MileageFileHandler.cpp.
TEST_F | ( | MileageFileHandlerTest | , |
WriteMileage_ValidNumber_WritesToFile | ) |
Ensures that the mileage file handler writes the mileage to the file.
This test verifies that the mileage file handler writes the mileage to the file.
Definition at line 135 of file test_MileageFileHandler.cpp.