#include "fesa/io/Hdf5ResultWriter.hpp" #include namespace { int require(bool condition) { return condition ? 0 : 1; } template int require_throws(Function&& function) { try { function(); } catch (const Exception&) { return 0; } catch (...) { return 1; } return 1; } int construct_writer_preserves_output_path() { const fesa::io::Hdf5ResultWriter writer{"results.h5"}; return require(writer.filePath() == "results.h5"); } int empty_output_path_throws() { return require_throws([]() { (void)fesa::io::Hdf5ResultWriter{""}; }); } } // namespace int main() { if (const int result = construct_writer_preserves_output_path(); result != 0) { return result; } if (const int result = empty_output_path_throws(); result != 0) { return result; } return 0; }