// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #pragma once #include #include #include // Helpers for the large reference datasets used by the [large] Catch tests. The datasets live // under /tests/data and are tracked with git-LFS, so they are often NOT present (LFS not // pulled, e.g. in CI). Tests run from /tests, so the directory is reached via ../../. namespace jfjoch_test { inline std::string LargeDataDir() { return "../../tests/data"; } // Path to a large dataset file if it is present and looks like real data rather than an // unfetched git-LFS pointer (those are tiny text stubs); std::nullopt otherwise. Tests should // SKIP() when this returns nullopt. inline std::optional LargeDataFile(const std::string &name) { const std::string path = LargeDataDir() + "/" + name; std::error_code ec; if (!std::filesystem::is_regular_file(path, ec)) return std::nullopt; if (ec || std::filesystem::file_size(path, ec) < 4096 || ec) return std::nullopt; // an LFS pointer file is well under 4 kB; an HDF5 master is not return path; } }