Commit ea06c519 authored by Matteo's avatar Matteo
Browse files

update unit tests

parent 97f6b447
......@@ -70,6 +70,7 @@ ADD_EXECUTABLE(
tests/irregularity_test.cpp
tests/enums_test.cpp
tests/core_test.cpp
tests/files_test.cpp
)
TARGET_LINK_LIBRARIES(
......
#include "../src/lib/files.hpp"
#include <gtest/gtest.h>
using namespace files;
TEST(Files, SaveFile) {
std::string content = "test";
std::filesystem::path fileName = "tests/test.txt";
save_file(fileName, content);
std::ifstream file(fileName);
std::string line;
std::getline(file, line);
EXPECT_EQ(line, content);
file.close();
std::filesystem::remove(fileName);
}
TEST(Files, GetFilenameAndExtension) {
std::string videoPath = "tests/images/test_scene_01.jpg";
std::pair<std::string, std::string> result = get_filename_and_extension(videoPath);
EXPECT_EQ(result.first, "test_scene_01");
EXPECT_EQ(result.second, "jpg");
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment