From: Pieter Lexis Date: Fri, 7 Apr 2017 10:48:57 +0000 (+0200) Subject: Add a test for DNSName::getLastLabel() X-Git-Tag: rec-4.1.0-alpha1~166^2~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7086723ef638fa76e9886079ab127916c8b22eab;p=pdns Add a test for DNSName::getLastLabel() --- diff --git a/pdns/test-dnsname_cc.cc b/pdns/test-dnsname_cc.cc index bb829614e..771bfb84b 100644 --- a/pdns/test-dnsname_cc.cc +++ b/pdns/test-dnsname_cc.cc @@ -858,4 +858,14 @@ BOOST_AUTO_TEST_CASE(test_getrawlabel) { BOOST_CHECK_THROW(name.getRawLabel(name.countLabels()), std::out_of_range); } +BOOST_AUTO_TEST_CASE(test_getlastlabel) { + DNSName name("www.powerdns.com"); + DNSName ans = name.getLastLabel(); + + // Check the const-ness + BOOST_CHECK_EQUAL(name, DNSName("www.powerdns.com")); + + // Check if the last label is indeed returned + BOOST_CHECK_EQUAL(ans, DNSName("com")); +} BOOST_AUTO_TEST_SUITE_END()