3#include <gtest/gtest.h>
6#include "tests/libstore.hh"
7#include "tests/characterization.hh"
11template<
class Proto, const
char * protocolDir>
15 Path unitTestData = getUnitTestData() +
"/libstore/" + protocolDir;
17 Path goldenMaster(std::string_view testStem) {
18 return unitTestData +
"/" + testStem +
".bin";
22template<
class Proto, const
char * protocolDir>
30 void readTest(PathView testStem,
typename Proto::Version version, T value)
34 GTEST_SKIP() << cannotReadGoldenMaster;
38 auto expected = readFile(ProtoTest<Proto, protocolDir>::goldenMaster(testStem));
42 Proto::template Serialise<T>::read(
44 typename Proto::ReadConn {from, version}
48 ASSERT_EQ(got, value);
56 void writeTest(PathView testStem,
typename Proto::Version version,
const T & value)
58 auto file = ProtoTest<Proto, protocolDir>::goldenMaster(testStem);
63 typename Proto::WriteConn {version},
68 createDirs(dirOf(file));
69 writeFile(file, to.s);
70 GTEST_SKIP() << updatingGoldenMaster;
74 auto expected = readFile(file);
75 ASSERT_EQ(to.s, expected);
80#define VERSIONED_CHARACTERIZATION_TEST(FIXTURE, NAME, STEM, VERSION, VALUE) \
81 TEST_F(FIXTURE, NAME ## _read) { \
82 readTest(STEM, VERSION, VALUE); \
84 TEST_F(FIXTURE, NAME ## _write) { \
85 writeTest(STEM, VERSION, VALUE); \
Definition protocol.hh:13
Definition protocol.hh:24
void readTest(PathView testStem, typename Proto::Version version, T value)
Definition protocol.hh:30
void writeTest(PathView testStem, typename Proto::Version version, const T &value)
Definition protocol.hh:56
Definition serialise.hh:188
Definition serialise.hh:204
std::string Path
Definition types.hh:28