summaryrefslogtreecommitdiff
path: root/test/test-util.hpp
blob: 20020f8022f73b6032457b5b1e6459440d15a28f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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>;
}