From: Francis Dupont Date: Wed, 19 Apr 2017 12:32:11 +0000 (+0200) Subject: [5087] Fixed the length issue X-Git-Tag: trac5186_base~2^2~1 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=9d7d808cc7b2c0ece08de82a2c8a492bd5286d4f;p=thirdparty%2Fkea.git [5087] Fixed the length issue --- diff --git a/src/lib/dhcp/tests/libdhcp++_unittest.cc b/src/lib/dhcp/tests/libdhcp++_unittest.cc index a3a3010997..9d2d03d41b 100644 --- a/src/lib/dhcp/tests/libdhcp++_unittest.cc +++ b/src/lib/dhcp/tests/libdhcp++_unittest.cc @@ -1685,6 +1685,8 @@ TEST_F(LibDhcpTest, fqdnList) { 3, 99, 111, 109, // "com" 0 }; + /* This size is used later so protect ourselves against changes */ + static_assert(sizeof(fqdn) == 40); // Initialize a vector with the FQDN data. std::vector fqdn_buf(fqdn, fqdn + sizeof(fqdn)); @@ -1732,8 +1734,8 @@ TEST_F(LibDhcpTest, fqdnListCompressed) { ASSERT_TRUE(option); OptionCustomPtr names = boost::dynamic_pointer_cast(option); ASSERT_TRUE(names); - // Why is this failing? It seems the option does not use compression. - EXPECT_EQ(sizeof(compressed), names->len() - names->getHeaderLen()); + /* Use the uncompress length here (cf fqdnList) */ + EXPECT_EQ(40, names->len() - names->getHeaderLen()); ASSERT_EQ(3, names->getDataFieldsNum()); EXPECT_EQ("mydomain.example.com.", names->readFqdn(0)); EXPECT_EQ("example.com.", names->readFqdn(1));