diff options
| author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-09 15:28:13 +0100 |
|---|---|---|
| committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-09 15:28:13 +0100 |
| commit | 1eece2559a6cf16f5732d128c1cb6e43c5f60fbc (patch) | |
| tree | 5086721fbe58ad9a5f34174890232cdb13d382c7 /test/core/model/TestDocument.hpp | |
| parent | 2fd367790fd61f427263bdcfda0acba848d73bd8 (diff) | |
Refactored building convenience methods to TestDocumentBuilder, added error logging and changed TestDocument and TestAdvanced as well as all users of those files accordingly.
Diffstat (limited to 'test/core/model/TestDocument.hpp')
| -rw-r--r-- | test/core/model/TestDocument.hpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/test/core/model/TestDocument.hpp b/test/core/model/TestDocument.hpp index 6b0267a..eaec42c 100644 --- a/test/core/model/TestDocument.hpp +++ b/test/core/model/TestDocument.hpp @@ -23,6 +23,8 @@ #include <core/model/Domain.hpp> #include <core/model/Typesystem.hpp> +#include "TestDocumentBuilder.hpp" + namespace ousia { namespace model { @@ -30,57 +32,58 @@ namespace model { * This constructs a fairly simple test document for the "book" domain. The * structure of the document can be seen in the Code below. */ -static Rooted<Document> constructBookDocument(Manager &mgr, +static Rooted<Document> constructBookDocument(Manager &mgr, Logger &logger, Rooted<Domain> bookDomain) { // Start with the (empty) document. Rooted<Document> doc{new Document(mgr, "myDoc.oxd")}; + doc->addDomain(bookDomain); // Add the root. Rooted<StructuredEntity> root = - StructuredEntity::buildRootEntity(doc, {bookDomain}, "book"); + buildRootStructuredEntity(doc, logger, {"book"}); if (root.isNull()) { return {nullptr}; } // Add a paragraph. Rooted<StructuredEntity> foreword = - StructuredEntity::buildEntity(root, {bookDomain}, "paragraph"); + buildStructuredEntity(doc, logger, root, {"paragraph"}); if (foreword.isNull()) { return {nullptr}; } // Add its text. Rooted<StructuredEntity> foreword_text = - StructuredEntity::buildEntity(foreword, {bookDomain}, "text"); + buildStructuredEntity(doc, logger, foreword, {"text"}); if (foreword_text.isNull()) { return {nullptr}; } // And its primitive content Variant text{"Some introductory text"}; Rooted<DocumentPrimitive> foreword_primitive = - DocumentPrimitive::buildEntity(foreword_text, text, "content"); + buildPrimitiveEntity(logger, foreword_text, text, "content"); if (foreword_primitive.isNull()) { return {nullptr}; } // Add a section. Rooted<StructuredEntity> section = - StructuredEntity::buildEntity(root, {bookDomain}, "section"); + buildStructuredEntity(doc, logger, root, {"section"}); // Add a paragraph for it. Rooted<StructuredEntity> main = - StructuredEntity::buildEntity(section, {bookDomain}, "paragraph"); + buildStructuredEntity(doc, logger, section, {"paragraph"}); if (main.isNull()) { return {nullptr}; } // Add its text. Rooted<StructuredEntity> main_text = - StructuredEntity::buildEntity(main, {bookDomain}, "text"); + buildStructuredEntity(doc, logger, main, {"text"}); if (main_text.isNull()) { return {nullptr}; } // And its primitive content text = Variant{"Some actual text"}; Rooted<DocumentPrimitive> main_primitive = - DocumentPrimitive::buildEntity(main_text, text, "content"); + buildPrimitiveEntity(logger, main_text, text, "content"); if (main_primitive.isNull()) { return {nullptr}; } |
