summaryrefslogtreecommitdiff
path: root/test/core
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2014-12-20 15:51:07 +0100
committerAndreas Stöckel <andreas@somweyr.de>2014-12-20 15:51:07 +0100
commit4294735304bb89fe603a9d5f73717a09959d3c8b (patch)
treeb96f62f3e579b799cdfc0e76c755fc2a306590b3 /test/core
parenta7567d08e4d5869833069ec7211785af350aea88 (diff)
parentf77ec7ae614810bc317c23138279e115f930aa06 (diff)
Merge branch 'master' of somweyr.de:ousia
Diffstat (limited to 'test/core')
-rw-r--r--test/core/model/DomainTest.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/test/core/model/DomainTest.cpp b/test/core/model/DomainTest.cpp
index f6dff3c..204a862 100644
--- a/test/core/model/DomainTest.cpp
+++ b/test/core/model/DomainTest.cpp
@@ -28,23 +28,21 @@ namespace ousia {
namespace model {
void assert_path(std::vector<Rooted<Managed>> &result, size_t idx,
- const std::type_info &expected_type,
+ const ManagedType &expected_type,
std::vector<std::string> expected_path)
{
ASSERT_TRUE(result.size() > idx);
// check class/type
- ASSERT_EQ(expected_type, typeid(*result[idx]));
- // transform to node
- Managed *m = &(*result[idx]);
- Node *n = dynamic_cast<Node *>(m);
- ASSERT_TRUE(n);
+ ASSERT_TRUE(result[idx]->isa(expected_type));
+ // cast to node
+ Rooted<Node> n = result[idx].cast<Node>();
// extract actual path
std::vector<std::string> actual_path = n->path();
// check path
ASSERT_EQ(expected_path, actual_path);
}
-TEST(Document, testDomainResolving)
+TEST(Domain, testDomainResolving)
{
// Construct Manager
Manager mgr{1};
@@ -59,9 +57,9 @@ TEST(Document, testDomainResolving)
std::vector<Rooted<Managed>> res =
domain->resolve(std::vector<std::string>{"book"});
// First we expect the book domain.
- assert_path(res, 0, typeid(Domain), {"book"});
+ assert_path(res, 0, DomainType, {"book"});
// Then the book structure.
- assert_path(res, 1, typeid(StructuredClass), {"book", "book"});
+ assert_path(res, 1, StructuredClassType, {"book", "book"});
ASSERT_EQ(2, res.size());
/*
@@ -69,7 +67,7 @@ TEST(Document, testDomainResolving)
* StructuredClass should be returned.
*/
res = domain->resolve(std::vector<std::string>{"book", "book"});
- assert_path(res, 0, typeid(StructuredClass), {"book", "book"});
+ assert_path(res, 0, StructuredClassType, {"book", "book"});
ASSERT_EQ(1, res.size());
/*
@@ -77,7 +75,7 @@ TEST(Document, testDomainResolving)
*/
res = domain->resolve(std::vector<std::string>{"section"});
// TODO: Is that the path result we want?
- assert_path(res, 0, typeid(StructuredClass), {"book", "section"});
+ assert_path(res, 0, StructuredClassType, {"book", "section"});
ASSERT_EQ(1, res.size());
/*
@@ -85,7 +83,7 @@ TEST(Document, testDomainResolving)
* FieldDescriptor of the StructuredClass "book".
*/
res = domain->resolve(std::vector<std::string>{"book", "book", ""});
- assert_path(res, 0, typeid(FieldDescriptor), {"book", "book", ""});
+ assert_path(res, 0, FieldDescriptorType, {"book", "book", ""});
ASSERT_EQ(1, res.size());
/*
@@ -93,7 +91,7 @@ TEST(Document, testDomainResolving)
* but should be returned only once.
*/
res = domain->resolve("paragraph");
- assert_path(res, 0, typeid(StructuredClass), {"book", "paragraph"});
+ assert_path(res, 0, StructuredClassType, {"book", "paragraph"});
ASSERT_EQ(1, res.size());
}
}