From: Aki Tuomi Date: Tue, 21 May 2013 08:59:06 +0000 (+0300) Subject: Fixed some tests to check input value instead of zone value X-Git-Tag: auth-3.3-rc1~6^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=620caf58b233724a035db787ef3942561389f36f;p=pdns Fixed some tests to check input value instead of zone value --- diff --git a/pdns/test-dnsrecords_cc.cc b/pdns/test-dnsrecords_cc.cc index a38524e7e..751241f37 100644 --- a/pdns/test-dnsrecords_cc.cc +++ b/pdns/test-dnsrecords_cc.cc @@ -36,11 +36,11 @@ BOOST_AUTO_TEST_CASE(test_record_types) { cases_t cases = boost::assign::list_of (CASE_S(QType::A, "127.0.0.1", "\x7F\x00\x00\x01",false)) // local nameserver - (CASE_L(QType::NS, "ns.rec.test", "ns.rec.test.", "\x02ns\xc0\x11",true)) + (CASE_L(QType::NS, "ns.rec.test", "ns.rec.test.", "\x02ns\xc0\x11",false)) // non-local nameserver (CASE_S(QType::NS, "ns.example.com.", "\x02ns\x07""example\x03""com\x00",false)) // local alias - (CASE_L(QType::CNAME, "name.rec.test", "name.rec.test.", "\x04name\xc0\x11",true)) + (CASE_L(QType::CNAME, "name.rec.test", "name.rec.test.", "\x04name\xc0\x11",false)) // non-local alias (CASE_S(QType::CNAME, "name.example.com.", "\x04name\x07""example\x03""com\x00",false)) // local names @@ -71,10 +71,10 @@ BOOST_AUTO_TEST_CASE(test_record_types) { (CASE_S(QType::TXT, "\"short text\"", "\x0ashort text",false)) (CASE_S(QType::TXT, "\"long record test 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\" \"2222222222\"", "\xff""long record test 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\x0a""2222222222",false)) - (CASE_L(QType::TXT, "\"long record test 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112222222222\"", "\"long record test 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\" \"2222222222\"", "\xff""long record test 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\x0a""2222222222",true)) + (CASE_L(QType::TXT, "\"long record test 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112222222222\"", "\"long record test 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\" \"2222222222\"", "\xff""long record test 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\x0a""2222222222",false)) (CASE_L(QType::TXT, "\"\\195\\133LAND ISLANDS\"", "\"\\195\\133LAND ISLANDS\"", "\x0e\xc3\x85LAND ISLANDS", false)) (CASE_L(QType::TXT, "\"\xc3\x85LAND ISLANDS\"", "\"\\195\\133LAND ISLANDS\"", "\x0e\xc3\x85LAND ISLANDS", false)) - (CASE_L(QType::TXT, "nonbreakingtxt", "\"nonbreakingtxt\"", "\x0enonbreakingtxt",false)) + (CASE_L(QType::TXT, "\"nonbreakingtxt\"", "\"nonbreakingtxt\"", "\x0enonbreakingtxt",false)) // local name (CASE_S(QType::RP, "admin.rec.test. admin-info.rec.test.", "\x05""admin\x03rec\x04test\x00\x0a""admin-info\x03rec\x04test\x00",false)) // non-local name @@ -172,8 +172,21 @@ BOOST_AUTO_TEST_CASE(test_record_types) { rec = DNSRecordContent::mastermake(q.getCode(), 1, val.get<1>()); BOOST_CHECK_MESSAGE(rec != NULL, "mastermake( " << q.getCode() << ", 1, " << val.get<1>() << ") returned NULL"); if (rec == NULL) continue; - // now verify the record (note that this will be same as *input* value (except for certain QTypes) - REC_CHECK_EQUAL(rec->getZoneRepresentation(), val.get<2>()); + // now verify the record (note that this will be same as *zone* value (except for certain QTypes) + + switch(q.getCode()) { + case QType::NS: + case QType::PTR: + case QType::MX: + case QType::CNAME: + case QType::SOA: + case QType::TXT: + // check *input* value instead + REC_CHECK_EQUAL(rec->getZoneRepresentation(), val.get<1>()); + break; + default: + REC_CHECK_EQUAL(rec->getZoneRepresentation(), val.get<2>()); + } recData = rec->serialize("rec.test"); } else { boost::shared_ptr rec3 = DNSRecordContent::unserialize("rec.test",q.getCode(),(val.get<3>()));