From: Tomek Mrugalski Date: Thu, 21 Nov 2019 06:12:35 +0000 (+0800) Subject: [#898] Unit-tests now check for DHCP class X-Git-Tag: tmark-perf-12-13-2019~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a981e50eda41cc668a5947467fbbdca997da429;p=thirdparty%2Fkea.git [#898] Unit-tests now check for DHCP class --- diff --git a/doc/sphinx/arm/hooks-bootp.rst b/doc/sphinx/arm/hooks-bootp.rst index b5a274d985..b687d6c003 100644 --- a/doc/sphinx/arm/hooks-bootp.rst +++ b/doc/sphinx/arm/hooks-bootp.rst @@ -5,7 +5,7 @@ BOOTP support .. note:: - This is library is still in experimental phase. Use with care! + This is library is still in experimental phase. Use with care! This hooks library adds support for BOOTP with vendor information extensions diff --git a/src/hooks/dhcp/bootp/tests/bootp_unittests.cc b/src/hooks/dhcp/bootp/tests/bootp_unittests.cc index c84bb7259c..dc5b58fbbd 100644 --- a/src/hooks/dhcp/bootp/tests/bootp_unittests.cc +++ b/src/hooks/dhcp/bootp/tests/bootp_unittests.cc @@ -90,6 +90,12 @@ public: } else { EXPECT_EQ(type, pkt->getType()); } + + if (dhcp) { + EXPECT_TRUE(pkt->inClass("DHCP")); + } else { + EXPECT_FALSE(pkt->inClass("DHCP")); + } } /// @brief Callout manager accessed by this CalloutHandle. @@ -118,7 +124,7 @@ TEST_F(BootpTest, dhcpOffer) { TEST_F(BootpTest, bootReply) { // The constructor does not allow to directly create a BOOTREPLY packet. Pkt4Ptr pkt(new Pkt4(DHCPOFFER, 12345)); - pkt->setType(DHCP_NOTYPE); + //pkt->setType(DHCP_NOTYPE); pkt->delOption(DHO_DHCP_MESSAGE_TYPE); ASSERT_EQ(BOOTREPLY, pkt->getOp()); calloutsCall(pkt, false); @@ -128,7 +134,7 @@ TEST_F(BootpTest, bootReply) { TEST_F(BootpTest, bootRequest) { // The constructor does not allow to directly create a BOOTREQUEST packet. Pkt4Ptr pkt(new Pkt4(DHCPDISCOVER, 12345)); - pkt->setType(DHCP_NOTYPE); + // pkt->setType(DHCP_NOTYPE); pkt->delOption(DHO_DHCP_MESSAGE_TYPE); ASSERT_EQ(BOOTREQUEST, pkt->getOp()); calloutsCall(pkt, true);