]> granicus.if.org Git - pdns/commitdiff
Add test for typeXXX lowercase acceptance
authorPieter Lexis <pieter.lexis@powerdns.com>
Thu, 28 Jan 2016 15:25:43 +0000 (16:25 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Thu, 28 Jan 2016 15:25:43 +0000 (16:25 +0100)
pdns/Makefile.am
pdns/test-dnsparser_hh.cc [new file with mode: 0644]

index 5b5fb0a4adcf88ecba19e63d5e1f5ad9573997ec..8a82d812b087dc0e3fec723c4f5793cb3abd9c50 100644 (file)
@@ -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 (file)
index 0000000..6165743
--- /dev/null
@@ -0,0 +1,21 @@
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_NO_MAIN
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <boost/test/unit_test.hpp>
+#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()