]> granicus.if.org Git - pdns/commitdiff
Fixed some tests to check input value instead of zone value
authorAki Tuomi <cmouse@desteem.org>
Tue, 21 May 2013 08:59:06 +0000 (11:59 +0300)
committerAki Tuomi <cmouse@desteem.org>
Thu, 23 May 2013 13:36:11 +0000 (16:36 +0300)
pdns/test-dnsrecords_cc.cc

index a38524e7e0cd3b16f067ea6042663277b0908e5d..751241f3711a88a3c1dda07d1cdf928168e2f326 100644 (file)
@@ -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<DNSRecordContent> rec3 = DNSRecordContent::unserialize("rec.test",q.getCode(),(val.get<3>()));