diff options
Diffstat (limited to 'test/core/model')
-rw-r--r-- | test/core/model/DomainTest.cpp | 38 | ||||
-rw-r--r-- | test/core/model/NodeTest.cpp | 36 | ||||
-rw-r--r-- | test/core/model/TestAdvanced.hpp | 2 | ||||
-rw-r--r-- | test/core/model/TestDocumentBuilder.hpp | 12 | ||||
-rw-r--r-- | test/core/model/TypesystemTest.cpp | 276 |
5 files changed, 182 insertions, 182 deletions
diff --git a/test/core/model/DomainTest.cpp b/test/core/model/DomainTest.cpp index 0c85d10..32ef7f0 100644 --- a/test/core/model/DomainTest.cpp +++ b/test/core/model/DomainTest.cpp @@ -28,7 +28,7 @@ namespace ousia { -void assert_path(const ResolutionResult &res, const Rtti &expected_type, +void assert_path(const ResolutionResult &res, const Rtti *expected_type, std::vector<std::string> expected_path) { // Check class/type @@ -50,41 +50,41 @@ TEST(Domain, testDomainResolving) std::vector<ResolutionResult> res; // There is one domain called "book" - res = domain->resolve(RttiTypes::Domain, "book"); + res = domain->resolve(&RttiTypes::Domain, "book"); ASSERT_EQ(1U, res.size()); - assert_path(res[0], RttiTypes::Domain, {"book"}); + assert_path(res[0], &RttiTypes::Domain, {"book"}); // There is one domain called "book" - res = domain->resolve(RttiTypes::StructuredClass, "book"); + res = domain->resolve(&RttiTypes::StructuredClass, "book"); ASSERT_EQ(1U, res.size()); - assert_path(res[0], RttiTypes::StructuredClass, {"book", "book"}); + assert_path(res[0], &RttiTypes::StructuredClass, {"book", "book"}); // If we explicitly ask for the "book, book" path, then only the // StructuredClass should be returned. - res = domain->resolve(RttiTypes::Domain, + res = domain->resolve(&RttiTypes::Domain, std::vector<std::string>{"book", "book"}); ASSERT_EQ(0U, res.size()); - res = domain->resolve(RttiTypes::StructuredClass, + res = domain->resolve(&RttiTypes::StructuredClass, std::vector<std::string>{"book", "book"}); ASSERT_EQ(1U, res.size()); // If we ask for "section" the result should be unique as well. - res = domain->resolve(RttiTypes::StructuredClass, "section"); + res = domain->resolve(&RttiTypes::StructuredClass, "section"); ASSERT_EQ(1U, res.size()); - assert_path(res[0], RttiTypes::StructuredClass, {"book", "section"}); + assert_path(res[0], &RttiTypes::StructuredClass, {"book", "section"}); // If we ask for "paragraph" it is referenced two times in the Domain graph, // but should be returned only once. - res = domain->resolve(RttiTypes::StructuredClass, "paragraph"); + res = domain->resolve(&RttiTypes::StructuredClass, "paragraph"); ASSERT_EQ(1U, res.size()); - assert_path(res[0], RttiTypes::StructuredClass, {"book", "paragraph"}); + assert_path(res[0], &RttiTypes::StructuredClass, {"book", "paragraph"}); } Rooted<StructuredClass> getClass(const std::string name, Handle<Domain> dom) { std::vector<ResolutionResult> res = - dom->resolve(RttiTypes::StructuredClass, name); + dom->resolve(&RttiTypes::StructuredClass, name); return res[0].node.cast<StructuredClass>(); } @@ -103,17 +103,17 @@ TEST(Descriptor, pathTo) // get the path in between. std::vector<Rooted<Node>> path = book->pathTo(section); ASSERT_EQ(1U, path.size()); - ASSERT_TRUE(path[0]->isa(RttiTypes::FieldDescriptor)); + ASSERT_TRUE(path[0]->isa(&RttiTypes::FieldDescriptor)); // get the text node. Rooted<StructuredClass> text = getClass("text", domain); // get the path between book and text via paragraph. path = book->pathTo(text); ASSERT_EQ(3U, path.size()); - ASSERT_TRUE(path[0]->isa(RttiTypes::FieldDescriptor)); - ASSERT_TRUE(path[1]->isa(RttiTypes::StructuredClass)); + ASSERT_TRUE(path[0]->isa(&RttiTypes::FieldDescriptor)); + ASSERT_TRUE(path[1]->isa(&RttiTypes::StructuredClass)); ASSERT_EQ("paragraph", path[1]->getName()); - ASSERT_TRUE(path[2]->isa(RttiTypes::FieldDescriptor)); + ASSERT_TRUE(path[2]->isa(&RttiTypes::FieldDescriptor)); // get the subsection node. Rooted<StructuredClass> subsection = getClass("subsection", domain); @@ -208,11 +208,11 @@ TEST(Descriptor, pathToAdvanced) // and now we should be able to find the shortest path as suggested std::vector<Rooted<Node>> path = start->pathTo(target); ASSERT_EQ(3U, path.size()); - ASSERT_TRUE(path[0]->isa(RttiTypes::FieldDescriptor)); + ASSERT_TRUE(path[0]->isa(&RttiTypes::FieldDescriptor)); ASSERT_EQ("second", path[0]->getName()); - ASSERT_TRUE(path[1]->isa(RttiTypes::StructuredClass)); + ASSERT_TRUE(path[1]->isa(&RttiTypes::StructuredClass)); ASSERT_EQ("B", path[1]->getName()); - ASSERT_TRUE(path[2]->isa(RttiTypes::FieldDescriptor)); + ASSERT_TRUE(path[2]->isa(&RttiTypes::FieldDescriptor)); ASSERT_EQ("$default", path[2]->getName()); } diff --git a/test/core/model/NodeTest.cpp b/test/core/model/NodeTest.cpp index d9ca5bb..cdcd018 100644 --- a/test/core/model/NodeTest.cpp +++ b/test/core/model/NodeTest.cpp @@ -85,18 +85,18 @@ TEST(Node, resolveCompositaSimple) child1->addCompositum(new TestNode(mgr, "child11")); std::vector<ResolutionResult> res; - res = root->resolve(RttiTypes::TestNode, + res = root->resolve(&RttiTypes::TestNode, std::vector<std::string>{"root", "child1", "child11"}); ASSERT_EQ(1U, res.size()); ASSERT_TRUE(child11 == res[0].node); - res = root->resolve(RttiTypes::TestNode, + res = root->resolve(&RttiTypes::TestNode, std::vector<std::string>{"child1", "child11"}); ASSERT_EQ(1U, res.size()); ASSERT_TRUE(child11 == res[0].node); res = - root->resolve(RttiTypes::TestNode, std::vector<std::string>{"child11"}); + root->resolve(&RttiTypes::TestNode, std::vector<std::string>{"child11"}); ASSERT_EQ(1U, res.size()); ASSERT_TRUE(child11 == res[0].node); } @@ -111,18 +111,18 @@ TEST(Node, resolveCompositaDouble) child1->addCompositum(new TestNode(mgr, "child11")); std::vector<ResolutionResult> res; - res = root->resolve(RttiTypes::TestNode, + res = root->resolve(&RttiTypes::TestNode, std::vector<std::string>{"root", "child1", "child11"}); ASSERT_EQ(1U, res.size()); ASSERT_TRUE(child11 == res[0].node); - res = root->resolve(RttiTypes::TestNode, + res = root->resolve(&RttiTypes::TestNode, std::vector<std::string>{"child1", "child11"}); ASSERT_EQ(1U, res.size()); ASSERT_TRUE(child11 == res[0].node); res = - root->resolve(RttiTypes::TestNode, std::vector<std::string>{"child11"}); + root->resolve(&RttiTypes::TestNode, std::vector<std::string>{"child11"}); ASSERT_EQ(1U, res.size()); ASSERT_TRUE(child11 == res[0].node); } @@ -141,14 +141,14 @@ TEST(Node, resolveAmbigousComposita) child12->addCompositum(new TestNode(mgr, "child11")); std::vector<ResolutionResult> res; - res = root->resolve(RttiTypes::TestNode, + res = root->resolve(&RttiTypes::TestNode, std::vector<std::string>{"child1", "child11"}); ASSERT_EQ(2U, res.size()); ASSERT_TRUE(child11 == res[0].node || child11 == res[1].node); ASSERT_TRUE(child112 == res[0].node || child112 == res[1].node); res = - root->resolve(RttiTypes::TestNode, std::vector<std::string>{"child11"}); + root->resolve(&RttiTypes::TestNode, std::vector<std::string>{"child11"}); ASSERT_EQ(2U, res.size()); ASSERT_TRUE(child11 == res[0].node || child11 == res[1].node); ASSERT_TRUE(child112 == res[0].node || child112 == res[1].node); @@ -168,30 +168,30 @@ TEST(Node, resolveReferences) child12->addCompositum(new TestNode(mgr, "child11")); std::vector<ResolutionResult> res; - res = root->resolve(RttiTypes::TestNode, + res = root->resolve(&RttiTypes::TestNode, std::vector<std::string>{"a", "child1", "child11"}); ASSERT_EQ(1U, res.size()); ASSERT_TRUE(child11 == res[0].node); - res = root->resolve(RttiTypes::TestNode, + res = root->resolve(&RttiTypes::TestNode, std::vector<std::string>{"b", "child1", "child11"}); ASSERT_EQ(1U, res.size()); ASSERT_TRUE(child112 == res[0].node); - res = root->resolve(RttiTypes::TestNode, + res = root->resolve(&RttiTypes::TestNode, std::vector<std::string>{"child1", "child11"}); ASSERT_EQ(2U, res.size()); ASSERT_TRUE(child11 == res[0].node || child11 == res[1].node); ASSERT_TRUE(child112 == res[0].node || child112 == res[1].node); res = - root->resolve(RttiTypes::TestNode, std::vector<std::string>{"child11"}); + root->resolve(&RttiTypes::TestNode, std::vector<std::string>{"child11"}); ASSERT_EQ(2U, res.size()); ASSERT_TRUE(child11 == res[0].node || child11 == res[1].node); ASSERT_TRUE(child112 == res[0].node || child112 == res[1].node); res = - root->resolve(RttiTypes::TestNode, std::vector<std::string>{"child1"}); + root->resolve(&RttiTypes::TestNode, std::vector<std::string>{"child1"}); ASSERT_EQ(2U, res.size()); ASSERT_TRUE(child1 == res[0].node || child1 == res[1].node); ASSERT_TRUE(child12 == res[0].node || child12 == res[1].node); @@ -212,31 +212,31 @@ TEST(Node, resolveReferencesAndComposita) Rooted<TestNode> child13 = root->addCompositum(new TestNode(mgr, "child1")); std::vector<ResolutionResult> res; - res = root->resolve(RttiTypes::TestNode, + res = root->resolve(&RttiTypes::TestNode, std::vector<std::string>{"a", "child1", "child11"}); ASSERT_EQ(1U, res.size()); ASSERT_TRUE(child11 == res[0].node); - res = root->resolve(RttiTypes::TestNode, + res = root->resolve(&RttiTypes::TestNode, std::vector<std::string>{"b", "child1", "child11"}); ASSERT_EQ(1U, res.size()); ASSERT_TRUE(child112 == res[0].node); - res = root->resolve(RttiTypes::TestNode, + res = root->resolve(&RttiTypes::TestNode, std::vector<std::string>{"child1", "child11"}); ASSERT_EQ(2U, res.size()); ASSERT_TRUE(child11 == res[0].node || child11 == res[1].node); ASSERT_TRUE(child112 == res[0].node || child112 == res[1].node); res = - root->resolve(RttiTypes::TestNode, std::vector<std::string>{"child11"}); + root->resolve(&RttiTypes::TestNode, std::vector<std::string>{"child11"}); ASSERT_EQ(2U, res.size()); ASSERT_TRUE(child11 == res[0].node || child11 == res[1].node); ASSERT_TRUE(child112 == res[0].node || child112 == res[1].node); // Resolving for "child1" should not descend into the referenced nodes res = - root->resolve(RttiTypes::TestNode, std::vector<std::string>{"child1"}); + root->resolve(&RttiTypes::TestNode, std::vector<std::string>{"child1"}); ASSERT_EQ(1U, res.size()); ASSERT_TRUE(child13 == res[0].node); } diff --git a/test/core/model/TestAdvanced.hpp b/test/core/model/TestAdvanced.hpp index 5c709f0..915d973 100644 --- a/test/core/model/TestAdvanced.hpp +++ b/test/core/model/TestAdvanced.hpp @@ -32,7 +32,7 @@ static Rooted<StructuredClass> resolveDescriptor(Handle<Domain> domain, { // use the actual resolve method. std::vector<ResolutionResult> resolved = - domain->resolve(RttiTypes::StructuredClass, className); + domain->resolve(&RttiTypes::StructuredClass, className); // take the first valid result. for (auto &r : resolved) { return r.node.cast<StructuredClass>(); diff --git a/test/core/model/TestDocumentBuilder.hpp b/test/core/model/TestDocumentBuilder.hpp index 3d24839..fc76b07 100644 --- a/test/core/model/TestDocumentBuilder.hpp +++ b/test/core/model/TestDocumentBuilder.hpp @@ -45,7 +45,7 @@ static std::string getPathString(const Path &path) static Rooted<Descriptor> resolveDescriptor(Handle<Document> doc, Logger &logger, const Path &path, - const Rtti &type) + const Rtti *type) { // use the actual resolve method. std::vector<ResolutionResult> resolved = doc->resolve(type, path); @@ -96,7 +96,7 @@ Rooted<StructuredEntity> buildRootStructuredEntity( // If we can not find the correct descriptor, we can not build the entity // either. Rooted<Descriptor> descriptor = - resolveDescriptor(document, logger, path, RttiTypes::StructuredClass); + resolveDescriptor(document, logger, path, &RttiTypes::StructuredClass); if (descriptor == nullptr) { return {nullptr}; } @@ -146,11 +146,11 @@ Rooted<StructuredEntity> buildStructuredEntity( // If we can not find the correct descriptor, we can not build the entity // either. Rooted<Descriptor> descriptor = - resolveDescriptor(document, logger, path, RttiTypes::StructuredClass); + resolveDescriptor(document, logger, path, &RttiTypes::StructuredClass); if (descriptor == nullptr) { return {nullptr}; } - if (!descriptor->isa(RttiTypes::StructuredClass)) { + if (!descriptor->isa(&RttiTypes::StructuredClass)) { return {nullptr}; logger.error("The descriptor was not an AnnotationClass!"); } @@ -195,11 +195,11 @@ Rooted<AnnotationEntity> buildAnnotationEntity( // If we can not find the correct descriptor, we can not build the // entity either. Rooted<Descriptor> descriptor = - resolveDescriptor(document, logger, path, RttiTypes::AnnotationClass); + resolveDescriptor(document, logger, path, &RttiTypes::AnnotationClass); if (descriptor == nullptr) { return {nullptr}; } - if (!descriptor->isa(RttiTypes::AnnotationClass)) { + if (!descriptor->isa(&RttiTypes::AnnotationClass)) { return {nullptr}; logger.error("The descriptor was not an AnnotationClass!"); } diff --git a/test/core/model/TypesystemTest.cpp b/test/core/model/TypesystemTest.cpp index bf40356..9b5872c 100644 --- a/test/core/model/TypesystemTest.cpp +++ b/test/core/model/TypesystemTest.cpp @@ -37,20 +37,20 @@ TEST(StringType, rtti) Rooted<StringType> strType{new StringType(mgr, nullptr)}; ASSERT_TRUE(strType->isa(typeOf<Type>())); ASSERT_TRUE(strType->isa(typeOf<Node>())); - ASSERT_TRUE(strType->isa(RttiTypes::StringType)); - ASSERT_FALSE(strType->composedOf(RttiTypes::Type)); - ASSERT_FALSE(strType->composedOf(RttiTypes::StringType)); - ASSERT_FALSE(strType->composedOf(RttiTypes::IntType)); - ASSERT_FALSE(strType->composedOf(RttiTypes::DoubleType)); - ASSERT_FALSE(strType->composedOf(RttiTypes::BoolType)); - ASSERT_FALSE(strType->composedOf(RttiTypes::EnumType)); - ASSERT_FALSE(strType->composedOf(RttiTypes::StructType)); - ASSERT_FALSE(strType->composedOf(RttiTypes::ArrayType)); - ASSERT_FALSE(strType->composedOf(RttiTypes::UnknownType)); - ASSERT_FALSE(strType->composedOf(RttiTypes::Constant)); - ASSERT_FALSE(strType->composedOf(RttiTypes::Attribute)); - ASSERT_FALSE(strType->composedOf(RttiTypes::Typesystem)); - ASSERT_FALSE(strType->composedOf(RttiTypes::SystemTypesystem)); + ASSERT_TRUE(strType->isa(&RttiTypes::StringType)); + ASSERT_FALSE(strType->composedOf(&RttiTypes::Type)); + ASSERT_FALSE(strType->composedOf(&RttiTypes::StringType)); + ASSERT_FALSE(strType->composedOf(&RttiTypes::IntType)); + ASSERT_FALSE(strType->composedOf(&RttiTypes::DoubleType)); + ASSERT_FALSE(strType->composedOf(&RttiTypes::BoolType)); + ASSERT_FALSE(strType->composedOf(&RttiTypes::EnumType)); + ASSERT_FALSE(strType->composedOf(&RttiTypes::StructType)); + ASSERT_FALSE(strType->composedOf(&RttiTypes::ArrayType)); + ASSERT_FALSE(strType->composedOf(&RttiTypes::UnknownType)); + ASSERT_FALSE(strType->composedOf(&RttiTypes::Constant)); + ASSERT_FALSE(strType->composedOf(&RttiTypes::Attribute)); + ASSERT_FALSE(strType->composedOf(&RttiTypes::Typesystem)); + ASSERT_FALSE(strType->composedOf(&RttiTypes::SystemTypesystem)); } TEST(StringType, creation) @@ -124,22 +124,22 @@ TEST(IntType, rtti) { Manager mgr; Rooted<IntType> intType{new IntType(mgr, nullptr)}; - ASSERT_TRUE(intType->isa(RttiTypes::IntType)); + ASSERT_TRUE(intType->isa(&RttiTypes::IntType)); ASSERT_TRUE(intType->isa(typeOf<Type>())); ASSERT_TRUE(intType->isa(typeOf<Node>())); - ASSERT_FALSE(intType->composedOf(RttiTypes::Type)); - ASSERT_FALSE(intType->composedOf(RttiTypes::StringType)); - ASSERT_FALSE(intType->composedOf(RttiTypes::IntType)); - ASSERT_FALSE(intType->composedOf(RttiTypes::DoubleType)); - ASSERT_FALSE(intType->composedOf(RttiTypes::BoolType)); - ASSERT_FALSE(intType->composedOf(RttiTypes::EnumType)); - ASSERT_FALSE(intType->composedOf(RttiTypes::StructType)); - ASSERT_FALSE(intType->composedOf(RttiTypes::ArrayType)); - ASSERT_FALSE(intType->composedOf(RttiTypes::UnknownType)); - ASSERT_FALSE(intType->composedOf(RttiTypes::Constant)); - ASSERT_FALSE(intType->composedOf(RttiTypes::Attribute)); - ASSERT_FALSE(intType->composedOf(RttiTypes::Typesystem)); - ASSERT_FALSE(intType->composedOf(RttiTypes::SystemTypesystem)); + ASSERT_FALSE(intType->composedOf(&RttiTypes::Type)); + ASSERT_FALSE(intType->composedOf(&RttiTypes::StringType)); + ASSERT_FALSE(intType->composedOf(&RttiTypes::IntType)); + ASSERT_FALSE(intType->composedOf(&RttiTypes::DoubleType)); + ASSERT_FALSE(intType->composedOf(&RttiTypes::BoolType)); + ASSERT_FALSE(intType->composedOf(&RttiTypes::EnumType)); + ASSERT_FALSE(intType->composedOf(&RttiTypes::StructType)); + ASSERT_FALSE(intType->composedOf(&RttiTypes::ArrayType)); + ASSERT_FALSE(intType->composedOf(&RttiTypes::UnknownType)); + ASSERT_FALSE(intType->composedOf(&RttiTypes::Constant)); + ASSERT_FALSE(intType->composedOf(&RttiTypes::Attribute)); + ASSERT_FALSE(intType->composedOf(&RttiTypes::Typesystem)); + ASSERT_FALSE(intType->composedOf(&RttiTypes::SystemTypesystem)); } TEST(IntType, creation) @@ -177,22 +177,22 @@ TEST(DoubleType, rtti) { Manager mgr; Rooted<DoubleType> doubleType{new DoubleType(mgr, nullptr)}; - ASSERT_TRUE(doubleType->isa(RttiTypes::DoubleType)); + ASSERT_TRUE(doubleType->isa(&RttiTypes::DoubleType)); ASSERT_TRUE(doubleType->isa(typeOf<Type>())); ASSERT_TRUE(doubleType->isa(typeOf<Node>())); - ASSERT_FALSE(doubleType->composedOf(RttiTypes::Type)); - ASSERT_FALSE(doubleType->composedOf(RttiTypes::StringType)); - ASSERT_FALSE(doubleType->composedOf(RttiTypes::IntType)); - ASSERT_FALSE(doubleType->composedOf(RttiTypes::DoubleType)); - ASSERT_FALSE(doubleType->composedOf(RttiTypes::BoolType)); - ASSERT_FALSE(doubleType->composedOf(RttiTypes::EnumType)); - ASSERT_FALSE(doubleType->composedOf(RttiTypes::StructType)); - ASSERT_FALSE(doubleType->composedOf(RttiTypes::ArrayType)); - ASSERT_FALSE(doubleType->composedOf(RttiTypes::UnknownType)); - ASSERT_FALSE(doubleType->composedOf(RttiTypes::Constant)); - ASSERT_FALSE(doubleType->composedOf(RttiTypes::Attribute)); - ASSERT_FALSE(doubleType->composedOf(RttiTypes::Typesystem)); - ASSERT_FALSE(doubleType->composedOf(RttiTypes::SystemTypesystem)); + ASSERT_FALSE(doubleType->composedOf(&RttiTypes::Type)); + ASSERT_FALSE(doubleType->composedOf(&RttiTypes::StringType)); + ASSERT_FALSE(doubleType->composedOf(&RttiTypes::IntType)); + ASSERT_FALSE(doubleType->composedOf(&RttiTypes::DoubleType)); + ASSERT_FALSE(doubleType->composedOf(&RttiTypes::BoolType)); + ASSERT_FALSE(doubleType->composedOf(&RttiTypes::EnumType)); + ASSERT_FALSE(doubleType->composedOf(&RttiTypes::StructType)); + ASSERT_FALSE(doubleType->composedOf(&RttiTypes::ArrayType)); + ASSERT_FALSE(doubleType->composedOf(&RttiTypes::UnknownType)); + ASSERT_FALSE(doubleType->composedOf(&RttiTypes::Constant)); + ASSERT_FALSE(doubleType->composedOf(&RttiTypes::Attribute)); + ASSERT_FALSE(doubleType->composedOf(&RttiTypes::Typesystem)); + ASSERT_FALSE(doubleType->composedOf(&RttiTypes::SystemTypesystem)); } TEST(DoubleType, creation) @@ -237,22 +237,22 @@ TEST(BoolType, rtti) { Manager mgr; Rooted<BoolType> boolType{new BoolType(mgr, nullptr)}; - ASSERT_TRUE(boolType->isa(RttiTypes::BoolType)); + ASSERT_TRUE(boolType->isa(&RttiTypes::BoolType)); ASSERT_TRUE(boolType->isa(typeOf<Type>())); ASSERT_TRUE(boolType->isa(typeOf<Node>())); - ASSERT_FALSE(boolType->composedOf(RttiTypes::Type)); - ASSERT_FALSE(boolType->composedOf(RttiTypes::StringType)); - ASSERT_FALSE(boolType->composedOf(RttiTypes::IntType)); - ASSERT_FALSE(boolType->composedOf(RttiTypes::DoubleType)); - ASSERT_FALSE(boolType->composedOf(RttiTypes::BoolType)); - ASSERT_FALSE(boolType->composedOf(RttiTypes::EnumType)); - ASSERT_FALSE(boolType->composedOf(RttiTypes::StructType)); - ASSERT_FALSE(boolType->composedOf(RttiTypes::ArrayType)); - ASSERT_FALSE(boolType->composedOf(RttiTypes::UnknownType)); - ASSERT_FALSE(boolType->composedOf(RttiTypes::Constant)); - ASSERT_FALSE(boolType->composedOf(RttiTypes::Attribute)); - ASSERT_FALSE(boolType->composedOf(RttiTypes::Typesystem)); - ASSERT_FALSE(boolType->composedOf(RttiTypes::SystemTypesystem)); + ASSERT_FALSE(boolType->composedOf(&RttiTypes::Type)); + ASSERT_FALSE(boolType->composedOf(&RttiTypes::StringType)); + ASSERT_FALSE(boolType->composedOf(&RttiTypes::IntType)); + ASSERT_FALSE(boolType->composedOf(&RttiTypes::DoubleType)); + ASSERT_FALSE(boolType->composedOf(&RttiTypes::BoolType)); + ASSERT_FALSE(boolType->composedOf(&RttiTypes::EnumType)); + ASSERT_FALSE(boolType->composedOf(&RttiTypes::StructType)); + ASSERT_FALSE(boolType->composedOf(&RttiTypes::ArrayType)); + ASSERT_FALSE(boolType->composedOf(&RttiTypes::UnknownType)); + ASSERT_FALSE(boolType->composedOf(&RttiTypes::Constant)); + ASSERT_FALSE(boolType->composedOf(&RttiTypes::Attribute)); + ASSERT_FALSE(boolType->composedOf(&RttiTypes::Typesystem)); + ASSERT_FALSE(boolType->composedOf(&RttiTypes::SystemTypesystem)); } TEST(BoolType, creation) @@ -298,22 +298,22 @@ TEST(EnumType, rtti) Manager mgr; Rooted<EnumType> enumType{EnumType::createValidated( mgr, "enum", nullptr, {"a", "b", "c"}, logger)}; - ASSERT_TRUE(enumType->isa(RttiTypes::EnumType)); + ASSERT_TRUE(enumType->isa(&RttiTypes::EnumType)); ASSERT_TRUE(enumType->isa(typeOf<Type>())); ASSERT_TRUE(enumType->isa(typeOf<Node>())); - ASSERT_FALSE(enumType->composedOf(RttiTypes::Type)); - ASSERT_FALSE(enumType->composedOf(RttiTypes::StringType)); - ASSERT_FALSE(enumType->composedOf(RttiTypes::IntType)); - ASSERT_FALSE(enumType->composedOf(RttiTypes::DoubleType)); - ASSERT_FALSE(enumType->composedOf(RttiTypes::BoolType)); - ASSERT_FALSE(enumType->composedOf(RttiTypes::EnumType)); - ASSERT_FALSE(enumType->composedOf(RttiTypes::StructType)); - ASSERT_FALSE(enumType->composedOf(RttiTypes::ArrayType)); - ASSERT_FALSE(enumType->composedOf(RttiTypes::UnknownType)); - ASSERT_FALSE(enumType->composedOf(RttiTypes::Constant)); - ASSERT_FALSE(enumType->composedOf(RttiTypes::Attribute)); - ASSERT_FALSE(enumType->composedOf(RttiTypes::Typesystem)); - ASSERT_FALSE(enumType->composedOf(RttiTypes::SystemTypesystem)); + ASSERT_FALSE(enumType->composedOf(&RttiTypes::Type)); + ASSERT_FALSE(enumType->composedOf(&RttiTypes::StringType)); + ASSERT_FALSE(enumType->composedOf(&RttiTypes::IntType)); + ASSERT_FALSE(enumType->composedOf(&RttiTypes::DoubleType)); + ASSERT_FALSE(enumType->composedOf(&RttiTypes::BoolType)); + ASSERT_FALSE(enumType->composedOf(&RttiTypes::EnumType)); + ASSERT_FALSE(enumType->composedOf(&RttiTypes::StructType)); + ASSERT_FALSE(enumType->composedOf(&RttiTypes::ArrayType)); + ASSERT_FALSE(enumType->composedOf(&RttiTypes::UnknownType)); + ASSERT_FALSE(enumType->composedOf(&RttiTypes::Constant)); + ASSERT_FALSE(enumType->composedOf(&RttiTypes::Attribute)); + ASSERT_FALSE(enumType->composedOf(&RttiTypes::Typesystem)); + ASSERT_FALSE(enumType->composedOf(&RttiTypes::SystemTypesystem)); } TEST(EnumType, creation) @@ -476,22 +476,22 @@ TEST(StructType, rtti) { Manager mgr; Rooted<StructType> structType = createStructType(mgr, logger); - ASSERT_TRUE(structType->isa(RttiTypes::StructType)); + ASSERT_TRUE(structType->isa(&RttiTypes::StructType)); ASSERT_TRUE(structType->isa(typeOf<Type>())); ASSERT_TRUE(structType->isa(typeOf<Node>())); - ASSERT_FALSE(structType->composedOf(RttiTypes::Type)); - ASSERT_FALSE(structType->composedOf(RttiTypes::StringType)); - ASSERT_FALSE(structType->composedOf(RttiTypes::IntType)); - ASSERT_FALSE(structType->composedOf(RttiTypes::DoubleType)); - ASSERT_FALSE(structType->composedOf(RttiTypes::BoolType)); - ASSERT_FALSE(structType->composedOf(RttiTypes::EnumType)); - ASSERT_FALSE(structType->composedOf(RttiTypes::StructType)); - ASSERT_FALSE(structType->composedOf(RttiTypes::ArrayType)); - ASSERT_FALSE(structType->composedOf(RttiTypes::UnknownType)); - ASSERT_FALSE(structType->composedOf(RttiTypes::Constant)); - ASSERT_TRUE(structType->composedOf(RttiTypes::Attribute)); - ASSERT_FALSE(structType->composedOf(RttiTypes::Typesystem)); - ASSERT_FALSE(structType->composedOf(RttiTypes::SystemTypesystem)); + ASSERT_FALSE(structType->composedOf(&RttiTypes::Type)); + ASSERT_FALSE(structType->composedOf(&RttiTypes::StringType)); + ASSERT_FALSE(structType->composedOf(&RttiTypes::IntType)); + ASSERT_FALSE(structType->composedOf(&RttiTypes::DoubleType)); + ASSERT_FALSE(structType->composedOf(&RttiTypes::BoolType)); + ASSERT_FALSE(structType->composedOf(&RttiTypes::EnumType)); + ASSERT_FALSE(structType->composedOf(&RttiTypes::StructType)); + ASSERT_FALSE(structType->composedOf(&RttiTypes::ArrayType)); + ASSERT_FALSE(structType->composedOf(&RttiTypes::UnknownType)); + ASSERT_FALSE(structType->composedOf(&RttiTypes::Constant)); + ASSERT_TRUE(structType->composedOf(&RttiTypes::Attribute)); + ASSERT_FALSE(structType->composedOf(&RttiTypes::Typesystem)); + ASSERT_FALSE(structType->composedOf(&RttiTypes::SystemTypesystem)); } TEST(StructType, creation) @@ -789,22 +789,22 @@ TEST(ArrayType, rtti) Manager mgr; Rooted<StringType> stringType{new StringType(mgr, nullptr)}; Rooted<ArrayType> arrayType{new ArrayType(stringType)}; - ASSERT_TRUE(arrayType->isa(RttiTypes::ArrayType)); + ASSERT_TRUE(arrayType->isa(&RttiTypes::ArrayType)); ASSERT_TRUE(arrayType->isa(typeOf<Type>())); ASSERT_TRUE(arrayType->isa(typeOf<Node>())); - ASSERT_FALSE(arrayType->composedOf(RttiTypes::Type)); - ASSERT_FALSE(arrayType->composedOf(RttiTypes::StringType)); - ASSERT_FALSE(arrayType->composedOf(RttiTypes::IntType)); - ASSERT_FALSE(arrayType->composedOf(RttiTypes::DoubleType)); - ASSERT_FALSE(arrayType->composedOf(RttiTypes::BoolType)); - ASSERT_FALSE(arrayType->composedOf(RttiTypes::EnumType)); - ASSERT_FALSE(arrayType->composedOf(RttiTypes::StructType)); - ASSERT_FALSE(arrayType->composedOf(RttiTypes::ArrayType)); - ASSERT_FALSE(arrayType->composedOf(RttiTypes::UnknownType)); - ASSERT_FALSE(arrayType->composedOf(RttiTypes::Constant)); - ASSERT_FALSE(arrayType->composedOf(RttiTypes::Attribute)); - ASSERT_FALSE(arrayType->composedOf(RttiTypes::Typesystem)); - ASSERT_FALSE(arrayType->composedOf(RttiTypes::SystemTypesystem)); + ASSERT_FALSE(arrayType->composedOf(&RttiTypes::Type)); + ASSERT_FALSE(arrayType->composedOf(&RttiTypes::StringType)); + ASSERT_FALSE(arrayType->composedOf(&RttiTypes::IntType)); + ASSERT_FALSE(arrayType->composedOf(&RttiTypes::DoubleType)); + ASSERT_FALSE(arrayType->composedOf(&RttiTypes::BoolType)); + ASSERT_FALSE(arrayType->composedOf(&RttiTypes::EnumType)); + ASSERT_FALSE(arrayType->composedOf(&RttiTypes::StructType)); + ASSERT_FALSE(arrayType->composedOf(&RttiTypes::ArrayType)); + ASSERT_FALSE(arrayType->composedOf(&RttiTypes::UnknownType)); + ASSERT_FALSE(arrayType->composedOf(&RttiTypes::Constant)); + ASSERT_FALSE(arrayType->composedOf(&RttiTypes::Attribute)); + ASSERT_FALSE(arrayType->composedOf(&RttiTypes::Typesystem)); + ASSERT_FALSE(arrayType->composedOf(&RttiTypes::SystemTypesystem)); } TEST(ArrayType, creation) @@ -910,22 +910,22 @@ TEST(UnknownType, rtti) { Manager mgr; Rooted<UnknownType> unknownType{new UnknownType(mgr)}; - ASSERT_TRUE(unknownType->isa(RttiTypes::UnknownType)); + ASSERT_TRUE(unknownType->isa(&RttiTypes::UnknownType)); ASSERT_TRUE(unknownType->isa(typeOf<Type>())); ASSERT_TRUE(unknownType->isa(typeOf<Node>())); - ASSERT_FALSE(unknownType->composedOf(RttiTypes::Type)); - ASSERT_FALSE(unknownType->composedOf(RttiTypes::StringType)); - ASSERT_FALSE(unknownType->composedOf(RttiTypes::IntType)); - ASSERT_FALSE(unknownType->composedOf(RttiTypes::DoubleType)); - ASSERT_FALSE(unknownType->composedOf(RttiTypes::BoolType)); - ASSERT_FALSE(unknownType->composedOf(RttiTypes::EnumType)); - ASSERT_FALSE(unknownType->composedOf(RttiTypes::StructType)); - ASSERT_FALSE(unknownType->composedOf(RttiTypes::ArrayType)); - ASSERT_FALSE(unknownType->composedOf(RttiTypes::UnknownType)); - ASSERT_FALSE(unknownType->composedOf(RttiTypes::Constant)); - ASSERT_FALSE(unknownType->composedOf(RttiTypes::Attribute)); - ASSERT_FALSE(unknownType->composedOf(RttiTypes::Typesystem)); - ASSERT_FALSE(unknownType->composedOf(RttiTypes::SystemTypesystem)); + ASSERT_FALSE(unknownType->composedOf(&RttiTypes::Type)); + ASSERT_FALSE(unknownType->composedOf(&RttiTypes::StringType)); + ASSERT_FALSE(unknownType->composedOf(&RttiTypes::IntType)); + ASSERT_FALSE(unknownType->composedOf(&RttiTypes::DoubleType)); + ASSERT_FALSE(unknownType->composedOf(&RttiTypes::BoolType)); + ASSERT_FALSE(unknownType->composedOf(&RttiTypes::EnumType)); + ASSERT_FALSE(unknownType->composedOf(&RttiTypes::StructType)); + ASSERT_FALSE(unknownType->composedOf(&RttiTypes::ArrayType)); + ASSERT_FALSE(unknownType->composedOf(&RttiTypes::UnknownType)); + ASSERT_FALSE(unknownType->composedOf(&RttiTypes::Constant)); + ASSERT_FALSE(unknownType->composedOf(&RttiTypes::Attribute)); + ASSERT_FALSE(unknownType->composedOf(&RttiTypes::Typesystem)); + ASSERT_FALSE(unknownType->composedOf(&RttiTypes::SystemTypesystem)); } TEST(UnknownType, creation) @@ -956,19 +956,19 @@ TEST(Typesystem, rtti) { Manager mgr{1}; Rooted<Typesystem> typesystem{new Typesystem{mgr, "typesystem"}}; - ASSERT_TRUE(typesystem->composedOf(RttiTypes::Type)); - ASSERT_TRUE(typesystem->composedOf(RttiTypes::StringType)); - ASSERT_TRUE(typesystem->composedOf(RttiTypes::IntType)); - ASSERT_TRUE(typesystem->composedOf(RttiTypes::DoubleType)); - ASSERT_TRUE(typesystem->composedOf(RttiTypes::BoolType)); - ASSERT_TRUE(typesystem->composedOf(RttiTypes::EnumType)); - ASSERT_TRUE(typesystem->composedOf(RttiTypes::StructType)); - ASSERT_FALSE(typesystem->composedOf(RttiTypes::ArrayType)); - ASSERT_FALSE(typesystem->composedOf(RttiTypes::UnknownType)); - ASSERT_TRUE(typesystem->composedOf(RttiTypes::Constant)); - ASSERT_TRUE(typesystem->composedOf(RttiTypes::Attribute)); - ASSERT_FALSE(typesystem->composedOf(RttiTypes::Typesystem)); - ASSERT_FALSE(typesystem->composedOf(RttiTypes::SystemTypesystem)); + ASSERT_TRUE(typesystem->composedOf(&RttiTypes::Type)); + ASSERT_TRUE(typesystem->composedOf(&RttiTypes::StringType)); + ASSERT_TRUE(typesystem->composedOf(&RttiTypes::IntType)); + ASSERT_TRUE(typesystem->composedOf(&RttiTypes::DoubleType)); + ASSERT_TRUE(typesystem->composedOf(&RttiTypes::BoolType)); + ASSERT_TRUE(typesystem->composedOf(&RttiTypes::EnumType)); + ASSERT_TRUE(typesystem->composedOf(&RttiTypes::StructType)); + ASSERT_FALSE(typesystem->composedOf(&RttiTypes::ArrayType)); + ASSERT_FALSE(typesystem->composedOf(&RttiTypes::UnknownType)); + ASSERT_TRUE(typesystem->composedOf(&RttiTypes::Constant)); + ASSERT_TRUE(typesystem->composedOf(&RttiTypes::Attribute)); + ASSERT_FALSE(typesystem->composedOf(&RttiTypes::Typesystem)); + ASSERT_FALSE(typesystem->composedOf(&RttiTypes::SystemTypesystem)); } /* Class SystemTypesystem */ @@ -977,18 +977,18 @@ TEST(SystemTypesystem, rtti) { Manager mgr{1}; Rooted<SystemTypesystem> typesystem{new SystemTypesystem{mgr}}; - ASSERT_TRUE(typesystem->composedOf(RttiTypes::Type)); - ASSERT_TRUE(typesystem->composedOf(RttiTypes::StringType)); - ASSERT_TRUE(typesystem->composedOf(RttiTypes::IntType)); - ASSERT_TRUE(typesystem->composedOf(RttiTypes::DoubleType)); - ASSERT_TRUE(typesystem->composedOf(RttiTypes::BoolType)); - ASSERT_TRUE(typesystem->composedOf(RttiTypes::EnumType)); - ASSERT_TRUE(typesystem->composedOf(RttiTypes::StructType)); - ASSERT_FALSE(typesystem->composedOf(RttiTypes::ArrayType)); - ASSERT_FALSE(typesystem->composedOf(RttiTypes::UnknownType)); - ASSERT_TRUE(typesystem->composedOf(RttiTypes::Constant)); - ASSERT_TRUE(typesystem->composedOf(RttiTypes::Attribute)); - ASSERT_FALSE(typesystem->composedOf(RttiTypes::Typesystem)); - ASSERT_FALSE(typesystem->composedOf(RttiTypes::SystemTypesystem)); + ASSERT_TRUE(typesystem->composedOf(&RttiTypes::Type)); + ASSERT_TRUE(typesystem->composedOf(&RttiTypes::StringType)); + ASSERT_TRUE(typesystem->composedOf(&RttiTypes::IntType)); + ASSERT_TRUE(typesystem->composedOf(&RttiTypes::DoubleType)); + ASSERT_TRUE(typesystem->composedOf(&RttiTypes::BoolType)); + ASSERT_TRUE(typesystem->composedOf(&RttiTypes::EnumType)); + ASSERT_TRUE(typesystem->composedOf(&RttiTypes::StructType)); + ASSERT_FALSE(typesystem->composedOf(&RttiTypes::ArrayType)); + ASSERT_FALSE(typesystem->composedOf(&RttiTypes::UnknownType)); + ASSERT_TRUE(typesystem->composedOf(&RttiTypes::Constant)); + ASSERT_TRUE(typesystem->composedOf(&RttiTypes::Attribute)); + ASSERT_FALSE(typesystem->composedOf(&RttiTypes::Typesystem)); + ASSERT_FALSE(typesystem->composedOf(&RttiTypes::SystemTypesystem)); } } |