summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-02-03 22:36:32 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-02-03 22:36:32 +0100
commit7a8a8a31416cfebf785135754035608f4d919bf5 (patch)
tree01d002a1406e35de7f5ba98fcca4488ab743cb22
parente5a0db3de5bcee624e680ef62d1c02f22e1d3591 (diff)
removed references to variant::cardinality where I did not need them.
-rw-r--r--test/core/model/DocumentTest.cpp2
-rw-r--r--test/core/model/DomainTest.cpp32
-rw-r--r--test/core/model/TestAdvanced.hpp9
-rw-r--r--test/core/model/TestDomain.hpp12
4 files changed, 23 insertions, 32 deletions
diff --git a/test/core/model/DocumentTest.cpp b/test/core/model/DocumentTest.cpp
index c629bf5..7190437 100644
--- a/test/core/model/DocumentTest.cpp
+++ b/test/core/model/DocumentTest.cpp
@@ -116,7 +116,7 @@ TEST(Document, validate)
Manager mgr{1};
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
Rooted<Domain> domain{new Domain(mgr, sys, "trivial")};
- Variant::cardinalityType single;
+ Cardinality single;
single.merge({1});
// Set up the "root" StructuredClass.
Rooted<StructuredClass> rootClass{new StructuredClass(
diff --git a/test/core/model/DomainTest.cpp b/test/core/model/DomainTest.cpp
index 767ac0c..32cdd24 100644
--- a/test/core/model/DomainTest.cpp
+++ b/test/core/model/DomainTest.cpp
@@ -151,30 +151,28 @@ TEST(Descriptor, pathToAdvanced)
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
// Construct the domain
Rooted<Domain> domain{new Domain(mgr, sys, "nasty")};
- Variant::cardinalityType any;
- any.merge(Range<size_t>::typeRange());
// Let's create the classes that we need first
Rooted<StructuredClass> A{new StructuredClass(
- mgr, "A", domain, any, {nullptr}, {nullptr}, false, true)};
+ mgr, "A", domain, AnyCardinality, {nullptr}, {nullptr}, false, true)};
Rooted<StructuredClass> start{new StructuredClass(
- mgr, "start", domain, any, {nullptr}, A, false, false)};
+ mgr, "start", domain, AnyCardinality, {nullptr}, A, false, false)};
Rooted<StructuredClass> B{new StructuredClass(
- mgr, "B", domain, any, {nullptr}, {nullptr}, true, false)};
+ mgr, "B", domain, AnyCardinality, {nullptr}, {nullptr}, true, false)};
- Rooted<StructuredClass> C{
- new StructuredClass(mgr, "C", domain, any, {nullptr}, B, true, false)};
+ Rooted<StructuredClass> C{new StructuredClass(
+ mgr, "C", domain, AnyCardinality, {nullptr}, B, true, false)};
Rooted<StructuredClass> D{new StructuredClass(
- mgr, "D", domain, any, {nullptr}, {nullptr}, true, false)};
+ mgr, "D", domain, AnyCardinality, {nullptr}, {nullptr}, true, false)};
Rooted<StructuredClass> E{new StructuredClass(
- mgr, "E", domain, any, {nullptr}, {nullptr}, true, false)};
+ mgr, "E", domain, AnyCardinality, {nullptr}, {nullptr}, true, false)};
Rooted<StructuredClass> target{
- new StructuredClass(mgr, "target", domain, any)};
+ new StructuredClass(mgr, "target", domain, AnyCardinality)};
// We create two fields for A
Rooted<FieldDescriptor> A_field{new FieldDescriptor(mgr, A)};
@@ -224,22 +222,20 @@ TEST(StructuredClass, isSubclassOf)
Manager mgr{1};
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
Rooted<Domain> domain{new Domain(mgr, sys, "inheritance")};
- Variant::cardinalityType any;
- any.merge(Range<size_t>::typeRange());
Rooted<StructuredClass> A{new StructuredClass(
- mgr, "A", domain, any, {nullptr}, {nullptr}, false, true)};
+ mgr, "A", domain, AnyCardinality, {nullptr}, {nullptr}, false, true)};
// first branch
Rooted<StructuredClass> B{
- new StructuredClass(mgr, "B", domain, any, {nullptr}, A)};
+ new StructuredClass(mgr, "B", domain, AnyCardinality, {nullptr}, A)};
Rooted<StructuredClass> C{
- new StructuredClass(mgr, "C", domain, any, {nullptr}, B)};
+ new StructuredClass(mgr, "C", domain, AnyCardinality, {nullptr}, B)};
// second branch
Rooted<StructuredClass> D{
- new StructuredClass(mgr, "D", domain, any, {nullptr}, A)};
+ new StructuredClass(mgr, "D", domain, AnyCardinality, {nullptr}, A)};
Rooted<StructuredClass> E{
- new StructuredClass(mgr, "E", domain, any, {nullptr}, D)};
+ new StructuredClass(mgr, "E", domain, AnyCardinality, {nullptr}, D)};
Rooted<StructuredClass> F{
- new StructuredClass(mgr, "F", domain, any, {nullptr}, D)};
+ new StructuredClass(mgr, "F", domain, AnyCardinality, {nullptr}, D)};
// check function results
ASSERT_FALSE(A->isSubclassOf(A));
diff --git a/test/core/model/TestAdvanced.hpp b/test/core/model/TestAdvanced.hpp
index e3744b8..3845676 100644
--- a/test/core/model/TestAdvanced.hpp
+++ b/test/core/model/TestAdvanced.hpp
@@ -52,7 +52,7 @@ static Rooted<Domain> constructHeadingDomain(Manager &mgr,
// set up domain node.
Rooted<Domain> domain{new Domain(mgr, sys, "headings")};
// set up cardinality (every section may have at most one heading).
- Variant::cardinalityType card;
+ Cardinality card;
card.merge({0, 1});
// set up heading StructuredClass.
Rooted<StructuredClass> heading{new StructuredClass(
@@ -82,14 +82,11 @@ static Rooted<Domain> constructListDomain(Manager &mgr,
{
// set up domain node.
Rooted<Domain> domain{new Domain(mgr, sys, "list")};
- // set up cardinality
- Variant::cardinalityType any;
- any.merge(Range<size_t>::typeRange());
// get book.paragraph
Rooted<StructuredClass> p = resolveDescriptor(bookDomain, "paragraph");
// set up item StructuredClass;
Rooted<StructuredClass> item{new StructuredClass(
- mgr, "item", domain, any, {nullptr}, {nullptr}, false)};
+ mgr, "item", domain, AnyCardinality, {nullptr}, {nullptr}, false)};
// as field we want to copy the field of paragraph.
item->copyFieldDescriptor(p->getFieldDescriptors()[0]);
@@ -97,7 +94,7 @@ static Rooted<Domain> constructListDomain(Manager &mgr,
std::vector<std::string> listTypes{"ol", "ul"};
for (auto &listType : listTypes) {
Rooted<StructuredClass> list{new StructuredClass(
- mgr, listType, domain, any, {nullptr}, p, false)};
+ mgr, listType, domain, AnyCardinality, {nullptr}, p, false)};
Rooted<FieldDescriptor> list_field{new FieldDescriptor(mgr, list)};
list_field->addChild(item);
}
diff --git a/test/core/model/TestDomain.hpp b/test/core/model/TestDomain.hpp
index a36f593..88ab715 100644
--- a/test/core/model/TestDomain.hpp
+++ b/test/core/model/TestDomain.hpp
@@ -34,10 +34,8 @@ static Rooted<Domain> constructBookDomain(Manager &mgr,
// Start with the Domain itself.
Rooted<Domain> domain{new Domain(mgr, sys, "book")};
// Set up the cardinalities we'll need.
- Variant::cardinalityType single;
+ Cardinality single;
single.merge({1});
- Variant::cardinalityType any;
- any.merge(Range<size_t>::typeRange());
// Set up the "book" node.
Rooted<StructuredClass> book{new StructuredClass(
@@ -48,7 +46,7 @@ static Rooted<Domain> constructBookDomain(Manager &mgr,
// From there on the "section".
Rooted<StructuredClass> section{
- new StructuredClass(mgr, "section", domain, any)};
+ new StructuredClass(mgr, "section", domain, AnyCardinality)};
book_field->addChild(section);
// And the field of it.
@@ -56,7 +54,7 @@ static Rooted<Domain> constructBookDomain(Manager &mgr,
// We also add the "paragraph", which is transparent.
Rooted<StructuredClass> paragraph{new StructuredClass(
- mgr, "paragraph", domain, any, {nullptr}, {nullptr}, true)};
+ mgr, "paragraph", domain, AnyCardinality, {nullptr}, {nullptr}, true)};
section_field->addChild(paragraph);
book_field->addChild(paragraph);
@@ -66,7 +64,7 @@ static Rooted<Domain> constructBookDomain(Manager &mgr,
// We append "subsection" to section.
Rooted<StructuredClass> subsection{
- new StructuredClass(mgr, "subsection", domain, any)};
+ new StructuredClass(mgr, "subsection", domain, AnyCardinality)};
section_field->addChild(subsection);
// And the field of it.
@@ -78,7 +76,7 @@ static Rooted<Domain> constructBookDomain(Manager &mgr,
// Finally we add the "text" node, which is transparent as well.
Rooted<StructuredClass> text{new StructuredClass(
- mgr, "text", domain, any, {nullptr}, {nullptr}, true)};
+ mgr, "text", domain, AnyCardinality, {nullptr}, {nullptr}, true)};
paragraph_field->addChild(text);
// ... and has a primitive field.