diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-19 20:21:22 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-19 20:21:22 +0100 |
commit | 5f5858d503640286c9e5d23634f9f3a8de6a2091 (patch) | |
tree | 4e5167b154b8495e5d097ac309b6170aa4b84bb3 /test/core/model/DocumentTest.cpp | |
parent | 5e779c017020a8e0405ee8e43c6ea7d4a9a11ad2 (diff) |
(re-)introduced setter methods to Document.
Diffstat (limited to 'test/core/model/DocumentTest.cpp')
-rw-r--r-- | test/core/model/DocumentTest.cpp | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/test/core/model/DocumentTest.cpp b/test/core/model/DocumentTest.cpp index fea5296..874fba7 100644 --- a/test/core/model/DocumentTest.cpp +++ b/test/core/model/DocumentTest.cpp @@ -229,10 +229,18 @@ TEST(Document, validate) doc->addDomain(domain); Rooted<StructuredEntity> root = buildRootStructuredEntity(doc, logger, {"root"}); - buildStructuredEntity(doc, logger, root, {"childSub"}); + Rooted<StructuredEntity> child = + buildStructuredEntity(doc, logger, root, {"childSub"}); ASSERT_FALSE(doc->validate(logger)); + // if we add a DocumentPrimitive with the wrong content it should not + // work either. + Rooted<DocumentPrimitive> primitive{ + new DocumentPrimitive(mgr, child, {"ololol"}, "int")}; + //TODO: ASSERT_FALSE(doc->validate(logger)); + // but if we set the content right, it should work. + primitive->setContent({2}); + ASSERT_TRUE(doc->validate(logger)); } - // TODO: Check wrongly typed primitive content. // Now add an Annotation class to the domain. Rooted<AnnotationClass> annoClass{new AnnotationClass(mgr, "anno", domain)}; @@ -244,23 +252,6 @@ TEST(Document, validate) doc->addDomain(domain); Rooted<StructuredEntity> root = buildRootStructuredEntity(doc, logger, {"root"}); - Rooted<StructuredEntity> child = - buildStructuredEntity(doc, logger, root, {"childSub"}); - Rooted<DocumentPrimitive> primitive{ - new DocumentPrimitive(mgr, child, {2}, "int")}; - ASSERT_TRUE(doc->validate(logger)); - // then add an AnnotationEntity without Anchors. - buildAnnotationEntity(doc, logger, {"anno"}, nullptr, nullptr); - ASSERT_FALSE(doc->validate(logger)); - } - { - /* - * Do the same again, but with a valid AnnotationEntity now. - */ - Rooted<Document> doc{new Document(mgr, "myDoc.oxd")}; - doc->addDomain(domain); - Rooted<StructuredEntity> root = - buildRootStructuredEntity(doc, logger, {"root"}); Rooted<Anchor> start{new Anchor(mgr, "start", root)}; Rooted<StructuredEntity> child = buildStructuredEntity(doc, logger, root, {"childSub"}); @@ -269,7 +260,12 @@ TEST(Document, validate) Rooted<Anchor> end{new Anchor(mgr, "end", root)}; ASSERT_TRUE(doc->validate(logger)); // then add an AnnotationEntity without Anchors. - buildAnnotationEntity(doc, logger, {"anno"}, start, end); + Rooted<AnnotationEntity> anno = + buildAnnotationEntity(doc, logger, {"anno"}, nullptr, nullptr); + ASSERT_FALSE(doc->validate(logger)); + // but it should be valid again if we set the start end and Anchor. + anno->setStart(start); + anno->setEnd(end); ASSERT_TRUE(doc->validate(logger)); } } |