diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/core/model/DocumentTest.cpp | 3 | ||||
-rw-r--r-- | test/core/model/DomainTest.cpp | 3 | ||||
-rw-r--r-- | test/core/model/TestDomain.hpp | 30 | ||||
-rw-r--r-- | test/plugins/html/DemoOutputTest.cpp | 3 |
4 files changed, 13 insertions, 26 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)}; diff --git a/test/plugins/html/DemoOutputTest.cpp b/test/plugins/html/DemoOutputTest.cpp index 2db4012..6123c79 100644 --- a/test/plugins/html/DemoOutputTest.cpp +++ b/test/plugins/html/DemoOutputTest.cpp @@ -36,8 +36,9 @@ TEST(DemoHTMLTransformer, writeHTML) // Construct Manager Logger logger; Manager mgr{1}; + Rooted<model::SystemTypesystem> sys{new model::SystemTypesystem(mgr)}; // Get the domain. - Rooted<model::Domain> domain = model::constructBookDomain(mgr, logger); + Rooted<model::Domain> domain = constructBookDomain(mgr, sys, logger); // Construct the document. Rooted<model::Document> doc = model::constructBookDocument(mgr, domain); |