From: Pieter Lexis Date: Thu, 28 Jan 2016 15:25:43 +0000 (+0100) Subject: Add test for typeXXX lowercase acceptance X-Git-Tag: dnsdist-1.0.0-alpha2~5^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ee48a74d32de70b7f6363a2c9945fc209d09fa2;p=pdns Add test for typeXXX lowercase acceptance --- diff --git a/pdns/Makefile.am b/pdns/Makefile.am index 5b5fb0a4a..8a82d812b 100644 --- a/pdns/Makefile.am +++ b/pdns/Makefile.am @@ -1056,7 +1056,7 @@ testrunner_SOURCES = \ dnsname.cc \ dnsname.hh \ dnspacket.cc \ - dnsparser.cc \ + dnsparser.hh dnsparser.cc \ dnsrecords.cc \ dnssecinfra.cc \ dnswriter.cc \ @@ -1083,6 +1083,7 @@ testrunner_SOURCES = \ test-distributor_hh.cc \ test-dns_random_hh.cc \ test-dnsname_cc.cc \ + test-dnsparser_hh.cc \ test-dnsrecords_cc.cc \ test-iputils_hh.cc \ test-md5_hh.cc \ diff --git a/pdns/test-dnsparser_hh.cc b/pdns/test-dnsparser_hh.cc new file mode 100644 index 000000000..61657430c --- /dev/null +++ b/pdns/test-dnsparser_hh.cc @@ -0,0 +1,21 @@ +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_NO_MAIN +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include +#include "dnsparser.hh" + +BOOST_AUTO_TEST_SUITE(test_dnsparser_hh) + +BOOST_AUTO_TEST_CASE(test_type_lowercase) { + std::string lc("type12345"); + std::string uc("TYPE12345"); + + uint16_t lc_result = DNSRecordContent::TypeToNumber(lc); + uint16_t uc_result = DNSRecordContent::TypeToNumber(uc); + BOOST_CHECK_EQUAL(lc_result, 12345); + BOOST_CHECK_EQUAL(lc_result, uc_result); +} + +BOOST_AUTO_TEST_SUITE_END()