]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2096] The RdataReader::getSize
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Fri, 10 Aug 2012 11:21:54 +0000 (13:21 +0200)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Fri, 10 Aug 2012 11:21:54 +0000 (13:21 +0200)
src/lib/datasrc/memory/rdata_reader.h
src/lib/datasrc/memory/tests/rdata_serialization_unittest.cc

index ff631028ec642e11736bf578a18ec0ad727174b7..a70d6758c228fd1bbfc68a3ea691e048b050529b 100644 (file)
@@ -251,7 +251,7 @@ public:
     /// \brief Returns the size of associated data.
     ///
     /// This just returns whatever was passed to the constructor as size.
-    size_t getSize() const;
+    size_t getSize() const { return (size_); }
 private:
     const NameAction name_action_;
     const DataAction data_action_;
index 6f0e8a5848c5ce6406993a7ff03940f13de86b9d..ef6d401d6a498edbfed1c148e329371bed53739f 100644 (file)
@@ -468,6 +468,8 @@ public:
                            boost::bind(renderNameField, &renderer,
                                        additionalRequired(rrtype), _1, _2),
                            boost::bind(appendData, &data, &current, _1, _2));
+        // The size matches
+        EXPECT_EQ(encoded_data.size(), reader.getSize());
         if (start_sig) {
             current = NULL;
             reader.nextSig();
@@ -492,6 +494,8 @@ public:
         // Render the name and the sigs
         renderer.writeName(dummy_name2);
         renderer.writeData(&data[0], data.size());
+        // The size matches even after use
+        EXPECT_EQ(encoded_data.size(), reader.getSize());
     }
 };