summaryrefslogtreecommitdiff
path: root/test/core/CSSTest.cpp
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2014-12-03 00:57:49 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2014-12-03 00:57:49 +0100
commit314e97ac5307f5053fc0c31ec23c39ba9c9a0aac (patch)
treee8b318459c6dbb3ddac5629dc566e30500027201 /test/core/CSSTest.cpp
parent3e64255773e15d34c204591a06c93c04a384dfe4 (diff)
fixed some subtle design errors in SelectorNodes and implemented SelectorNode::getChildren.
Diffstat (limited to 'test/core/CSSTest.cpp')
-rw-r--r--test/core/CSSTest.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/test/core/CSSTest.cpp b/test/core/CSSTest.cpp
index 19f8587..2c695d9 100644
--- a/test/core/CSSTest.cpp
+++ b/test/core/CSSTest.cpp
@@ -23,13 +23,13 @@
namespace ousia {
TEST(Specificity, testOperators)
{
- Specificity s1{0,0,1};
- Specificity s2{0,1,1};
- Specificity s3{1,1,1};
- Specificity s4{0,0,2};
- Specificity s5{1,0,2};
-
- //This should be s1 < s4 < s2 < s5 < s3
+ Specificity s1{0, 0, 1};
+ Specificity s2{0, 1, 1};
+ Specificity s3{1, 1, 1};
+ Specificity s4{0, 0, 2};
+ Specificity s5{1, 0, 2};
+
+ // This should be s1 < s4 < s2 < s5 < s3
ASSERT_TRUE(s1 == s1);
ASSERT_FALSE(s1 < s1);
@@ -111,4 +111,17 @@ TEST(Specificity, testOperators)
ASSERT_FALSE(s5 < s5);
ASSERT_FALSE(s5 > s5);
}
+
+TEST(SelectorNode, testGetChildren)
+{
+ Manager mgr(1);
+ Rooted<SelectorNode> root{new SelectorNode{mgr, "root", {"true", false}}};
+ Rooted<SelectorNode> child{new SelectorNode{mgr, "A", {"true", false}}};
+ root->getEdges().push_back(
+ new SelectorNode::SelectorEdge{mgr, child, SelectionOperator::DESCENDANT});
+ std::vector<Rooted<SelectorNode>> actual =
+ root->getChildren(SelectionOperator::DESCENDANT, "A", {"true", false});
+ ASSERT_EQ(1,actual.size());
+ ASSERT_EQ(child, actual[0]);
+}
}