From: Tomek Mrugalski Date: Tue, 16 Jul 2013 09:18:21 +0000 (+0200) Subject: [2994] Some unit-tests are now passing. X-Git-Tag: bind10-1.2.0beta1-release~333^2~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1626b91e6d458b0dfe8fb71434b52273edaeb795;p=thirdparty%2Fkea.git [2994] Some unit-tests are now passing. --- diff --git a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc index 15b8b900ff..2e4e5aa11e 100644 --- a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc @@ -1722,24 +1722,35 @@ public: 192, 0, 2, 255, // siaddr 255, 255, 255, 255, // giaddr }; - + // Initialize the vector with the header fields defined above. vector buf(hdr, hdr + sizeof(hdr)); - + // Append the large header fields. copy(dummyChaddr, dummyChaddr + Pkt4::MAX_CHADDR_LEN, back_inserter(buf)); copy(dummySname, dummySname + Pkt4::MAX_SNAME_LEN, back_inserter(buf)); copy(dummyFile, dummyFile + Pkt4::MAX_FILE_LEN, back_inserter(buf)); - + // Should now have all the header, so check. The "static_cast" is used // to get round an odd bug whereby the linker appears not to find the // definition of DHCPV4_PKT_HDR_LEN if it appears within an EXPECT_EQ(). EXPECT_EQ(static_cast(Pkt4::DHCPV4_PKT_HDR_LEN), buf.size()); - return (Pkt4Ptr(new Pkt4(DHCPDISCOVER, 12345))); + // Add magic cookie + buf.push_back(0x63); + buf.push_back(0x82); + buf.push_back(0x53); + buf.push_back(0x63); + + // Add message type DISCOVER + buf.push_back(static_cast(DHO_DHCP_MESSAGE_TYPE)); + buf.push_back(1); // length (just one byte) + buf.push_back(static_cast(DHCPDISCOVER)); + + return (Pkt4Ptr(new Pkt4(&buf[0], buf.size()))); } - /// test callback that stores received callout name and pkt6 value + /// test callback that stores received callout name and pkt4 value /// @param callout_handle handle passed by the hooks framework /// @return always 0 static int