From: Marcin Siodelski Date: Tue, 25 Nov 2014 15:38:22 +0000 (+0100) Subject: [3624] Extend test for DHCPv6 client FQDN to cover multi-label domain name. X-Git-Tag: kea-eng-20141219~14^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4850c004b050dfeb01bf59f55178e76ed08c3a19;p=thirdparty%2Fkea.git [3624] Extend test for DHCPv6 client FQDN to cover multi-label domain name. --- diff --git a/src/lib/dhcp/tests/option6_client_fqdn_unittest.cc b/src/lib/dhcp/tests/option6_client_fqdn_unittest.cc index dac38e1c99..4bbc1bd8de 100644 --- a/src/lib/dhcp/tests/option6_client_fqdn_unittest.cc +++ b/src/lib/dhcp/tests/option6_client_fqdn_unittest.cc @@ -791,6 +791,14 @@ TEST(Option6ClientFqdnTest, len) { // length of the string representation of the domain name + 1). EXPECT_EQ(25, option->len()); + // Use different domain name to check if the length also changes + // as expected. + ASSERT_NO_THROW( + option.reset(new Option6ClientFqdn(0, "example.com")) + ); + ASSERT_TRUE(option); + EXPECT_EQ(18, option->len()); + // Let's check that the size will change when domain name of a different // size is used. ASSERT_NO_THROW( @@ -805,6 +813,16 @@ TEST(Option6ClientFqdnTest, len) { ); ASSERT_TRUE(option); EXPECT_EQ(12, option->len()); + + // Another test for partial domain name but this time using + // two labels. + ASSERT_NO_THROW( + option.reset(new Option6ClientFqdn(0, "myhost.example", + Option6ClientFqdn::PARTIAL)) + ); + ASSERT_TRUE(option); + EXPECT_EQ(20, option->len()); + } } // anonymous namespace