From: Aki Tuomi Date: Fri, 10 May 2013 12:11:45 +0000 (+0300) Subject: new structure for testing record handlers at one go X-Git-Tag: auth-3.3-rc1~76^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a7960f3294f120d666ce88283fb2220a4c8bd189;p=thirdparty%2Fpdns.git new structure for testing record handlers at one go --- diff --git a/pdns/test-dnsrecords_cc.cc b/pdns/test-dnsrecords_cc.cc index 93b8a73c05..6bb06f016e 100644 --- a/pdns/test-dnsrecords_cc.cc +++ b/pdns/test-dnsrecords_cc.cc @@ -10,41 +10,28 @@ using namespace std; BOOST_AUTO_TEST_SUITE(dnsrecords_cc) -BOOST_AUTO_TEST_CASE(test_EUI48) { - EUI48RecordContent::report(); - std::string lineformat="\x00\x11\x22\x33\x44\x55"; - std::string zoneformat="00-11-22-33-44-55"; - - DNSRecordContent *rec = DNSRecordContent::mastermake(QType::EUI48, 1, zoneformat); - +BOOST_AUTO_TEST_CASE(test_record_types) { + typedef std::map cases_t; + reportAllTypes(); + + cases_t cases; + assign::insert(cases) + (QType::A, "127.0.0.1") + (QType::AAAA, "fe80::250:56ff:fe9b:114") + (QType::EUI48, "00-11-22-33-44-55") + (QType::EUI64, "00-11-22-33-44-55-66-77"); + + BOOST_FOREACH(const cases_t::value_type& val, cases) { + QType q(val.first); + DNSRecordContent *rec = DNSRecordContent::mastermake(q.getCode(), 1, val.second); 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_CHECK_EQUAL(rec->getZoneRepresentation(), val.second); + shared_ptr rec2 = DNSRecordContent::unserialize("rec.test",q.getCode(),rec->serialize("rec.test")); + BOOST_CHECK_EQUAL(rec2->getZoneRepresentation(), val.second); + } } -BOOST_AUTO_TEST_CASE(test_EUI64) { - EUI64RecordContent::report(); - std::string lineformat="\x00\x11\x22\x33\x44\x55\x66\x77"; - std::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()