Browse Source

[2096] The RdataReader::getSize

Michal 'vorner' Vaner 13 years ago
parent
commit
8131de02fd

+ 1 - 1
src/lib/datasrc/memory/rdata_reader.h

@@ -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_;

+ 4 - 0
src/lib/datasrc/memory/tests/rdata_serialization_unittest.cc

@@ -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());
     }
 };