Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
bcac9ef1
Commit
bcac9ef1
authored
Feb 02, 2011
by
JINMEI Tatuya
Browse files
[trac507] added some more tests for the 'last comparison'
parent
56baabf6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/datasrc/tests/rbtree_unittest.cc
View file @
bcac9ef1
...
...
@@ -323,6 +323,29 @@ TEST_F(RBTreeTest, getLastComparedNode) {
comparisonChecks
(
chain
,
1
,
1
,
NameComparisonResult
::
COMMONANCESTOR
);
chain
.
clear
();
// Partial match, search stopped at a node for a super domain of the
// search name in the subtree below the matching node.
EXPECT_EQ
(
RBTree
<
int
>::
EXACTMATCH
,
tree
.
find
(
Name
(
"w.y.d.e.f"
),
&
expected_node
));
EXPECT_EQ
(
RBTree
<
int
>::
PARTIALMATCH
,
tree
.
find
<
void
*>
(
Name
(
"y.d.e.f"
),
&
crbtnode
,
chain
,
NULL
,
NULL
));
EXPECT_EQ
(
expected_node
,
chain
.
getLastComparedNode
());
// y < w.y, 2 = # labels of "y."
comparisonChecks
(
chain
,
-
1
,
2
,
NameComparisonResult
::
SUPERDOMAIN
);
chain
.
clear
();
// Partial match, search stopped at a node that share a common ancestor
// with the search name in the subtree below the matching node.
// (the expected node is the same as the previous case)
EXPECT_EQ
(
RBTree
<
int
>::
PARTIALMATCH
,
tree
.
find
<
void
*>
(
Name
(
"z.y.d.e.f"
),
&
crbtnode
,
chain
,
NULL
,
NULL
));
EXPECT_EQ
(
expected_node
,
chain
.
getLastComparedNode
());
// z.y > w.y, 2 = # labels of "y."
comparisonChecks
(
chain
,
1
,
2
,
NameComparisonResult
::
COMMONANCESTOR
);
chain
.
clear
();
// Search stops in the highest level after following a left branch.
EXPECT_EQ
(
RBTree
<
int
>::
EXACTMATCH
,
tree
.
find
(
Name
(
"c"
),
&
expected_node
));
EXPECT_EQ
(
RBTree
<
int
>::
NOTFOUND
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment