From d0fe9fe6c613ec8894ca4b1d330e7847845a4710 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 23 Aug 2025 15:34:51 +0100 Subject: Add DB schema and setup a mock of it in testing --- test/Jamfile.jam | 6 ++++++ test/test-ingest.cpp | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) (limited to 'test') diff --git a/test/Jamfile.jam b/test/Jamfile.jam index a008606..8460cef 100644 --- a/test/Jamfile.jam +++ b/test/Jamfile.jam @@ -1,14 +1,20 @@ lib boost_unit_test_framework : : shared ; +lib dbpptestcore : : shared ; +lib stdc++fs ; path-constant src : ../src ; path-constant test : . ; run test-ingest.cpp : -- : + ../src/schema.sql : BOOST_TEST_DYN_LINK SRC=\"$(src)\" TEST=\"$(test)\" $(src)//webstat + ..//dbpp-postgresql boost_unit_test_framework + dbpptestcore + stdc++fs ; diff --git a/test/test-ingest.cpp b/test/test-ingest.cpp index 0bbeeae..af063f3 100644 --- a/test/test-ingest.cpp +++ b/test/test-ingest.cpp @@ -2,7 +2,24 @@ #include #include +#include +#include #include +#include + +#define XSTR(s) STR(s) +#define STR(s) #s +const std::filesystem::path SRC_DIR(XSTR(SRC)); +const std::filesystem::path TEST_DIR(XSTR(TEST)); +#undef XSTR +#undef STR + +class Mock : public DB::PluginMock { +public: + Mock() : DB::PluginMock("webstat", {SRC_DIR / "schema.sql"}, "user=postgres dbname=postgres") { } +}; + +BOOST_GLOBAL_FIXTURE(Mock); using ScanValues = std::remove_cvref_t()->values())>; template using ParseData = std::tuple; -- cgit v1.2.3