BIND 10 trac2432, updated. 7383457001cd2b6d78ec755f1cf20fa4529a43ab [2432] Add zero-argument RRsetCollection constructor

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Dec 26 04:58:48 UTC 2012


The branch, trac2432 has been updated
       via  7383457001cd2b6d78ec755f1cf20fa4529a43ab (commit)
       via  e6c05e218034a214844e1d4ab8b8c1060ec05489 (commit)
       via  b5735838a44da418d7d66724c8bb53c2d4d1b3c7 (commit)
       via  e4a823ad343ed077f88da1e581d0486c9b634a35 (commit)
      from  6c738ab17c6b6632f1a607cea6cea480fd1c72aa (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 7383457001cd2b6d78ec755f1cf20fa4529a43ab
Author: Mukund Sivaraman <muks at isc.org>
Date:   Wed Dec 26 10:28:32 2012 +0530

    [2432] Add zero-argument RRsetCollection constructor

commit e6c05e218034a214844e1d4ab8b8c1060ec05489
Author: Mukund Sivaraman <muks at isc.org>
Date:   Wed Dec 26 10:27:39 2012 +0530

    [2432] Remove iter variable

commit b5735838a44da418d7d66724c8bb53c2d4d1b3c7
Author: Mukund Sivaraman <muks at isc.org>
Date:   Wed Dec 26 10:22:08 2012 +0530

    [2432] Move addAndRemove test code to a helper method

commit e4a823ad343ed077f88da1e581d0486c9b634a35
Author: Mukund Sivaraman <muks at isc.org>
Date:   Wed Dec 26 10:20:05 2012 +0530

    [2432] Change equality check style

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dns/rrset_collection.h                 |    4 ++++
 src/lib/dns/tests/rrset_collection_unittest.cc |   27 +++++++++++++++++++++---
 2 files changed, 28 insertions(+), 3 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/rrset_collection.h b/src/lib/dns/rrset_collection.h
index 5c6f8fd..37db6cc 100644
--- a/src/lib/dns/rrset_collection.h
+++ b/src/lib/dns/rrset_collection.h
@@ -31,6 +31,10 @@ namespace dns {
 class RRsetCollection : public RRsetCollectionBase {
 public:
     /// \brief Constructor.
+    RRsetCollection()
+    {}
+
+    /// \brief Constructor.
     ///
     /// The \c origin and \c rrclass arguments are required for the zone
     /// loading, but \c RRsetCollection itself does not do any
diff --git a/src/lib/dns/tests/rrset_collection_unittest.cc b/src/lib/dns/tests/rrset_collection_unittest.cc
index 0481ab1..b222c45 100644
--- a/src/lib/dns/tests/rrset_collection_unittest.cc
+++ b/src/lib/dns/tests/rrset_collection_unittest.cc
@@ -104,7 +104,8 @@ TEST_F(RRsetCollectionTest, find) {
     doFind<RRsetCollection, RRsetPtr>(collection, rrclass);
 }
 
-TEST_F(RRsetCollectionTest, addAndRemove) {
+void
+doAddAndRemove(RRsetCollection& collection, const RRClass& rrclass) {
     // foo.example.org/A doesn't exist
     RRsetPtr rrset_found = collection.find(Name("foo.example.org"), rrclass,
                                            RRType::A());
@@ -125,6 +126,9 @@ TEST_F(RRsetCollectionTest, addAndRemove) {
     EXPECT_EQ(RRClass("IN"), rrset_found->getClass());
     EXPECT_EQ(Name("foo.example.org"), rrset_found->getName());
 
+    // The collection must not be empty.
+    EXPECT_NE(collection.end(), collection.begin());
+
     // Remove foo.example.org/A
     collection.removeRRset(Name("foo.example.org"), rrclass, RRType::A());
 
@@ -134,9 +138,26 @@ TEST_F(RRsetCollectionTest, addAndRemove) {
     EXPECT_FALSE(rrset_found);
 }
 
+TEST_F(RRsetCollectionTest, addAndRemove) {
+    doAddAndRemove(collection, rrclass);
+}
+
+TEST_F(RRsetCollectionTest, empty) {
+    RRsetCollection cln;
+
+    // Here, cln is empty.
+    EXPECT_EQ(cln.end(), cln.begin());
+
+    doAddAndRemove(cln, rrclass);
+
+    // cln should be empty again here, after the add and remove
+    // operations.
+    EXPECT_EQ(cln.end(), cln.begin());
+}
+
 TEST_F(RRsetCollectionTest, iteratorTest) {
-    RRsetCollection::iterator iter = collection.begin();
-    EXPECT_TRUE(iter != collection.end());
+    // The collection must not be empty.
+    EXPECT_NE(collection.end(), collection.begin());
 
     // Here, we just count the records and do some basic tests on them.
     size_t count = 0;



More information about the bind10-changes mailing list