BOOST_CHECK_EQUAL(rr.content, std::string(data.begin(),data.end()-1));
else
BOOST_CHECK_EQUAL(rr.content, data);
- }
+ }
+}
+
+BOOST_AUTO_TEST_CASE(test_tng_record_generate) {
+ reportAllTypes();
+
+ std::ostringstream pathbuf;
+ const char* p = std::getenv("SRCDIR");
+ if(!p)
+ p = ".";
+ pathbuf << p << "/../regression-tests/zones/unit2.test";
+ ZoneParserTNG zp(pathbuf.str(), DNSName("unit2.test"));
+
+ string expected[] = {
+ "0.01.0003.000005.00000007.unit2.test.",
+ "1.02.0004.000006.00000008.unit2.test.",
+ "2.03.0005.000007.00000009.unit2.test.",
+ "3.04.0006.000008.0000000a.unit2.test.",
+ "4.05.0007.000009.0000000b.unit2.test.",
+ "5.06.0008.00000A.0000000c.unit2.test.",
+ "6.07.0009.00000B.0000000d.unit2.test.",
+ "7.10.0010.00000C.0000000e.unit2.test.",
+ "8.11.0011.00000D.0000000f.unit2.test.",
+ "9.12.0012.00000E.00000010.unit2.test.",
+ "10.13.0013.00000F.00000011.unit2.test.",
+ "11.14.0014.000010.00000012.unit2.test.",
+ "12.15.0015.000011.00000013.unit2.test.",
+ "13.16.0016.000012.00000014.unit2.test.",
+ "14.17.0017.000013.00000015.unit2.test.",
+ "15.20.0018.000014.00000016.unit2.test.",
+ "16.21.0019.000015.00000017.unit2.test."
+ };
+
+ for (size_t i = 0; i < sizeof(expected) / sizeof(expected[0]); i++) {
+ DNSResourceRecord rr;
+ zp.get(rr);
+ BOOST_CHECK_EQUAL(rr.qname.toString(), expected[i]);
+ BOOST_CHECK_EQUAL(rr.ttl, 86400U);
+ BOOST_CHECK_EQUAL(rr.qclass, 1U);
+ BOOST_CHECK_EQUAL(rr.qtype.getName(), "A");
+ BOOST_CHECK_EQUAL(rr.content, "1.2.3.4");
+ }
}