summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/core/RangeSetTest.cpp6
-rw-r--r--test/core/model/DomainTest.cpp26
-rw-r--r--test/core/model/TestAdvanced.hpp4
-rw-r--r--test/core/model/TestDomain.hpp8
-rw-r--r--test/plugins/xml/XmlParserTest.cpp8
5 files changed, 29 insertions, 23 deletions
diff --git a/test/core/RangeSetTest.cpp b/test/core/RangeSetTest.cpp
index e158233..cbf8f59 100644
--- a/test/core/RangeSetTest.cpp
+++ b/test/core/RangeSetTest.cpp
@@ -216,5 +216,11 @@ TEST(RangeSet, Contains)
ASSERT_TRUE(s.contains(Range<int>(70, 74)));
}
+TEST(RangeSet, AnyCardinality){
+ RangeSet<size_t> expected;
+ expected.merge(Range<size_t>::typeRange());
+ ASSERT_EQ(expected, Cardinality::any());
+}
+
}
diff --git a/test/core/model/DomainTest.cpp b/test/core/model/DomainTest.cpp
index 8fcd21d..0c85d10 100644
--- a/test/core/model/DomainTest.cpp
+++ b/test/core/model/DomainTest.cpp
@@ -154,25 +154,25 @@ TEST(Descriptor, pathToAdvanced)
// Let's create the classes that we need first
Rooted<StructuredClass> A{new StructuredClass(
- mgr, "A", domain, AnyCardinality, {nullptr}, false, true)};
+ mgr, "A", domain, Cardinality::any(), {nullptr}, false, true)};
Rooted<StructuredClass> start{new StructuredClass(
- mgr, "start", domain, AnyCardinality, A, false, false)};
+ mgr, "start", domain, Cardinality::any(), A, false, false)};
Rooted<StructuredClass> B{new StructuredClass(
- mgr, "B", domain, AnyCardinality, {nullptr}, true, false)};
+ mgr, "B", domain, Cardinality::any(), {nullptr}, true, false)};
Rooted<StructuredClass> C{
- new StructuredClass(mgr, "C", domain, AnyCardinality, B, true, false)};
+ new StructuredClass(mgr, "C", domain, Cardinality::any(), B, true, false)};
Rooted<StructuredClass> D{new StructuredClass(
- mgr, "D", domain, AnyCardinality, {nullptr}, true, false)};
+ mgr, "D", domain, Cardinality::any(), {nullptr}, true, false)};
Rooted<StructuredClass> E{new StructuredClass(
- mgr, "E", domain, AnyCardinality, {nullptr}, true, false)};
+ mgr, "E", domain, Cardinality::any(), {nullptr}, true, false)};
Rooted<StructuredClass> target{
- new StructuredClass(mgr, "target", domain, AnyCardinality)};
+ new StructuredClass(mgr, "target", domain, Cardinality::any())};
// We create two fields for A
Rooted<FieldDescriptor> A_field{new FieldDescriptor(mgr, A)};
@@ -223,19 +223,19 @@ TEST(StructuredClass, isSubclassOf)
Rooted<SystemTypesystem> sys{new SystemTypesystem(mgr)};
Rooted<Domain> domain{new Domain(mgr, sys, "inheritance")};
Rooted<StructuredClass> A{new StructuredClass(
- mgr, "A", domain, AnyCardinality, {nullptr}, false, true)};
+ mgr, "A", domain, Cardinality::any(), {nullptr}, false, true)};
// first branch
Rooted<StructuredClass> B{
- new StructuredClass(mgr, "B", domain, AnyCardinality, A)};
+ new StructuredClass(mgr, "B", domain, Cardinality::any(), A)};
Rooted<StructuredClass> C{
- new StructuredClass(mgr, "C", domain, AnyCardinality, B)};
+ new StructuredClass(mgr, "C", domain, Cardinality::any(), B)};
// second branch
Rooted<StructuredClass> D{
- new StructuredClass(mgr, "D", domain, AnyCardinality, A)};
+ new StructuredClass(mgr, "D", domain, Cardinality::any(), A)};
Rooted<StructuredClass> E{
- new StructuredClass(mgr, "E", domain, AnyCardinality, D)};
+ new StructuredClass(mgr, "E", domain, Cardinality::any(), D)};
Rooted<StructuredClass> F{
- new StructuredClass(mgr, "F", domain, AnyCardinality, D)};
+ new StructuredClass(mgr, "F", domain, Cardinality::any(), D)};
// check function results
ASSERT_FALSE(A->isSubclassOf(A));
diff --git a/test/core/model/TestAdvanced.hpp b/test/core/model/TestAdvanced.hpp
index 2e4a541..56738af 100644
--- a/test/core/model/TestAdvanced.hpp
+++ b/test/core/model/TestAdvanced.hpp
@@ -86,7 +86,7 @@ static Rooted<Domain> constructListDomain(Manager &mgr,
Rooted<StructuredClass> p = resolveDescriptor(bookDomain, "paragraph");
// set up item StructuredClass;
Rooted<StructuredClass> item{new StructuredClass(
- mgr, "item", domain, AnyCardinality, {nullptr}, false)};
+ mgr, "item", domain, Cardinality::any(), {nullptr}, false)};
// as field we want to copy the field of paragraph.
item->copyFieldDescriptor(p->getFieldDescriptors()[0]);
@@ -94,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, AnyCardinality, p, false)};
+ mgr, listType, domain, Cardinality::any(), 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 18c42bd..8b572a8 100644
--- a/test/core/model/TestDomain.hpp
+++ b/test/core/model/TestDomain.hpp
@@ -46,7 +46,7 @@ static Rooted<Domain> constructBookDomain(Manager &mgr,
// From there on the "section".
Rooted<StructuredClass> section{
- new StructuredClass(mgr, "section", domain, AnyCardinality)};
+ new StructuredClass(mgr, "section", domain, Cardinality::any())};
book_field->addChild(section);
// And the field of it.
@@ -54,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, AnyCardinality, {nullptr}, true)};
+ mgr, "paragraph", domain, Cardinality::any(), {nullptr}, true)};
section_field->addChild(paragraph);
book_field->addChild(paragraph);
@@ -64,7 +64,7 @@ static Rooted<Domain> constructBookDomain(Manager &mgr,
// We append "subsection" to section.
Rooted<StructuredClass> subsection{
- new StructuredClass(mgr, "subsection", domain, AnyCardinality)};
+ new StructuredClass(mgr, "subsection", domain, Cardinality::any())};
section_field->addChild(subsection);
// And the field of it.
@@ -76,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, AnyCardinality, {nullptr}, true)};
+ mgr, "text", domain, Cardinality::any(), {nullptr}, true)};
paragraph_field->addChild(text);
// ... and has a primitive field.
diff --git a/test/plugins/xml/XmlParserTest.cpp b/test/plugins/xml/XmlParserTest.cpp
index 647fc6d..6110fcb 100644
--- a/test/plugins/xml/XmlParserTest.cpp
+++ b/test/plugins/xml/XmlParserTest.cpp
@@ -97,7 +97,7 @@ static void checkAttributes(Handle<StructType> expected,
static void checkStructuredClass(
Handle<Node> n, const std::string &name, Handle<Domain> domain,
- Variant cardinality = AnyCardinality,
+ Variant cardinality = Cardinality::any(),
Handle<StructType> attributesDescriptor = nullptr,
Handle<StructuredClass> superclass = nullptr, bool transparent = false,
bool root = false)
@@ -115,7 +115,7 @@ static void checkStructuredClass(
static Rooted<StructuredClass> checkStructuredClass(
const std::string &resolve, const std::string &name, Handle<Domain> domain,
- Variant cardinality = AnyCardinality,
+ Variant cardinality = Cardinality::any(),
Handle<StructType> attributesDescriptor = nullptr,
Handle<StructuredClass> superclass = nullptr, bool transparent = false,
bool root = false)
@@ -230,9 +230,9 @@ TEST(XmlParser, domainParsing)
checkStructuredClass("subsection", "subsection", book_domain);
Rooted<StructuredClass> paragraph =
checkStructuredClass("paragraph", "paragraph", book_domain,
- AnyCardinality, nullptr, nullptr, true, false);
+ Cardinality::any(), nullptr, nullptr, true, false);
Rooted<StructuredClass> text =
- checkStructuredClass("text", "text", book_domain, AnyCardinality,
+ checkStructuredClass("text", "text", book_domain, Cardinality::any(),
nullptr, nullptr, true, false);
// check the FieldDescriptors.