diff options
Diffstat (limited to 'test/core/model')
| -rw-r--r-- | test/core/model/DomainTest.cpp | 26 | ||||
| -rw-r--r-- | test/core/model/NodeTest.cpp | 62 | ||||
| -rw-r--r-- | test/core/model/TestAdvanced.hpp | 2 | ||||
| -rw-r--r-- | test/core/model/TestDocumentBuilder.hpp | 2 | ||||
| -rw-r--r-- | test/core/model/TypesystemTest.cpp | 6 | 
5 files changed, 49 insertions, 49 deletions
diff --git a/test/core/model/DomainTest.cpp b/test/core/model/DomainTest.cpp index 8bf1a47..767ac0c 100644 --- a/test/core/model/DomainTest.cpp +++ b/test/core/model/DomainTest.cpp @@ -50,41 +50,41 @@ TEST(Domain, testDomainResolving)  	std::vector<ResolutionResult> res;  	// There is one domain called "book" -	res = domain->resolve("book", typeOf<Domain>()); +	res = domain->resolve(RttiTypes::Domain, "book");  	ASSERT_EQ(1U, res.size()); -	assert_path(res[0], typeOf<Domain>(), {"book"}); +	assert_path(res[0], RttiTypes::Domain, {"book"});  	// There is one domain called "book" -	res = domain->resolve("book", typeOf<StructuredClass>()); +	res = domain->resolve(RttiTypes::StructuredClass, "book");  	ASSERT_EQ(1U, res.size()); -	assert_path(res[0], typeOf<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(std::vector<std::string>{"book", "book"}, -	                      typeOf<Domain>()); +	res = domain->resolve(RttiTypes::Domain, +	                      std::vector<std::string>{"book", "book"});  	ASSERT_EQ(0U, res.size()); -	res = domain->resolve(std::vector<std::string>{"book", "book"}, -	                      typeOf<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("section", typeOf<StructuredClass>()); +	res = domain->resolve(RttiTypes::StructuredClass, "section");  	ASSERT_EQ(1U, res.size()); -	assert_path(res[0], typeOf<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("paragraph", typeOf<StructuredClass>()); +	res = domain->resolve(RttiTypes::StructuredClass, "paragraph");  	ASSERT_EQ(1U, res.size()); -	assert_path(res[0], typeOf<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(name, RttiTypes::StructuredClass); +	    dom->resolve(RttiTypes::StructuredClass, name);  	return res[0].node.cast<StructuredClass>();  } diff --git a/test/core/model/NodeTest.cpp b/test/core/model/NodeTest.cpp index a9a699d..d9ca5bb 100644 --- a/test/core/model/NodeTest.cpp +++ b/test/core/model/NodeTest.cpp @@ -61,8 +61,8 @@ public:  namespace RttiTypes {  const Rtti TestNode = RttiBuilder<ousia::TestNode>("TestNode") -                              .parent(&RttiTypes::Node) -                              .composedOf(&TestNode); +                          .parent(&RttiTypes::Node) +                          .composedOf(&TestNode);  }  TEST(Node, isRoot) @@ -85,18 +85,18 @@ TEST(Node, resolveCompositaSimple)  	    child1->addCompositum(new TestNode(mgr, "child11"));  	std::vector<ResolutionResult> res; -	res = root->resolve(std::vector<std::string>{"root", "child1", "child11"}, -	                    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(std::vector<std::string>{"child1", "child11"}, -	                    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(std::vector<std::string>{"child11"}, RttiTypes::TestNode); +	    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(std::vector<std::string>{"root", "child1", "child11"}, -	                    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(std::vector<std::string>{"child1", "child11"}, -	                    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(std::vector<std::string>{"child11"}, RttiTypes::TestNode); +	    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(std::vector<std::string>{"child1", "child11"}, -	                    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(std::vector<std::string>{"child11"}, RttiTypes::TestNode); +	    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(std::vector<std::string>{"a", "child1", "child11"}, -	                    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(std::vector<std::string>{"b", "child1", "child11"}, -	                    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(std::vector<std::string>{"child1", "child11"}, -	                    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(std::vector<std::string>{"child11"}, RttiTypes::TestNode); +	    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(std::vector<std::string>{"child1"}, RttiTypes::TestNode); +	    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(std::vector<std::string>{"a", "child1", "child11"}, -	                    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(std::vector<std::string>{"b", "child1", "child11"}, -	                    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(std::vector<std::string>{"child1", "child11"}, -	                    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(std::vector<std::string>{"child11"}, RttiTypes::TestNode); +	    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(std::vector<std::string>{"child1"}, RttiTypes::TestNode); +	    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 d90f917..e3744b8 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(className, typeOf<StructuredClass>()); +	    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 149b88e..71b353d 100644 --- a/test/core/model/TestDocumentBuilder.hpp +++ b/test/core/model/TestDocumentBuilder.hpp @@ -48,7 +48,7 @@ static Rooted<Descriptor> resolveDescriptor(Handle<Document> doc,                                              const Rtti &type)  {  	// use the actual resolve method. -	std::vector<ResolutionResult> resolved = doc->resolve(path, type); +	std::vector<ResolutionResult> resolved = doc->resolve(type, path);  	// if we don't find anything, log an error  	if (resolved.size() == 0) {  		logger.error(std::string("Could not resolve ") + getPathString(path)); diff --git a/test/core/model/TypesystemTest.cpp b/test/core/model/TypesystemTest.cpp index 7d05f56..9a40db7 100644 --- a/test/core/model/TypesystemTest.cpp +++ b/test/core/model/TypesystemTest.cpp @@ -774,7 +774,7 @@ TEST(ArrayType, rtti)  {  	Manager mgr;  	Rooted<StringType> stringType{new StringType(mgr, nullptr)}; -	Rooted<ArrayType> arrayType{new ArrayType(mgr, stringType)}; +	Rooted<ArrayType> arrayType{new ArrayType(stringType)};  	ASSERT_TRUE(arrayType->isa(RttiTypes::ArrayType));  	ASSERT_TRUE(arrayType->isa(typeOf<Type>()));  	ASSERT_TRUE(arrayType->isa(typeOf<Node>())); @@ -797,7 +797,7 @@ TEST(ArrayType, creation)  {  	Manager mgr;  	Rooted<StringType> stringType{new StringType(mgr, nullptr)}; -	Rooted<ArrayType> arrayType{new ArrayType(mgr, stringType)}; +	Rooted<ArrayType> arrayType{new ArrayType(stringType)};  	Variant val = arrayType->create();  	ASSERT_TRUE(val.isArray()); @@ -808,7 +808,7 @@ TEST(ArrayType, conversion)  {  	Manager mgr;  	Rooted<StringType> stringType{new StringType(mgr, nullptr)}; -	Rooted<ArrayType> arrayType{new ArrayType(mgr, stringType)}; +	Rooted<ArrayType> arrayType{new ArrayType(stringType)};  	{  		Variant val{{1, "test", false, 42.5}};  | 
