diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-03-05 03:28:53 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-03-05 03:28:53 +0000 |
commit | c21b0f14a33f4c3121e643d45517965895211080 (patch) | |
tree | 31f8c5083c3ca87db93a7783693759d5e8480726 /test/test-persistence.cpp | |
parent | Unify asset factory perf tests as it's now a combined load/create operation (diff) | |
download | ilt-c21b0f14a33f4c3121e643d45517965895211080.tar.bz2 ilt-c21b0f14a33f4c3121e643d45517965895211080.tar.xz ilt-c21b0f14a33f4c3121e643d45517965895211080.zip |
Move persistence test objects to test library
Diffstat (limited to 'test/test-persistence.cpp')
-rw-r--r-- | test/test-persistence.cpp | 83 |
1 files changed, 1 insertions, 82 deletions
diff --git a/test/test-persistence.cpp b/test/test-persistence.cpp index 7bca91a..a72c481 100644 --- a/test/test-persistence.cpp +++ b/test/test-persistence.cpp @@ -3,6 +3,7 @@ #include <boost/test/data/test_case.hpp> #include <boost/test/unit_test.hpp> +#include "testStructures.h" #include <filesystem> #include <glm/glm.hpp> #include <iosfwd> @@ -14,75 +15,6 @@ #include <tuple> #include <vector> -struct AbsObject : public Persistence::Persistable { - std::string base; - - bool - persist(Persistence::PersistenceStore & store) override - { - return STORE_TYPE && STORE_MEMBER(base); - } - - virtual void dummy() const = 0; -}; - -struct SubObject : public AbsObject { - std::string sub; - - bool - persist(Persistence::PersistenceStore & store) override - { - return STORE_TYPE && AbsObject::persist(store) && STORE_MEMBER(sub); - } - - void - dummy() const override - { - } - - [[nodiscard]] std::string - getId() const override - { - return "someid"; - } -}; - -struct SubObject2 : public AbsObject { - bool - persist(Persistence::PersistenceStore & store) override - { - return STORE_TYPE && AbsObject::persist(store); - } - - void - dummy() const override - { - } -}; - -struct TestObject : public Persistence::Persistable { - TestObject() = default; - - float flt {}; - std::string str {}; - bool bl {}; - glm::vec3 pos {}; - std::vector<float> flts; - std::vector<glm::vec3> poss; - std::vector<std::vector<std::vector<std::string>>> nest; - std::unique_ptr<TestObject> ptr; - std::unique_ptr<AbsObject> aptr; - std::vector<std::unique_ptr<TestObject>> vptr; - - bool - persist(Persistence::PersistenceStore & store) override - { - return STORE_TYPE && STORE_MEMBER(flt) && STORE_MEMBER(str) && STORE_MEMBER(bl) && STORE_MEMBER(pos) - && STORE_MEMBER(flts) && STORE_MEMBER(poss) && STORE_MEMBER(nest) && STORE_MEMBER(ptr) - && STORE_MEMBER(aptr) && STORE_MEMBER(vptr); - } -}; - struct JPP { template<typename T> T @@ -214,19 +146,6 @@ BOOST_FIXTURE_TEST_CASE(test_conversion, JPP) BOOST_CHECK_EQUAL(to->flt, 3.14F); } -struct SharedTestObject : public Persistence::Persistable { - SharedTestObject() = default; - - std::shared_ptr<AbsObject> sptr; - std::shared_ptr<SubObject> ssptr; - - bool - persist(Persistence::PersistenceStore & store) override - { - return STORE_TYPE && STORE_MEMBER(sptr) && STORE_MEMBER(ssptr); - } -}; - BOOST_FIXTURE_TEST_CASE(load_shared_object_diff, JPP) { auto to = load_json<std::unique_ptr<SharedTestObject>>(FIXTURESDIR "json/shared_ptr_diff.json"); |