summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-20 00:53:59 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-20 00:53:59 +0100
commita5e125cd7f72907f95c83f5ec1611996f7a28a3a (patch)
treebb2a189c36c5d7b64d7a2f4d5fbfb946ff43cb4f /test
parent47311cc8b211a7fef033d744d9eba9f308726ea8 (diff)
parent7c64a0770a4800d80c5a53eea2243c46301f7749 (diff)
Merge branch 'master' of somweyr.de:ousia
Diffstat (limited to 'test')
-rw-r--r--test/core/model/DocumentTest.cpp36
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));
}
}