]> granicus.if.org Git - pdns/commitdiff
More modern C++ idiom
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 14 Oct 2019 07:06:35 +0000 (09:06 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 14 Oct 2019 07:06:35 +0000 (09:06 +0200)
pdns/test-zoneparser_tng_cc.cc

index 82e8481f2e2621a98b0f26e0e978af0a923df0ed..f300efbf65761a8c6f5f2fc2bac62cd2f7324c49 100644 (file)
@@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE(test_tng_record_generate) {
   pathbuf << p << "/../regression-tests/zones/unit2.test";
   ZoneParserTNG zp(pathbuf.str(), DNSName("unit2.test"));
 
-  string expected[] = {
+  vector<string> expected = {
     "0.01.0003.000005.00000007.unit2.test.",
     "1.02.0004.000006.00000008.unit2.test.",
     "2.03.0005.000007.00000009.unit2.test.",
@@ -83,10 +83,10 @@ BOOST_AUTO_TEST_CASE(test_tng_record_generate) {
     "16.21.0019.000015.00000017.unit2.test."
   };
 
-  for (size_t i = 0; i < sizeof(expected) / sizeof(expected[0]); i++) {
+  for (auto const & exp : expected) {
     DNSResourceRecord rr;
     zp.get(rr);
-    BOOST_CHECK_EQUAL(rr.qname.toString(), expected[i]);
+    BOOST_CHECK_EQUAL(rr.qname.toString(), exp);
     BOOST_CHECK_EQUAL(rr.ttl, 86400U);
     BOOST_CHECK_EQUAL(rr.qclass, 1U);
     BOOST_CHECK_EQUAL(rr.qtype.getName(), "A");