]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2432] Add zero-argument RRsetCollection constructor
authorMukund Sivaraman <muks@isc.org>
Wed, 26 Dec 2012 04:58:32 +0000 (10:28 +0530)
committerMukund Sivaraman <muks@isc.org>
Wed, 26 Dec 2012 04:58:32 +0000 (10:28 +0530)
src/lib/dns/rrset_collection.h
src/lib/dns/tests/rrset_collection_unittest.cc

index 5c6f8fd24cfea0eaf08bb1b318cc07c134523c2a..37db6cca4f8d7e6ea144c12ff6b0527f65afcb11 100644 (file)
@@ -30,6 +30,10 @@ namespace dns {
 /// container.
 class RRsetCollection : public RRsetCollectionBase {
 public:
+    /// \brief Constructor.
+    RRsetCollection()
+    {}
+
     /// \brief Constructor.
     ///
     /// The \c origin and \c rrclass arguments are required for the zone
index 6cbd2f9ac84bdbc24f50075c11dd4c5c7dc3bf55..b222c45b82440dfe561428bfc937db84dcbdc120 100644 (file)
@@ -126,6 +126,9 @@ doAddAndRemove(RRsetCollection& collection, const RRClass& rrclass) {
     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());
 
@@ -139,6 +142,19 @@ 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) {
     // The collection must not be empty.
     EXPECT_NE(collection.end(), collection.begin());