From: Mukund Sivaraman Date: Mon, 27 Jan 2014 08:36:30 +0000 (+0530) Subject: [2000] Add another toWire() test X-Git-Tag: bind10-1.2.0beta1-release~36^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=916893ac37eeeb169c90c7cf374630a7cfba127b;p=thirdparty%2Fkea.git [2000] Add another toWire() test --- diff --git a/src/lib/dns/tests/rdata_opt_unittest.cc b/src/lib/dns/tests/rdata_opt_unittest.cc index 756f8d3f0f..49d3068347 100644 --- a/src/lib/dns/tests/rdata_opt_unittest.cc +++ b/src/lib/dns/tests/rdata_opt_unittest.cc @@ -154,6 +154,38 @@ TEST_F(Rdata_OPT_Test, appendPseudoRR) { const std::vector buffer((1 << 16) - 1); EXPECT_THROW(rdata_opt.appendPseudoRR(0x0044, &buffer[0], buffer.size()), isc::InvalidParameter); + + const uint8_t rdata_opt_wiredata2[] = { + // OPTION #1 + // ` Option code + 0x00, 0x42, + // ` Option length + 0x00, 0x00, + + // OPTION #2 + // ` Option code + 0x00, 0x43, + // ` Option length + 0x00, 0x05, + // ` Option data + 'H', 'e', 'l', 'l', 'o', + + // OPTION #3 + // ` Option code + 0x00, 0x42, + // ` Option length + 0x00, 0x05, + // ` Option data + 'H', 'e', 'l', 'l', 'o' + }; + + obuffer.clear(); + rdata_opt.toWire(obuffer); + + EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, + obuffer.getData(), + obuffer.getLength(), + rdata_opt_wiredata2, sizeof(rdata_opt_wiredata2)); } TEST_F(Rdata_OPT_Test, getPseudoRRs) {