summaryrefslogtreecommitdiff
path: root/test/core/model
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-02-12 11:33:01 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-02-12 11:33:01 +0100
commitebac41111fa33790acce7be45e599f8de37e7f43 (patch)
treef23a5875d30d28c35e5a8e352856f5f9a9ef7cf2 /test/core/model
parentdbf2eebdd88118dca79045ad0524061f8078e668 (diff)
Anchors do not have a name anymore and have a unique mapping to their AnnotationEntities. This also makes serialization much easier.
Diffstat (limited to 'test/core/model')
-rw-r--r--test/core/model/DocumentTest.cpp4
-rw-r--r--test/core/model/TestAdvanced.hpp6
2 files changed, 4 insertions, 6 deletions
diff --git a/test/core/model/DocumentTest.cpp b/test/core/model/DocumentTest.cpp
index 5acf13f..0c6eea6 100644
--- a/test/core/model/DocumentTest.cpp
+++ b/test/core/model/DocumentTest.cpp
@@ -269,12 +269,12 @@ TEST(Document, validate)
doc->referenceDomain(domain);
Rooted<StructuredEntity> root =
buildRootStructuredEntity(doc, logger, {"root"});
- Rooted<Anchor> start{new Anchor(mgr, "start", root)};
+ Rooted<Anchor> start{new Anchor(mgr, root)};
Rooted<StructuredEntity> child =
buildStructuredEntity(doc, logger, root, {"childSub"});
Rooted<DocumentPrimitive> primitive{
new DocumentPrimitive(mgr, child, {2}, "int")};
- Rooted<Anchor> end{new Anchor(mgr, "end", root)};
+ Rooted<Anchor> end{new Anchor(mgr, root)};
ASSERT_EQ(ValidationState::UNKNOWN, doc->getValidationState());
ASSERT_TRUE(doc->validate(logger));
// then add an AnnotationEntity without Anchors.
diff --git a/test/core/model/TestAdvanced.hpp b/test/core/model/TestAdvanced.hpp
index 575860b..27f33cc 100644
--- a/test/core/model/TestAdvanced.hpp
+++ b/test/core/model/TestAdvanced.hpp
@@ -150,19 +150,17 @@ static bool addHeading(Logger &logger, Handle<Document> doc,
return true;
}
-static int annoIdx = 1;
-
// Only works for non-overlapping annotations!
static bool addAnnotation(Logger &logger, Handle<Document> doc,
Handle<StructuredEntity> parent,
const std::string &text, const std::string &annoClass)
{
Manager &mgr = parent->getManager();
- Rooted<Anchor> start{new Anchor(mgr, std::to_string(annoIdx++), parent)};
+ Rooted<Anchor> start{new Anchor(mgr, parent)};
if (!addText(logger, doc, parent, text)) {
return false;
}
- Rooted<Anchor> end{new Anchor(mgr, std::to_string(annoIdx++), parent)};
+ Rooted<Anchor> end{new Anchor(mgr, parent)};
Rooted<AnnotationEntity> anno =
buildAnnotationEntity(doc, logger, {annoClass}, start, end);
if (anno.isNull()) {