summaryrefslogtreecommitdiff
path: root/test/core/model
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/model')
-rw-r--r--test/core/model/DocumentTest.cpp3
-rw-r--r--test/core/model/DomainTest.cpp3
-rw-r--r--test/core/model/TestDomain.hpp30
3 files changed, 11 insertions, 25 deletions
diff --git a/test/core/model/DocumentTest.cpp b/test/core/model/DocumentTest.cpp
index a671d2c..c86b285 100644
--- a/test/core/model/DocumentTest.cpp
+++ b/test/core/model/DocumentTest.cpp
@@ -32,8 +32,9 @@ TEST(Document, testDocumentConstruction)
// Construct Manager
Logger logger;
Manager mgr{1};
+ Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
// Get the domain.
- Rooted<Domain> domain = constructBookDomain(mgr, logger);
+ Rooted<Domain> domain = constructBookDomain(mgr, sys, logger);
// Construct the document.
Rooted<Document> doc = constructBookDocument(mgr, domain);
diff --git a/test/core/model/DomainTest.cpp b/test/core/model/DomainTest.cpp
index d8ad882..f937842 100644
--- a/test/core/model/DomainTest.cpp
+++ b/test/core/model/DomainTest.cpp
@@ -48,8 +48,9 @@ TEST(Domain, testDomainResolving)
// Construct Manager
Logger logger;
Manager mgr{1};
+ Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
// Get the domain.
- Rooted<Domain> domain = constructBookDomain(mgr, logger);
+ Rooted<Domain> domain = constructBookDomain(mgr, sys, logger);
/*
* Start with the "book" search keyword. This should resolve to the domain
diff --git a/test/core/model/TestDomain.hpp b/test/core/model/TestDomain.hpp
index f457531..54e79ee 100644
--- a/test/core/model/TestDomain.hpp
+++ b/test/core/model/TestDomain.hpp
@@ -26,32 +26,15 @@ namespace ousia {
namespace model {
/**
- * This constructs a somewhat trivial system of standard types.
- *
- * Currently contained: string, text (struct wrapper for string)
- */
-static Rooted<Typesystem> constructTypeSystem(Manager &mgr, Logger &logger)
-{
- Rooted<Typesystem> sys{new Typesystem(mgr, "std")};
- Rooted<StringType> string{new StringType(mgr, sys)};
- sys->addType(string);
- Rooted<StructType> string_struct{StructType::createValidated(
- mgr, "text", sys, nullptr, {new Attribute(mgr, "content", string, "", false)}, logger)};
- sys->addType(string_struct);
-
- return sys;
-}
-
-/**
* This constructs the "book" domain for test purposes. The structure of the
* domain is fairly simple and can be seen from the construction itself.
*/
-static Rooted<Domain> constructBookDomain(Manager &mgr, Logger &logger)
+static Rooted<Domain> constructBookDomain(Manager &mgr,
+ Handle<SystemTypesystem> sys,
+ Logger &logger)
{
// Start with the Domain itself.
- Rooted<Domain> domain{new Domain(mgr, "book")};
- // The standard type system.
- domain->getTypesystems().push_back(constructTypeSystem(mgr, logger));
+ Rooted<Domain> domain{new Domain(mgr, sys, "book")};
// Set up the cardinalities we'll need.
Cardinality single;
single.merge({1});
@@ -82,9 +65,10 @@ static Rooted<Domain> constructBookDomain(Manager &mgr, Logger &logger)
book_field->getChildren().push_back(paragraph);
domain->getStructureClasses().push_back(paragraph);
// And the field of it.
- Rooted<FieldDescriptor> paragraph_field{new FieldDescriptor(mgr, paragraph)};
+ Rooted<FieldDescriptor> paragraph_field{
+ new FieldDescriptor(mgr, paragraph)};
paragraph->getFieldDescriptors().push_back(paragraph_field);
-
+
// Finally we add the "text" node, which is transparent as well.
Rooted<StructuredClass> text{new StructuredClass(
mgr, "text", domain, any, {nullptr}, {nullptr}, true)};