From 6c13527020d65c410ee8daef18ee8273cdf8e827 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 26 Feb 2024 22:48:37 +0000 Subject: Add helper for loading fixtures for data tests from fixture JSON --- test/testHelpers.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/testHelpers.h b/test/testHelpers.h index f2b0901..58e4372 100644 --- a/test/testHelpers.h +++ b/test/testHelpers.h @@ -2,11 +2,22 @@ #include #include +#include +#include #include // IWYU pragma: keep std::setprecision +#include #include std::unique_ptr uasprintf(const char * fmt, ...) __attribute__((format(printf, 1, 2))); +template +decltype(auto) +loadFixtureJson(const std::filesystem::path & path) +{ + std::ifstream in {FIXTURESDIR / path}; + return Persistence::JsonParsePersistence {}.loadState>(in); +} + #define BOOST_CHECK_CLOSE_VEC(a_, b_) \ { \ const auto a {a_}, b {b_}; \ -- cgit v1.2.3