BIND 10 trac1602, updated. cb28f3c4199610fb06c8939f5b5d95b99ae7a071 [1602] rename split methods
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Mar 2 09:32:29 UTC 2012
The branch, trac1602 has been updated
via cb28f3c4199610fb06c8939f5b5d95b99ae7a071 (commit)
from c271fcc053b0ff9b2e7273e992591549258c18b7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit cb28f3c4199610fb06c8939f5b5d95b99ae7a071
Author: Jelte Jansen <jelte at isc.org>
Date: Fri Mar 2 10:31:16 2012 +0100
[1602] rename split methods
leftSplit() -> stripLeft()
rightSplit() -> stripRight()
-----------------------------------------------------------------------
Summary of changes:
src/lib/dns/labelsequence.cc | 8 ++--
src/lib/dns/labelsequence.h | 13 +++--
src/lib/dns/tests/labelsequence_unittest.cc | 72 +++++++++++++-------------
3 files changed, 47 insertions(+), 46 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dns/labelsequence.cc b/src/lib/dns/labelsequence.cc
index 693702d..64cc519 100644
--- a/src/lib/dns/labelsequence.cc
+++ b/src/lib/dns/labelsequence.cc
@@ -51,18 +51,18 @@ LabelSequence::equals(const LabelSequence& other, bool case_sensitive) const {
}
void
-LabelSequence::leftSplit(size_t i) {
+LabelSequence::stripLeft(size_t i) {
if (i >= getLabelCount()) {
- isc_throw(OutOfRange, "Cannot split to zero or less labels; " << i <<
+ isc_throw(OutOfRange, "Cannot strip to zero or less labels; " << i <<
" (labelcount: " << getLabelCount() << ")");
}
first_label_ += i;
}
void
-LabelSequence::rightSplit(size_t i) {
+LabelSequence::stripRight(size_t i) {
if (i >= getLabelCount()) {
- isc_throw(OutOfRange, "Cannot split to zero or less labels; " << i <<
+ isc_throw(OutOfRange, "Cannot strip to zero or less labels; " << i <<
" (labelcount: " << getLabelCount() << ")");
}
last_label_ -= i;
diff --git a/src/lib/dns/labelsequence.h b/src/lib/dns/labelsequence.h
index bae6298..6fb1501 100644
--- a/src/lib/dns/labelsequence.h
+++ b/src/lib/dns/labelsequence.h
@@ -24,16 +24,17 @@ namespace dns {
/// \brief Light-weight Accessor to Name object
///
/// The purpose of this class is to easily match Names and parts of Names,
-/// without needing to copy the underlying data on each split.
+/// without needing to copy the underlying data on each label strip.
///
/// It can only work on existing Name objects, and the Name object MUST
/// remain in scope during the entire lifetime of its associated
/// LabelSequence(s).
///
/// Upon creation of a LabelSequence, it records the offsets of the
-/// labels in the wireformat data of the Name. When split() is called on
-/// the LabelSequence, no changes in the Name's data occur, but the
-/// internal pointers of the LabelSequence are modified.
+/// labels in the wireformat data of the Name. When stripLeft() or
+/// stripRight() is called on the LabelSequence, no changes in the
+/// Name's data occur, but the internal pointers of the
+/// LabelSequence are modified.
///
/// LabelSequences can be compared to other LabelSequences, and their
/// data can be requested (which then points to part of the original
@@ -88,7 +89,7 @@ public:
/// of labels currently pointed to by this LabelSequence
///
/// \param i The number of labels to remove.
- void leftSplit(size_t i);
+ void stripLeft(size_t i);
/// \brief Remove labels from the end of this LabelSequence
///
@@ -99,7 +100,7 @@ public:
/// of labels currently pointed to by this LabelSequence
///
/// \param i The number of labels to remove.
- void rightSplit(size_t i);
+ void stripRight(size_t i);
/// \brief Returns the current number of labels for this LabelSequence
///
diff --git a/src/lib/dns/tests/labelsequence_unittest.cc b/src/lib/dns/tests/labelsequence_unittest.cc
index f974219..72326be 100644
--- a/src/lib/dns/tests/labelsequence_unittest.cc
+++ b/src/lib/dns/tests/labelsequence_unittest.cc
@@ -143,89 +143,89 @@ TEST_F(LabelSequenceTest, getData) {
getDataCheck("\000", 1, ls7);
};
-TEST_F(LabelSequenceTest, leftSplit) {
+TEST_F(LabelSequenceTest, stripLeft) {
EXPECT_TRUE(ls1.equals(ls3));
- ls1.leftSplit(0);
+ ls1.stripLeft(0);
getDataCheck("\007example\003org\000", 13, ls1);
EXPECT_TRUE(ls1.equals(ls3));
- ls1.leftSplit(1);
+ ls1.stripLeft(1);
getDataCheck("\003org\000", 5, ls1);
EXPECT_FALSE(ls1.equals(ls3));
- ls1.leftSplit(1);
+ ls1.stripLeft(1);
getDataCheck("\000", 1, ls1);
EXPECT_TRUE(ls1.equals(ls7));
- ls2.leftSplit(2);
+ ls2.stripLeft(2);
getDataCheck("\000", 1, ls2);
EXPECT_TRUE(ls2.equals(ls7));
}
-TEST_F(LabelSequenceTest, rightSplit) {
+TEST_F(LabelSequenceTest, stripRight) {
EXPECT_TRUE(ls1.equals(ls3));
- ls1.rightSplit(1);
+ ls1.stripRight(1);
getDataCheck("\007example\003org", 12, ls1);
EXPECT_FALSE(ls1.equals(ls3));
- ls1.rightSplit(1);
+ ls1.stripRight(1);
getDataCheck("\007example", 8, ls1);
EXPECT_FALSE(ls1.equals(ls3));
ASSERT_FALSE(ls1.equals(ls2));
- ls2.rightSplit(2);
+ ls2.stripRight(2);
getDataCheck("\007example", 8, ls2);
EXPECT_TRUE(ls1.equals(ls2));
}
-TEST_F(LabelSequenceTest, split_oor) {
- EXPECT_THROW(ls1.leftSplit(100), isc::OutOfRange);
- EXPECT_THROW(ls1.leftSplit(5), isc::OutOfRange);
- EXPECT_THROW(ls1.leftSplit(4), isc::OutOfRange);
- EXPECT_THROW(ls1.leftSplit(3), isc::OutOfRange);
+TEST_F(LabelSequenceTest, stripOutOfRange) {
+ EXPECT_THROW(ls1.stripLeft(100), isc::OutOfRange);
+ EXPECT_THROW(ls1.stripLeft(5), isc::OutOfRange);
+ EXPECT_THROW(ls1.stripLeft(4), isc::OutOfRange);
+ EXPECT_THROW(ls1.stripLeft(3), isc::OutOfRange);
getDataCheck("\007example\003org\000", 13, ls1);
- EXPECT_THROW(ls1.rightSplit(100), isc::OutOfRange);
- EXPECT_THROW(ls1.rightSplit(5), isc::OutOfRange);
- EXPECT_THROW(ls1.rightSplit(4), isc::OutOfRange);
- EXPECT_THROW(ls1.rightSplit(3), isc::OutOfRange);
+ EXPECT_THROW(ls1.stripRight(100), isc::OutOfRange);
+ EXPECT_THROW(ls1.stripRight(5), isc::OutOfRange);
+ EXPECT_THROW(ls1.stripRight(4), isc::OutOfRange);
+ EXPECT_THROW(ls1.stripRight(3), isc::OutOfRange);
getDataCheck("\007example\003org\000", 13, ls1);
}
TEST_F(LabelSequenceTest, getLabelCount) {
EXPECT_EQ(3, ls1.getLabelCount());
- ls1.leftSplit(0);
+ ls1.stripLeft(0);
EXPECT_EQ(3, ls1.getLabelCount());
- ls1.leftSplit(1);
+ ls1.stripLeft(1);
EXPECT_EQ(2, ls1.getLabelCount());
- ls1.leftSplit(1);
+ ls1.stripLeft(1);
EXPECT_EQ(1, ls1.getLabelCount());
EXPECT_EQ(3, ls2.getLabelCount());
- ls2.rightSplit(1);
+ ls2.stripRight(1);
EXPECT_EQ(2, ls2.getLabelCount());
- ls2.rightSplit(1);
+ ls2.stripRight(1);
EXPECT_EQ(1, ls2.getLabelCount());
EXPECT_EQ(3, ls3.getLabelCount());
- ls3.rightSplit(2);
+ ls3.stripRight(2);
EXPECT_EQ(1, ls3.getLabelCount());
EXPECT_EQ(5, ls4.getLabelCount());
- ls4.rightSplit(3);
+ ls4.stripRight(3);
EXPECT_EQ(2, ls4.getLabelCount());
EXPECT_EQ(3, ls5.getLabelCount());
- ls5.leftSplit(2);
+ ls5.stripLeft(2);
EXPECT_EQ(1, ls5.getLabelCount());
}
TEST_F(LabelSequenceTest, comparePart) {
EXPECT_FALSE(ls1.equals(ls8));
- // Split root label from example.org.
- ls1.rightSplit(1);
- // Split foo from foo.example.org.bar.
- ls8.leftSplit(1);
- // Split bar. (i.e. bar and root) too
- ls8.rightSplit(2);
+ // strip root label from example.org.
+ ls1.stripRight(1);
+ // strip foo from foo.example.org.bar.
+ ls8.stripLeft(1);
+ // strip bar. (i.e. bar and root) too
+ ls8.stripRight(2);
EXPECT_TRUE(ls1.equals(ls8));
@@ -238,16 +238,16 @@ TEST_F(LabelSequenceTest, comparePart) {
TEST_F(LabelSequenceTest, isAbsolute) {
ASSERT_TRUE(ls1.isAbsolute());
- ls1.leftSplit(1);
+ ls1.stripLeft(1);
ASSERT_TRUE(ls1.isAbsolute());
- ls1.rightSplit(1);
+ ls1.stripRight(1);
ASSERT_FALSE(ls1.isAbsolute());
ASSERT_TRUE(ls2.isAbsolute());
- ls2.rightSplit(1);
+ ls2.stripRight(1);
ASSERT_FALSE(ls2.isAbsolute());
ASSERT_TRUE(ls3.isAbsolute());
- ls3.leftSplit(2);
+ ls3.stripLeft(2);
ASSERT_TRUE(ls3.isAbsolute());
}
More information about the bind10-changes
mailing list