BIND 10 trac2000, updated. a001951886e545f2f0a299fccbeb7fb9388deccf [2000] Add appendPseudoRR() unittests

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Jan 27 08:07:00 UTC 2014


The branch, trac2000 has been updated
       via  a001951886e545f2f0a299fccbeb7fb9388deccf (commit)
      from  e2c4caa23971f3ebd70483ccc9c0b9ba8b7efa2e (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 a001951886e545f2f0a299fccbeb7fb9388deccf
Author: Mukund Sivaraman <muks at isc.org>
Date:   Mon Jan 27 13:36:53 2014 +0530

    [2000] Add appendPseudoRR() unittests

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

Summary of changes:
 src/lib/dns/tests/rdata_opt_unittest.cc |   20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/tests/rdata_opt_unittest.cc b/src/lib/dns/tests/rdata_opt_unittest.cc
index 6f703bf..e5695ac 100644
--- a/src/lib/dns/tests/rdata_opt_unittest.cc
+++ b/src/lib/dns/tests/rdata_opt_unittest.cc
@@ -104,9 +104,23 @@ TEST_F(Rdata_OPT_Test, compare) {
                  isc::InvalidOperation);
 }
 
-TEST_F(Rdata_OPT_Test, append) {
-    EXPECT_THROW(rdata_opt.toText(),
-                 isc::InvalidOperation);
+TEST_F(Rdata_OPT_Test, appendPseudoRR) {
+    generic::OPT rdata_opt;
+
+    // Append empty option data
+    rdata_opt.appendPseudoRR(0x0042, NULL, 0);
+
+    // Append simple option data
+    const uint8_t option_data[] = {'H', 'e', 'l', 'l', 'o'};
+    rdata_opt.appendPseudoRR(0x0043, option_data, sizeof(option_data));
+
+    // Duplicate option codes are okay.
+    rdata_opt.appendPseudoRR(0x0042, option_data, sizeof(option_data));
+
+    // When option length may overflow RDLEN, append should throw.
+    const std::vector<uint8_t> buffer((1 << 16) - 1);
+    EXPECT_THROW(rdata_opt.appendPseudoRR(0x0044, &buffer[0], buffer.size()),
+                 isc::InvalidParameter);
 }
 
 TEST_F(Rdata_OPT_Test, getPseudoRRs) {



More information about the bind10-changes mailing list