]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2150] Find a relative label sequence that's more than 1 node away from chain.top()
authorMukund Sivaraman <muks@isc.org>
Sun, 16 Sep 2012 19:42:32 +0000 (01:12 +0530)
committerMukund Sivaraman <muks@isc.org>
Sun, 16 Sep 2012 19:42:32 +0000 (01:12 +0530)
src/lib/datasrc/memory/tests/domaintree_unittest.cc

index fa3665e87bdd93f4acc832252dcedb7b7fb02574..58a3f4d4df78dd0f7feeeb11c25097926a56ade5 100644 (file)
@@ -496,6 +496,28 @@ TEST_F(DomainTreeTest, findInSubTree) {
                                           testCallback, &flag);
     EXPECT_EQ(DomainTree<int>::EXACTMATCH, result);
     EXPECT_EQ(n2, chain.getAbsoluteName());
+
+    // Another test. Start with "d.e.f." node.
+    chain.clear();
+    const Name n3("d.e.f");
+    const LabelSequence ls3(n3);
+    result =
+        dtree_expose_empty_node.find(ls3, &cdtnode, chain,
+                                     testCallback, &flag);
+    EXPECT_EQ(DomainTree<int>::EXACTMATCH, result);
+    EXPECT_EQ(n3, chain.getAbsoluteName());
+
+    // Now, find "o.w.y.d.e.f." by right-stripping the "w.y.d.e.f."
+    // suffix to "o.w.y" (non-absolute).
+    const Name n4("o.w.y.d.e.f");
+    LabelSequence ls4(n2);
+    ls4.stripRight(4);
+    EXPECT_EQ("o.w.y", ls4.toText());
+
+    result = dtree_expose_empty_node.find(ls4, &cdtnode, chain,
+                                          testCallback, &flag);
+    EXPECT_EQ(DomainTree<int>::EXACTMATCH, result);
+    EXPECT_EQ(n4, chain.getAbsoluteName());
 }
 
 TEST_F(DomainTreeTest, chainLevel) {