1 #define CATCH_CONFIG_MAIN 
    2 #include <catch2/catch_test_macros.hpp> 
    3 #include "filesystem-utils.h" 
   10 #include <boost/log/trivial.hpp> 
   11 #include "executable-utils.h" 
   14 const std::filesystem::path base_path = celantur::get_executable_dir()/
"test-assets/core";
 
   16 TEST_CASE(
"Test images", 
"[core]") {
 
   17     auto images = celantur::get_images_recursively(base_path/
"filesystem");
 
   18     REQUIRE(images.size() == 4);
 
   19     std::set<std::string> expected{
 
   20         base_path/
"filesystem/img2.jpeg",
 
   21         base_path/
"filesystem/folder/img1.jpg",
 
   22         base_path/
"filesystem/folder/img3.JPG",
 
   23         base_path/
"filesystem/folder/subfolder/img4.png" 
   26     for (
const auto& image : images) {
 
   27         BOOST_LOG_TRIVIAL(info) << image.string() ;
 
   28         auto found = std::find(expected.begin(), expected.end(), image.string()) != expected.end();
 
   33 TEST_CASE(
"Test videos", 
"[core]") {
 
   34     auto videos = celantur::get_videos_recursively(base_path/
"filesystem");
 
   35     REQUIRE(videos.size() == 2);
 
   36     std::set<std::string> expected{
 
   37         base_path/
"filesystem/folder/vid.MP4",
 
   38         base_path/
"filesystem/folder/subfolder/video.avi" 
   41     for (
const auto& video : videos) {
 
   42         BOOST_LOG_TRIVIAL(info) << video.string() ;
 
   43         auto found = std::find(expected.begin(), expected.end(), video.string()) != expected.end();
 
   48 TEST_CASE(
"Test IOFileRef", 
"[core]") {
 
   49     celantur::FileRef input_fr(celantur::get_executable_dir()/
"test-assets/filesystem/folder/subfolder/img4.png");
 
   50     celantur::IOFileRef io_fr(celantur::get_executable_dir()/
"test-assets/filesystem", 
"test-assets/output", input_fr);
 
   51     REQUIRE(io_fr.input_file_ref().string() == 
"test-assets/filesystem/folder/subfolder/img4.png");
 
   52     REQUIRE(io_fr.output_file_ref().string() == 
"test-assets/output/folder/subfolder/img4.png");