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
6e2de8ba
Commit
6e2de8ba
authored
Aug 27, 2012
by
JINMEI Tatuya
Browse files
[2107] clearly separated mutable and immutable versions of getNext().
and tested for both versions.
parent
56de9af8
Changes
2
Show whitespace changes
Inline
Side-by-side
src/lib/datasrc/memory/rdataset.h
View file @
6e2de8ba
...
@@ -237,7 +237,11 @@ public:
...
@@ -237,7 +237,11 @@ public:
/// get the same result by directly calling get() on \c next, it would
/// get the same result by directly calling get() on \c next, it would
/// help encourage the use of more efficient usage if we provide an
/// help encourage the use of more efficient usage if we provide an
/// explicit accessor.
/// explicit accessor.
RdataSet
*
getNext
()
const
{
return
(
next
.
get
());
}
//const RdataSet* getNext() const { return (next.get()); }
const
RdataSet
*
getNext
()
const
{
return
(
next
.
get
());
}
/// \brief Return the bare pointer to the next node, mutable version.
RdataSet
*
getNext
()
{
return
(
next
.
get
());
}
/// \brief Return the number of RDATAs stored in the \c RdataSet.
/// \brief Return the number of RDATAs stored in the \c RdataSet.
size_t
getRdataCount
()
const
{
return
(
rdata_count_
);
}
size_t
getRdataCount
()
const
{
return
(
rdata_count_
);
}
...
...
src/lib/datasrc/memory/tests/rdataset_unittest.cc
View file @
6e2de8ba
...
@@ -121,13 +121,16 @@ TEST_F(RdataSetTest, getNext) {
...
@@ -121,13 +121,16 @@ TEST_F(RdataSetTest, getNext) {
ConstRRsetPtr
());
ConstRRsetPtr
());
// By default, the next pointer should be NULL (already tested in other
// By default, the next pointer should be NULL (already tested in other
// test cases), which should be the case with getNext()
// test cases), which should be the case with getNext(). We test both
// mutable and immutable versions of getNext().
EXPECT_EQ
(
static_cast
<
RdataSet
*>
(
NULL
),
rdataset
->
getNext
());
EXPECT_EQ
(
static_cast
<
RdataSet
*>
(
NULL
),
rdataset
->
getNext
());
EXPECT_EQ
(
static_cast
<
const
RdataSet
*>
(
NULL
),
static_cast
<
const
RdataSet
*>
(
rdataset
)
->
getNext
());
// making a link (it would form an infinite loop, but it doesn't matter
// making a link (it would form an infinite loop, but it doesn't matter
// in this test), and check the pointer returned by getNext().
// in this test), and check the pointer returned by getNext().
rdataset
->
next
=
rdataset
;
rdataset
->
next
=
rdataset
;
EXPECT_EQ
(
rdataset
,
rdataset
->
getNext
());
EXPECT_EQ
(
rdataset
,
static_cast
<
const
RdataSet
*>
(
rdataset
)
->
getNext
());
RdataSet
::
destroy
(
mem_sgmt_
,
RRClass
::
IN
(),
rdataset
);
RdataSet
::
destroy
(
mem_sgmt_
,
RRClass
::
IN
(),
rdataset
);
}
}
...
...
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