From 7a8a8a31416cfebf785135754035608f4d919bf5 Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Tue, 3 Feb 2015 22:36:32 +0100 Subject: removed references to variant::cardinality where I did not need them. --- test/core/model/DocumentTest.cpp | 2 +- test/core/model/DomainTest.cpp | 32 ++++++++++++++------------------ test/core/model/TestAdvanced.hpp | 9 +++------ test/core/model/TestDomain.hpp | 12 +++++------- 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 sys{new SystemTypesystem(mgr)}; Rooted domain{new Domain(mgr, sys, "trivial")}; - Variant::cardinalityType single; + Cardinality single; single.merge({1}); // Set up the "root" StructuredClass. Rooted 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 sys{new SystemTypesystem(mgr)}; // Construct the domain Rooted domain{new Domain(mgr, sys, "nasty")}; - Variant::cardinalityType any; - any.merge(Range::typeRange()); // Let's create the classes that we need first Rooted A{new StructuredClass( - mgr, "A", domain, any, {nullptr}, {nullptr}, false, true)}; + mgr, "A", domain, AnyCardinality, {nullptr}, {nullptr}, false, true)}; Rooted start{new StructuredClass( - mgr, "start", domain, any, {nullptr}, A, false, false)}; + mgr, "start", domain, AnyCardinality, {nullptr}, A, false, false)}; Rooted B{new StructuredClass( - mgr, "B", domain, any, {nullptr}, {nullptr}, true, false)}; + mgr, "B", domain, AnyCardinality, {nullptr}, {nullptr}, true, false)}; - Rooted C{ - new StructuredClass(mgr, "C", domain, any, {nullptr}, B, true, false)}; + Rooted C{new StructuredClass( + mgr, "C", domain, AnyCardinality, {nullptr}, B, true, false)}; Rooted D{new StructuredClass( - mgr, "D", domain, any, {nullptr}, {nullptr}, true, false)}; + mgr, "D", domain, AnyCardinality, {nullptr}, {nullptr}, true, false)}; Rooted E{new StructuredClass( - mgr, "E", domain, any, {nullptr}, {nullptr}, true, false)}; + mgr, "E", domain, AnyCardinality, {nullptr}, {nullptr}, true, false)}; Rooted target{ - new StructuredClass(mgr, "target", domain, any)}; + new StructuredClass(mgr, "target", domain, AnyCardinality)}; // We create two fields for A Rooted A_field{new FieldDescriptor(mgr, A)}; @@ -224,22 +222,20 @@ TEST(StructuredClass, isSubclassOf) Manager mgr{1}; Rooted sys{new SystemTypesystem(mgr)}; Rooted domain{new Domain(mgr, sys, "inheritance")}; - Variant::cardinalityType any; - any.merge(Range::typeRange()); Rooted A{new StructuredClass( - mgr, "A", domain, any, {nullptr}, {nullptr}, false, true)}; + mgr, "A", domain, AnyCardinality, {nullptr}, {nullptr}, false, true)}; // first branch Rooted B{ - new StructuredClass(mgr, "B", domain, any, {nullptr}, A)}; + new StructuredClass(mgr, "B", domain, AnyCardinality, {nullptr}, A)}; Rooted C{ - new StructuredClass(mgr, "C", domain, any, {nullptr}, B)}; + new StructuredClass(mgr, "C", domain, AnyCardinality, {nullptr}, B)}; // second branch Rooted D{ - new StructuredClass(mgr, "D", domain, any, {nullptr}, A)}; + new StructuredClass(mgr, "D", domain, AnyCardinality, {nullptr}, A)}; Rooted E{ - new StructuredClass(mgr, "E", domain, any, {nullptr}, D)}; + new StructuredClass(mgr, "E", domain, AnyCardinality, {nullptr}, D)}; Rooted 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 constructHeadingDomain(Manager &mgr, // set up domain node. Rooted 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 heading{new StructuredClass( @@ -82,14 +82,11 @@ static Rooted constructListDomain(Manager &mgr, { // set up domain node. Rooted domain{new Domain(mgr, sys, "list")}; - // set up cardinality - Variant::cardinalityType any; - any.merge(Range::typeRange()); // get book.paragraph Rooted p = resolveDescriptor(bookDomain, "paragraph"); // set up item StructuredClass; Rooted 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 constructListDomain(Manager &mgr, std::vector listTypes{"ol", "ul"}; for (auto &listType : listTypes) { Rooted list{new StructuredClass( - mgr, listType, domain, any, {nullptr}, p, false)}; + mgr, listType, domain, AnyCardinality, {nullptr}, p, false)}; Rooted 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 constructBookDomain(Manager &mgr, // Start with the Domain itself. Rooted 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::typeRange()); // Set up the "book" node. Rooted book{new StructuredClass( @@ -48,7 +46,7 @@ static Rooted constructBookDomain(Manager &mgr, // From there on the "section". Rooted 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 constructBookDomain(Manager &mgr, // We also add the "paragraph", which is transparent. Rooted 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 constructBookDomain(Manager &mgr, // We append "subsection" to section. Rooted 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 constructBookDomain(Manager &mgr, // Finally we add the "text" node, which is transparent as well. Rooted 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. -- cgit v1.2.3