From: Francis Dupont Date: Sun, 1 Nov 2015 01:10:57 +0000 (+0100) Subject: [4111] Added an emptyOptionData unit test X-Git-Tag: trac4097_base~4^2^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7f471c9621b9632f6dbcd6a2f25eba7ee40e155a;p=thirdparty%2Fkea.git [4111] Added an emptyOptionData unit test --- diff --git a/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc b/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc index e85bd3787f..a34d57aed1 100644 --- a/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc +++ b/src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc @@ -822,6 +822,23 @@ TEST_F(ParseConfigTest, optionDataMinimalWithOptionDef) { } +// This test verifies an empty option data configuration is supported. +TEST_F(ParseConfigTest, emptyOptionData) { + // Configuration string. + std::string config = + "{ \"option-data\": [ {" + " \"name\": \"dhcp4o6-server-addr\"" + " } ]" + "}"; + + int rcode = 0; + ASSERT_NO_THROW(rcode = parseConfiguration(config)); + Option6AddrLstPtr opt = boost::dynamic_pointer_cast< + Option6AddrLst>(getOptionPtr("dhcp6", D6O_DHCPV4_O_DHCPV6_SERVER)); + ASSERT_TRUE(opt); + ASSERT_EQ(0, opt->getAddresses().size()); +} + }; // Anonymous namespace /// The next set of tests check basic operation of the HooksLibrariesParser.