summaryrefslogtreecommitdiff
path: root/test/test-persistence.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-03-02 18:36:34 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-03-02 18:36:34 +0000
commit17ac090dd1dd245cf1e24b62b7333ba9be571bde (patch)
tree488bb1dae6478dd72cc3cb8a433cbac736f9c387 /test/test-persistence.cpp
parentParse colour values as they're read (diff)
downloadilt-17ac090dd1dd245cf1e24b62b7333ba9be571bde.tar.bz2
ilt-17ac090dd1dd245cf1e24b62b7333ba9be571bde.tar.xz
ilt-17ac090dd1dd245cf1e24b62b7333ba9be571bde.zip
Add ParseBase
Acts as a base class for persistence parser, encompasses the parse stack and manages shared objects
Diffstat (limited to 'test/test-persistence.cpp')
-rw-r--r--test/test-persistence.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/test/test-persistence.cpp b/test/test-persistence.cpp
index 6bee010..7bca91a 100644
--- a/test/test-persistence.cpp
+++ b/test/test-persistence.cpp
@@ -83,16 +83,14 @@ struct TestObject : public Persistence::Persistable {
}
};
-struct JPP : public Persistence::JsonParsePersistence {
+struct JPP {
template<typename T>
T
load_json(const std::filesystem::path & path)
{
BOOST_TEST_CONTEXT(path) {
std::ifstream ss {path};
- auto to = loadState<T>(ss);
- Persistence::sharedObjects.clear();
- BOOST_CHECK(stk.empty());
+ auto to = Persistence::JsonParsePersistence {}.loadState<T>(ss);
BOOST_REQUIRE(to);
return to;
}
@@ -289,10 +287,10 @@ auto const TEST_STRINGS_DECODE_ONLY = boost::unit_test::data::make<svs>({
{R"J("\u056b ARMENIAN SMALL LETTER INI")J", "ի ARMENIAN SMALL LETTER INI"},
{R"J("\u0833 SAMARITAN PUNCTUATION BAU")J", "࠳ SAMARITAN PUNCTUATION BAU"},
});
-BOOST_DATA_TEST_CASE_F(JPP, load_strings, TEST_STRINGS + TEST_STRINGS_DECODE_ONLY, in, exp)
+BOOST_DATA_TEST_CASE(load_strings, TEST_STRINGS + TEST_STRINGS_DECODE_ONLY, in, exp)
{
std::stringstream str {in};
- BOOST_CHECK_EQUAL(loadState<std::string>(str), exp);
+ BOOST_CHECK_EQUAL(Persistence::JsonParsePersistence {}.loadState<std::string>(str), exp);
}
using cpstr = std::tuple<unsigned long, std::string_view>;