summaryrefslogtreecommitdiff
path: root/test/testStructures.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-03-05 03:28:53 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-03-05 03:28:53 +0000
commitc21b0f14a33f4c3121e643d45517965895211080 (patch)
tree31f8c5083c3ca87db93a7783693759d5e8480726 /test/testStructures.h
parentUnify asset factory perf tests as it's now a combined load/create operation (diff)
downloadilt-c21b0f14a33f4c3121e643d45517965895211080.tar.bz2
ilt-c21b0f14a33f4c3121e643d45517965895211080.tar.xz
ilt-c21b0f14a33f4c3121e643d45517965895211080.zip
Move persistence test objects to test library
Diffstat (limited to 'test/testStructures.h')
-rw-r--r--test/testStructures.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/testStructures.h b/test/testStructures.h
new file mode 100644
index 0000000..666562e
--- /dev/null
+++ b/test/testStructures.h
@@ -0,0 +1,52 @@
+#pragma once
+
+#include <persistence.h>
+
+struct AbsObject : public Persistence::Persistable {
+ std::string base;
+
+ bool persist(Persistence::PersistenceStore & store) override;
+
+ virtual void dummy() const = 0;
+};
+
+struct SubObject : public AbsObject {
+ std::string sub;
+
+ bool persist(Persistence::PersistenceStore & store) override;
+
+ void dummy() const override;
+
+ [[nodiscard]] std::string getId() const override;
+};
+
+struct SubObject2 : public AbsObject {
+ bool persist(Persistence::PersistenceStore & store) override;
+ 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;
+};
+
+struct SharedTestObject : public Persistence::Persistable {
+ SharedTestObject() = default;
+
+ std::shared_ptr<AbsObject> sptr;
+ std::shared_ptr<SubObject> ssptr;
+
+ bool persist(Persistence::PersistenceStore & store) override;
+};