diff options
Diffstat (limited to 'test/test-util.hpp')
-rw-r--r-- | test/test-util.hpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/test-util.hpp b/test/test-util.hpp new file mode 100644 index 0000000..20020f8 --- /dev/null +++ b/test/test-util.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include "pq-mock.h" +#include <filesystem> + +namespace WebStat { +#define XSTR(s) STR(s) +#define STR(s) #s + inline const std::filesystem::path SRC_DIR(XSTR(SRC)); +#undef XSTR +#undef STR + + template<auto Deleter> + using DeleteWith = decltype([](auto obj) { + return Deleter(obj); + }); + using FilePtr = std::unique_ptr<std::FILE, DeleteWith<&fclose>>; + + struct MockDB : public DB::PluginMock<PQ::Mock> { + MockDB(); + }; + + template<typename Out> using ParseData = std::tuple<std::string_view, Out>; +} |