From: Aki Tuomi Date: Fri, 10 May 2013 10:33:29 +0000 (+0300) Subject: Unit test for EUI48 and EUI64 records X-Git-Tag: auth-3.3-rc1~89 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ba97b3a92385c8221969a9784c2e06b779f240e;p=thirdparty%2Fpdns.git Unit test for EUI48 and EUI64 records --- diff --git a/pdns/test-dnsrecords_cc.cc b/pdns/test-dnsrecords_cc.cc new file mode 100644 index 0000000000..a4c5cb4038 --- /dev/null +++ b/pdns/test-dnsrecords_cc.cc @@ -0,0 +1,50 @@ +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_NO_MAIN +#include +#include +#include +#include "dnsrecords.hh" + +using namespace boost; +using namespace std; + +BOOST_AUTO_TEST_SUITE(dnsrecords_cc) + +BOOST_AUTO_TEST_CASE(test_EUI48) { + EUI48RecordContent::report(); + string lineformat="\x00\x11\x22\x33\x44\x55"; + string zoneformat="00-11-22-33-44-55"; + + DNSRecordContent *rec = DNSRecordContent::mastermake(QType::EUI48, 1, zoneformat); + + BOOST_CHECK(rec); + + // now verify the record + BOOST_CHECK_EQUAL(rec->getZoneRepresentation(), zoneformat); + shared_ptr rec2 = DNSRecordContent::unserialize("eui48.test",ns_t_eui48,rec->serialize("eui48.test")); + + BOOST_CHECK(rec2); + BOOST_CHECK_EQUAL(rec2->getZoneRepresentation(), zoneformat); +} + +BOOST_AUTO_TEST_CASE(test_EUI64) { + EUI64RecordContent::report(); + string lineformat="\x00\x11\x22\x33\x44\x55\x66\x77"; + string zoneformat="00-11-22-33-44-55-66-77"; + + DNSRecordContent *rec = DNSRecordContent::mastermake(QType::EUI64, 1, zoneformat); + + BOOST_CHECK(rec); + + // now verify the record + BOOST_CHECK_EQUAL(rec->getZoneRepresentation(), zoneformat); + shared_ptr rec2 = DNSRecordContent::unserialize("eui64.test",ns_t_eui64,rec->serialize("eui64.test")); + + BOOST_CHECK(rec2); + BOOST_CHECK_EQUAL(rec2->getZoneRepresentation(), zoneformat); +} + + +BOOST_AUTO_TEST_SUITE_END() + +