summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMukund Sivaraman <muks@isc.org>2014-01-15 02:38:31 +0100
committerMukund Sivaraman <muks@isc.org>2014-01-15 06:17:51 +0100
commit1d34831c4d70162e769625278dd8c901ad21f42d (patch)
tree4e6c152bad86275366ceb4f915930da1692f7588
parent[master] Added Changelog entry for #3252. (diff)
downloadkea-1d34831c4d70162e769625278dd8c901ad21f42d.tar.xz
kea-1d34831c4d70162e769625278dd8c901ad21f42d.zip
[2168] Remove use of UnitTestUtil::matchWireData() in dns/tests/
This also fixes a bug in TSIGKeyTest.construct where key_short_md5 was not tested correctly.
-rw-r--r--src/lib/dns/tests/edns_unittest.cc28
-rw-r--r--src/lib/dns/tests/message_unittest.cc28
-rw-r--r--src/lib/dns/tests/messagerenderer_unittest.cc55
-rw-r--r--src/lib/dns/tests/name_unittest.cc20
-rw-r--r--src/lib/dns/tests/question_unittest.cc12
-rw-r--r--src/lib/dns/tests/rdata_afsdb_unittest.cc24
-rw-r--r--src/lib/dns/tests/rdata_cname_unittest.cc20
-rw-r--r--src/lib/dns/tests/rdata_dhcid_unittest.cc12
-rw-r--r--src/lib/dns/tests/rdata_dname_unittest.cc20
-rw-r--r--src/lib/dns/tests/rdata_dnskey_unittest.cc15
-rw-r--r--src/lib/dns/tests/rdata_ds_like_unittest.cc12
-rw-r--r--src/lib/dns/tests/rdata_hinfo_unittest.cc15
-rw-r--r--src/lib/dns/tests/rdata_in_a_unittest.cc14
-rw-r--r--src/lib/dns/tests/rdata_in_aaaa_unittest.cc14
-rw-r--r--src/lib/dns/tests/rdata_minfo_unittest.cc25
-rw-r--r--src/lib/dns/tests/rdata_mx_unittest.cc12
-rw-r--r--src/lib/dns/tests/rdata_naptr_unittest.cc15
-rw-r--r--src/lib/dns/tests/rdata_ns_unittest.cc20
-rw-r--r--src/lib/dns/tests/rdata_nsec3param_like_unittest.cc8
-rw-r--r--src/lib/dns/tests/rdata_nsec3param_unittest.cc15
-rw-r--r--src/lib/dns/tests/rdata_nsec_unittest.cc10
-rw-r--r--src/lib/dns/tests/rdata_nsecbitmap_unittest.cc14
-rw-r--r--src/lib/dns/tests/rdata_ptr_unittest.cc20
-rw-r--r--src/lib/dns/tests/rdata_rp_unittest.cc14
-rw-r--r--src/lib/dns/tests/rdata_soa_unittest.cc16
-rw-r--r--src/lib/dns/tests/rdata_srv_unittest.cc26
-rw-r--r--src/lib/dns/tests/rdata_sshfp_unittest.cc23
-rw-r--r--src/lib/dns/tests/rdata_tsig_unittest.cc49
-rw-r--r--src/lib/dns/tests/rdata_txt_like_unittest.cc58
-rw-r--r--src/lib/dns/tests/rdata_unittest.cc15
-rw-r--r--src/lib/dns/tests/rdatafields_unittest.cc51
-rw-r--r--src/lib/dns/tests/rrclass_unittest.cc12
-rw-r--r--src/lib/dns/tests/rrset_unittest.cc30
-rw-r--r--src/lib/dns/tests/rrttl_unittest.cc12
-rw-r--r--src/lib/dns/tests/rrtype_unittest.cc12
-rw-r--r--src/lib/dns/tests/tsig_unittest.cc13
-rw-r--r--src/lib/dns/tests/tsigkey_unittest.cc30
-rw-r--r--src/lib/dns/tests/tsigrecord_unittest.cc17
38 files changed, 403 insertions, 403 deletions
diff --git a/src/lib/dns/tests/edns_unittest.cc b/src/lib/dns/tests/edns_unittest.cc
index de2d2447dd..3fffc6ff4f 100644
--- a/src/lib/dns/tests/edns_unittest.cc
+++ b/src/lib/dns/tests/edns_unittest.cc
@@ -31,12 +31,14 @@
#include <gtest/gtest.h>
#include <dns/tests/unittest_util.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
const uint8_t EDNS::SUPPORTED_VERSION;
@@ -159,8 +161,8 @@ TEST_F(EDNSTest, toWireRenderer) {
EXPECT_EQ(1, edns_base.toWire(renderer,
Rcode::NOERROR().getExtendedCode()));
UnitTestUtil::readWireData("edns_toWire1.wire", wiredata);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &wiredata[0], wiredata.size());
+ matchWireData(&wiredata[0], wiredata.size(),
+ renderer.getData(), renderer.getLength());
// Typical case, enabling DNSSEC
renderer.clear();
@@ -169,8 +171,8 @@ TEST_F(EDNSTest, toWireRenderer) {
EXPECT_EQ(1, edns_base.toWire(renderer,
Rcode::NOERROR().getExtendedCode()));
UnitTestUtil::readWireData("edns_toWire2.wire", wiredata);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &wiredata[0], wiredata.size());
+ matchWireData(&wiredata[0], wiredata.size(),
+ renderer.getData(), renderer.getLength());
// Non-0 extended Rcode
renderer.clear();
@@ -179,8 +181,8 @@ TEST_F(EDNSTest, toWireRenderer) {
EXPECT_EQ(1, edns_base.toWire(renderer,
Rcode::BADVERS().getExtendedCode()));
UnitTestUtil::readWireData("edns_toWire3.wire", wiredata);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &wiredata[0], wiredata.size());
+ matchWireData(&wiredata[0], wiredata.size(),
+ renderer.getData(), renderer.getLength());
// Uncommon UDP buffer size
renderer.clear();
@@ -190,8 +192,8 @@ TEST_F(EDNSTest, toWireRenderer) {
EXPECT_EQ(1, edns_base.toWire(renderer,
Rcode::NOERROR().getExtendedCode()));
UnitTestUtil::readWireData("edns_toWire4.wire", wiredata);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &wiredata[0], wiredata.size());
+ matchWireData(&wiredata[0], wiredata.size(),
+ renderer.getData(), renderer.getLength());
// From RR with unknown flag. If used for toWire(), the unknown flag
// should disappear.
@@ -201,8 +203,8 @@ TEST_F(EDNSTest, toWireRenderer) {
*opt_rdata).toWire(renderer,
Rcode::NOERROR().getExtendedCode()));
UnitTestUtil::readWireData("edns_toWire2.wire", wiredata);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &wiredata[0], wiredata.size());
+ matchWireData(&wiredata[0], wiredata.size(),
+ renderer.getData(), renderer.getLength());
// If the available length in the renderer is not sufficient for the OPT
// RR, it shouldn't be inserted.
@@ -222,8 +224,8 @@ TEST_F(EDNSTest, toWireBuffer) {
EXPECT_EQ(1, edns_base.toWire(obuffer,
Rcode::NOERROR().getExtendedCode()));
UnitTestUtil::readWireData("edns_toWire1.wire", wiredata);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, obuffer.getData(),
- obuffer.getLength(), &wiredata[0], wiredata.size());
+ matchWireData(&wiredata[0], wiredata.size(),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(EDNSTest, createFromRR) {
diff --git a/src/lib/dns/tests/message_unittest.cc b/src/lib/dns/tests/message_unittest.cc
index 8aaebaa183..637357eae4 100644
--- a/src/lib/dns/tests/message_unittest.cc
+++ b/src/lib/dns/tests/message_unittest.cc
@@ -41,13 +41,15 @@
#include <gtest/gtest.h>
#include <dns/tests/unittest_util.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
//
// Note: we need more tests, including:
@@ -217,10 +219,9 @@ TEST_F(MessageTest, fromWireWithTSIG) {
EXPECT_EQ(TSIGKey::HMACMD5_NAME(), tsig_rr->getRdata().getAlgorithm());
EXPECT_EQ(0x4da8877a, tsig_rr->getRdata().getTimeSigned());
EXPECT_EQ(TSIGContext::DEFAULT_FUDGE, tsig_rr->getRdata().getFudge());
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- tsig_rr->getRdata().getMAC(),
- tsig_rr->getRdata().getMACSize(),
- expected_mac, sizeof(expected_mac));
+ matchWireData(expected_mac, sizeof(expected_mac),
+ tsig_rr->getRdata().getMAC(),
+ tsig_rr->getRdata().getMACSize());
EXPECT_EQ(0, tsig_rr->getRdata().getError());
EXPECT_EQ(0, tsig_rr->getRdata().getOtherLen());
EXPECT_EQ(static_cast<void*>(NULL), tsig_rr->getRdata().getOtherData());
@@ -729,8 +730,8 @@ TEST_F(MessageTest, toWire) {
message_render.toWire(renderer);
vector<unsigned char> data;
UnitTestUtil::readWireData("message_toWire1", data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(MessageTest, toWireSigned) {
@@ -766,8 +767,8 @@ TEST_F(MessageTest, toWireSigned) {
message_render.toWire(renderer);
vector<unsigned char> data;
UnitTestUtil::readWireData("message_toWire6", data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(MessageTest, toWireSignedAndTruncated) {
@@ -810,8 +811,8 @@ TEST_F(MessageTest, toWireSignedAndTruncated) {
message_render.toWire(renderer);
vector<unsigned char> data;
UnitTestUtil::readWireData("message_toWire7", data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(MessageTest, toWireInParseMode) {
@@ -867,9 +868,8 @@ commonTSIGToWireCheck(Message& message, MessageRenderer& renderer,
message.toWire(renderer, tsig_ctx);
vector<unsigned char> expected_data;
UnitTestUtil::readWireData(expected_file, expected_data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(),
- &expected_data[0], expected_data.size());
+ matchWireData(&expected_data[0], expected_data.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(MessageTest, toWireWithTSIG) {
diff --git a/src/lib/dns/tests/messagerenderer_unittest.cc b/src/lib/dns/tests/messagerenderer_unittest.cc
index 582c164b6c..2b4da59ca1 100644
--- a/src/lib/dns/tests/messagerenderer_unittest.cc
+++ b/src/lib/dns/tests/messagerenderer_unittest.cc
@@ -19,6 +19,7 @@
#include <dns/messagerenderer.h>
#include <dns/tests/unittest_util.h>
+#include <util/unittests/wiredata.h>
#include <gtest/gtest.h>
@@ -33,6 +34,7 @@ using isc::dns::LabelSequence;
using isc::dns::MessageRenderer;
using isc::util::OutputBuffer;
using boost::lexical_cast;
+using isc::util::unittests::matchWireData;
namespace {
class MessageRendererTest : public ::testing::Test {
@@ -56,8 +58,8 @@ TEST_F(MessageRendererTest, writeIntger) {
renderer.writeUint16(data16);
expected_size += sizeof(data16);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &testdata[1], sizeof(data16));
+ matchWireData(&testdata[1], sizeof(data16),
+ renderer.getData(), renderer.getLength());
}
TEST_F(MessageRendererTest, writeName) {
@@ -65,8 +67,8 @@ TEST_F(MessageRendererTest, writeName) {
renderer.writeName(Name("a.example.com."));
renderer.writeName(Name("b.example.com."));
renderer.writeName(Name("a.example.org."));
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(MessageRendererTest, writeNameInLargeBuffer) {
@@ -77,11 +79,9 @@ TEST_F(MessageRendererTest, writeNameInLargeBuffer) {
renderer.writeName(Name("a.example.com."));
renderer.writeName(Name("a.example.com."));
renderer.writeName(Name("b.example.com."));
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- static_cast<const uint8_t*>(renderer.getData()) +
- offset,
- renderer.getLength() - offset,
- &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ static_cast<const uint8_t*>(renderer.getData()) + offset,
+ renderer.getLength() - offset);
}
TEST_F(MessageRendererTest, writeNameWithUncompressed) {
@@ -89,8 +89,8 @@ TEST_F(MessageRendererTest, writeNameWithUncompressed) {
renderer.writeName(Name("a.example.com."));
renderer.writeName(Name("b.example.com."), false);
renderer.writeName(Name("b.example.com."));
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(MessageRendererTest, writeNamePointerChain) {
@@ -98,8 +98,8 @@ TEST_F(MessageRendererTest, writeNamePointerChain) {
renderer.writeName(Name("a.example.com."));
renderer.writeName(Name("b.example.com."));
renderer.writeName(Name("b.example.com."));
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(MessageRendererTest, compressMode) {
@@ -126,8 +126,8 @@ TEST_F(MessageRendererTest, writeNameCaseCompress) {
// this should match the first name in terms of compression:
renderer.writeName(Name("b.exAmple.CoM."));
renderer.writeName(Name("a.example.org."));
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(MessageRendererTest, writeNameCaseSensitiveCompress) {
@@ -138,8 +138,8 @@ TEST_F(MessageRendererTest, writeNameCaseSensitiveCompress) {
renderer.writeName(Name("a.example.com."));
renderer.writeName(Name("b.eXample.com."));
renderer.writeName(Name("c.eXample.com."));
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(MessageRendererTest, writeNameMixedCaseCompress) {
@@ -171,11 +171,10 @@ TEST_F(MessageRendererTest, writeRootName) {
renderer.writeName(Name("."));
renderer.writeName(example_name);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- static_cast<const uint8_t*>(renderer.getData()),
- renderer.getLength(),
- static_cast<const uint8_t*>(expected.getData()),
- expected.getLength());
+ matchWireData(static_cast<const uint8_t*>(expected.getData()),
+ expected.getLength(),
+ static_cast<const uint8_t*>(renderer.getData()),
+ renderer.getLength());
}
TEST_F(MessageRendererTest, writeNameLabelSequence1) {
@@ -192,8 +191,8 @@ TEST_F(MessageRendererTest, writeNameLabelSequence1) {
// example.com.
renderer.writeName(ls1);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(MessageRendererTest, writeNameLabelSequence2) {
@@ -207,8 +206,8 @@ TEST_F(MessageRendererTest, writeNameLabelSequence2) {
// a.example.com (without root .)
renderer.writeName(ls1);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(MessageRendererTest, writeNameLabelSequence3) {
@@ -235,8 +234,8 @@ TEST_F(MessageRendererTest, writeNameLabelSequence3) {
// example
renderer.writeName(ls1);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(MessageRendererTest, setBuffer) {
diff --git a/src/lib/dns/tests/name_unittest.cc b/src/lib/dns/tests/name_unittest.cc
index 10d1e550cc..e52b8d0caa 100644
--- a/src/lib/dns/tests/name_unittest.cc
+++ b/src/lib/dns/tests/name_unittest.cc
@@ -25,6 +25,7 @@
#include <dns/messagerenderer.h>
#include <dns/tests/unittest_util.h>
+#include <util/unittests/wiredata.h>
#include <gtest/gtest.h>
@@ -32,6 +33,7 @@ using namespace std;
using namespace isc;
using namespace isc::dns;
using namespace isc::util;
+using isc::util::unittests::matchWireData;
//
// XXX: these are defined as class static constants, but some compilers
@@ -137,9 +139,8 @@ NameTest::compareInWireFormat(const Name& name_actual,
name_actual.toWire(buffer_actual);
name_expected.toWire(buffer_expected);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- buffer_actual.getData(), buffer_actual.getLength(),
- buffer_expected.getData(), buffer_expected.getLength());
+ matchWireData(buffer_expected.getData(), buffer_expected.getLength(),
+ buffer_actual.getData(), buffer_actual.getLength());
}
TEST_F(NameTest, nonlocalObject) {
@@ -454,8 +455,8 @@ TEST_F(NameTest, toWireBuffer) {
UnitTestUtil::readWireData(string("01610376697803636f6d00"), data);
Name("a.vix.com.").toWire(buffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, &data[0], data.size(),
- buffer.getData(), buffer.getLength());
+ matchWireData(&data[0], data.size(),
+ buffer.getData(), buffer.getLength());
}
//
@@ -468,8 +469,8 @@ TEST_F(NameTest, toWireRenderer) {
UnitTestUtil::readWireData(string("01610376697803636f6d00"), data);
Name("a.vix.com.").toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, &data[0], data.size(),
- renderer.getData(), renderer.getLength());
+ matchWireData(&data[0], data.size(),
+ renderer.getData(), renderer.getLength());
}
//
@@ -628,9 +629,8 @@ TEST_F(NameTest, at) {
}
example_name.toWire(buffer_expected);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- &data[0], data.size(), buffer_expected.getData(),
- buffer_expected.getLength());
+ matchWireData(&data[0], data.size(),
+ buffer_expected.getData(), buffer_expected.getLength());
// Out-of-range access: should trigger an exception.
EXPECT_THROW(example_name.at(example_name.getLength()), OutOfRange);
diff --git a/src/lib/dns/tests/question_unittest.cc b/src/lib/dns/tests/question_unittest.cc
index d1214a1238..8e1667f5c9 100644
--- a/src/lib/dns/tests/question_unittest.cc
+++ b/src/lib/dns/tests/question_unittest.cc
@@ -28,11 +28,13 @@
#include <gtest/gtest.h>
#include <dns/tests/unittest_util.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
using namespace isc::util;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class QuestionTest : public ::testing::Test {
@@ -100,16 +102,16 @@ TEST_F(QuestionTest, toWireBuffer) {
test_question1.toWire(obuffer);
test_question2.toWire(obuffer);
UnitTestUtil::readWireData("question_toWire1", wiredata);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, obuffer.getData(),
- obuffer.getLength(), &wiredata[0], wiredata.size());
+ matchWireData(&wiredata[0], wiredata.size(),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(QuestionTest, toWireRenderer) {
test_question1.toWire(renderer);
test_question2.toWire(renderer);
UnitTestUtil::readWireData("question_toWire2", wiredata);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &wiredata[0], wiredata.size());
+ matchWireData(&wiredata[0], wiredata.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(QuestionTest, toWireTruncated) {
diff --git a/src/lib/dns/tests/rdata_afsdb_unittest.cc b/src/lib/dns/tests/rdata_afsdb_unittest.cc
index 9a628cd178..6e933f5d59 100644
--- a/src/lib/dns/tests/rdata_afsdb_unittest.cc
+++ b/src/lib/dns/tests/rdata_afsdb_unittest.cc
@@ -24,12 +24,14 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
const char* const afsdb_text = "1 afsdb.example.com.";
const char* const afsdb_text2 = "0 root.example.com.";
@@ -155,9 +157,8 @@ TEST_F(Rdata_AFSDB_Test, toWireBuffer) {
UnitTestUtil::readWireData("rdata_afsdb_toWire1.wire", expected_wire);
// then compare them
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- obuffer.getData(), obuffer.getLength(),
- &expected_wire[0], expected_wire.size());
+ matchWireData(&expected_wire[0], expected_wire.size(),
+ obuffer.getData(), obuffer.getLength());
// clear buffer for the next test
obuffer.clear();
@@ -170,9 +171,8 @@ TEST_F(Rdata_AFSDB_Test, toWireBuffer) {
UnitTestUtil::readWireData("rdata_afsdb_toWire2.wire", expected_wire);
// then compare them
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- obuffer.getData(), obuffer.getLength(),
- &expected_wire[0], expected_wire.size());
+ matchWireData(&expected_wire[0], expected_wire.size(),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(Rdata_AFSDB_Test, toWireRenderer) {
@@ -187,9 +187,8 @@ TEST_F(Rdata_AFSDB_Test, toWireRenderer) {
UnitTestUtil::readWireData("rdata_afsdb_toWire1.wire", expected_wire);
// then compare them
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- &expected_wire[0], expected_wire.size());
+ matchWireData(&expected_wire[0], expected_wire.size(),
+ renderer.getData(), renderer.getLength());
// clear renderer for the next test
renderer.clear();
@@ -202,9 +201,8 @@ TEST_F(Rdata_AFSDB_Test, toWireRenderer) {
UnitTestUtil::readWireData("rdata_afsdb_toWire2.wire", expected_wire);
// then compare them
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- &expected_wire[0], expected_wire.size());
+ matchWireData(&expected_wire[0], expected_wire.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(Rdata_AFSDB_Test, toText) {
diff --git a/src/lib/dns/tests/rdata_cname_unittest.cc b/src/lib/dns/tests/rdata_cname_unittest.cc
index 5f602f011e..6e706e0a8d 100644
--- a/src/lib/dns/tests/rdata_cname_unittest.cc
+++ b/src/lib/dns/tests/rdata_cname_unittest.cc
@@ -24,12 +24,14 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class Rdata_CNAME_Test : public RdataTest {
@@ -115,20 +117,18 @@ TEST_F(Rdata_CNAME_Test, createFromLexer) {
TEST_F(Rdata_CNAME_Test, toWireBuffer) {
rdata_cname.toWire(obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- obuffer.getData(), obuffer.getLength(),
- wiredata_cname, sizeof(wiredata_cname));
+ matchWireData(wiredata_cname, sizeof(wiredata_cname),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(Rdata_CNAME_Test, toWireRenderer) {
rdata_cname.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- wiredata_cname, sizeof(wiredata_cname));
+ matchWireData(wiredata_cname, sizeof(wiredata_cname),
+ renderer.getData(), renderer.getLength());
+
rdata_cname2.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- wiredata_cname2, sizeof(wiredata_cname2));
+ matchWireData(wiredata_cname2, sizeof(wiredata_cname2),
+ renderer.getData(), renderer.getLength());
}
TEST_F(Rdata_CNAME_Test, toText) {
diff --git a/src/lib/dns/tests/rdata_dhcid_unittest.cc b/src/lib/dns/tests/rdata_dhcid_unittest.cc
index 77baccd893..5bc1d1ef4f 100644
--- a/src/lib/dns/tests/rdata_dhcid_unittest.cc
+++ b/src/lib/dns/tests/rdata_dhcid_unittest.cc
@@ -22,14 +22,16 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::util::encode;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
@@ -125,8 +127,8 @@ TEST_F(Rdata_DHCID_Test, toWireRenderer) {
vector<unsigned char> data;
UnitTestUtil::readWireData("rdata_dhcid_toWire", data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(Rdata_DHCID_Test, toWireBuffer) {
@@ -134,8 +136,8 @@ TEST_F(Rdata_DHCID_Test, toWireBuffer) {
vector<unsigned char> data;
UnitTestUtil::readWireData("rdata_dhcid_toWire", data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, obuffer.getData(),
- obuffer.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(Rdata_DHCID_Test, toText) {
diff --git a/src/lib/dns/tests/rdata_dname_unittest.cc b/src/lib/dns/tests/rdata_dname_unittest.cc
index 7209e36e61..9e13a168ca 100644
--- a/src/lib/dns/tests/rdata_dname_unittest.cc
+++ b/src/lib/dns/tests/rdata_dname_unittest.cc
@@ -24,12 +24,14 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class Rdata_DNAME_Test : public RdataTest {
@@ -117,20 +119,18 @@ TEST_F(Rdata_DNAME_Test, createFromLexer) {
TEST_F(Rdata_DNAME_Test, toWireBuffer) {
rdata_dname.toWire(obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- obuffer.getData(), obuffer.getLength(),
- wiredata_dname, sizeof(wiredata_dname));
+ matchWireData(wiredata_dname, sizeof(wiredata_dname),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(Rdata_DNAME_Test, toWireRenderer) {
rdata_dname.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- wiredata_dname, sizeof(wiredata_dname));
+ matchWireData(wiredata_dname, sizeof(wiredata_dname),
+ renderer.getData(), renderer.getLength());
+
rdata_dname2.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- wiredata_dname2, sizeof(wiredata_dname2));
+ matchWireData(wiredata_dname2, sizeof(wiredata_dname2),
+ renderer.getData(), renderer.getLength());
}
TEST_F(Rdata_DNAME_Test, toText) {
diff --git a/src/lib/dns/tests/rdata_dnskey_unittest.cc b/src/lib/dns/tests/rdata_dnskey_unittest.cc
index 872dc2af95..0c77735d17 100644
--- a/src/lib/dns/tests/rdata_dnskey_unittest.cc
+++ b/src/lib/dns/tests/rdata_dnskey_unittest.cc
@@ -27,13 +27,15 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class Rdata_DNSKEY_Test : public RdataTest {
@@ -155,9 +157,9 @@ TEST_F(Rdata_DNSKEY_Test, toWireRenderer) {
vector<unsigned char> data;
UnitTestUtil::readWireData("rdata_dnskey_fromWire.wire", data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- static_cast<const uint8_t *>(renderer.getData()) + 2,
- renderer.getLength() - 2, &data[2], data.size() - 2);
+ matchWireData(&data[2], data.size() - 2,
+ static_cast<const uint8_t *>(renderer.getData()) + 2,
+ renderer.getLength() - 2);
}
TEST_F(Rdata_DNSKEY_Test, toWireBuffer) {
@@ -165,9 +167,8 @@ TEST_F(Rdata_DNSKEY_Test, toWireBuffer) {
vector<unsigned char> data;
UnitTestUtil::readWireData("rdata_dnskey_fromWire.wire", data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- obuffer.getData(), obuffer.getLength(),
- &data[2], data.size() - 2);
+ matchWireData(&data[2], data.size() - 2,
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(Rdata_DNSKEY_Test, createFromWire) {
diff --git a/src/lib/dns/tests/rdata_ds_like_unittest.cc b/src/lib/dns/tests/rdata_ds_like_unittest.cc
index ae6a360f5b..e278f1ffcb 100644
--- a/src/lib/dns/tests/rdata_ds_like_unittest.cc
+++ b/src/lib/dns/tests/rdata_ds_like_unittest.cc
@@ -26,12 +26,14 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
// hacks to make templates work
@@ -148,11 +150,9 @@ TYPED_TEST(Rdata_DS_LIKE_Test, toWireRenderer) {
vector<unsigned char> data;
UnitTestUtil::readWireData("rdata_ds_fromWire", data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- static_cast<const uint8_t*>
- (this->renderer.getData()) + 2,
- this->renderer.getLength() - 2,
- &data[2], data.size() - 2);
+ matchWireData(&data[2], data.size() - 2,
+ static_cast<const uint8_t*>(this->renderer.getData()) + 2,
+ this->renderer.getLength() - 2);
}
TYPED_TEST(Rdata_DS_LIKE_Test, toWireBuffer) {
diff --git a/src/lib/dns/tests/rdata_hinfo_unittest.cc b/src/lib/dns/tests/rdata_hinfo_unittest.cc
index 7be2cb6026..887848e2b2 100644
--- a/src/lib/dns/tests/rdata_hinfo_unittest.cc
+++ b/src/lib/dns/tests/rdata_hinfo_unittest.cc
@@ -24,13 +24,15 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
using namespace isc::dns::rdata::generic;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class Rdata_HINFO_Test : public RdataTest {
@@ -113,19 +115,18 @@ TEST_F(Rdata_HINFO_Test, toText) {
TEST_F(Rdata_HINFO_Test, toWire) {
HINFO hinfo(hinfo_str);
- hinfo.toWire(obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, obuffer.getData(),
- obuffer.getLength(), hinfo_rdata, sizeof(hinfo_rdata));
+ hinfo.toWire(obuffer);
+ matchWireData(hinfo_rdata, sizeof (hinfo_rdata),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(Rdata_HINFO_Test, toWireRenderer) {
HINFO hinfo(hinfo_str);
hinfo.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), hinfo_rdata,
- sizeof(hinfo_rdata));
+ matchWireData(hinfo_rdata, sizeof (hinfo_rdata),
+ renderer.getData(), renderer.getLength());
}
TEST_F(Rdata_HINFO_Test, compare) {
diff --git a/src/lib/dns/tests/rdata_in_a_unittest.cc b/src/lib/dns/tests/rdata_in_a_unittest.cc
index 3f65641f50..c940075409 100644
--- a/src/lib/dns/tests/rdata_in_a_unittest.cc
+++ b/src/lib/dns/tests/rdata_in_a_unittest.cc
@@ -27,17 +27,19 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
#include <sstream>
#include <arpa/inet.h>
#include <sys/socket.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class Rdata_IN_A_Test : public RdataTest {
@@ -121,16 +123,14 @@ TEST_F(Rdata_IN_A_Test, createFromWire) {
TEST_F(Rdata_IN_A_Test, toWireBuffer) {
rdata_in_a.toWire(obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- obuffer.getData(), obuffer.getLength(),
- wiredata_in_a, sizeof(wiredata_in_a));
+ matchWireData(wiredata_in_a, sizeof (wiredata_in_a),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(Rdata_IN_A_Test, toWireRenderer) {
rdata_in_a.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- wiredata_in_a, sizeof(wiredata_in_a));
+ matchWireData(wiredata_in_a, sizeof (wiredata_in_a),
+ renderer.getData(), renderer.getLength());
}
TEST_F(Rdata_IN_A_Test, toText) {
diff --git a/src/lib/dns/tests/rdata_in_aaaa_unittest.cc b/src/lib/dns/tests/rdata_in_aaaa_unittest.cc
index 82f75a897c..ff92d07d87 100644
--- a/src/lib/dns/tests/rdata_in_aaaa_unittest.cc
+++ b/src/lib/dns/tests/rdata_in_aaaa_unittest.cc
@@ -24,12 +24,14 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class Rdata_IN_AAAA_Test : public RdataTest {
@@ -117,16 +119,14 @@ TEST_F(Rdata_IN_AAAA_Test, createFromLexer) {
TEST_F(Rdata_IN_AAAA_Test, toWireBuffer) {
rdata_in_aaaa.toWire(obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- obuffer.getData(), obuffer.getLength(),
- wiredata_in_aaaa, sizeof(wiredata_in_aaaa));
+ matchWireData(wiredata_in_aaaa, sizeof (wiredata_in_aaaa),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(Rdata_IN_AAAA_Test, toWireRenderer) {
rdata_in_aaaa.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- wiredata_in_aaaa, sizeof(wiredata_in_aaaa));
+ matchWireData(wiredata_in_aaaa, sizeof (wiredata_in_aaaa),
+ renderer.getData(), renderer.getLength());
}
TEST_F(Rdata_IN_AAAA_Test, toText) {
diff --git a/src/lib/dns/tests/rdata_minfo_unittest.cc b/src/lib/dns/tests/rdata_minfo_unittest.cc
index 3ce6a6cd49..8addb29c69 100644
--- a/src/lib/dns/tests/rdata_minfo_unittest.cc
+++ b/src/lib/dns/tests/rdata_minfo_unittest.cc
@@ -26,12 +26,14 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::util;
using namespace isc::dns;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class Rdata_MINFO_Test : public RdataTest {
@@ -177,33 +179,30 @@ TEST_F(Rdata_MINFO_Test, toWireBuffer) {
rdata_minfo.toWire(obuffer);
vector<unsigned char> data;
UnitTestUtil::readWireData("rdata_minfo_toWireUncompressed1.wire", data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- static_cast<const uint8_t *>(obuffer.getData()),
- obuffer.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ obuffer.getData(), obuffer.getLength());
obuffer.clear();
rdata_minfo2.toWire(obuffer);
vector<unsigned char> data2;
UnitTestUtil::readWireData("rdata_minfo_toWireUncompressed2.wire", data2);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- static_cast<const uint8_t *>(obuffer.getData()),
- obuffer.getLength(), &data2[0], data2.size());
+ matchWireData(&data2[0], data2.size(),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(Rdata_MINFO_Test, toWireRenderer) {
rdata_minfo.toWire(renderer);
vector<unsigned char> data;
UnitTestUtil::readWireData("rdata_minfo_toWire1.wire", data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- static_cast<const uint8_t *>(renderer.getData()),
- renderer.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ renderer.getData(), renderer.getLength());
+
renderer.clear();
rdata_minfo2.toWire(renderer);
vector<unsigned char> data2;
UnitTestUtil::readWireData("rdata_minfo_toWire2.wire", data2);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- static_cast<const uint8_t *>(renderer.getData()),
- renderer.getLength(), &data2[0], data2.size());
+ matchWireData(&data2[0], data2.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(Rdata_MINFO_Test, toText) {
diff --git a/src/lib/dns/tests/rdata_mx_unittest.cc b/src/lib/dns/tests/rdata_mx_unittest.cc
index 6e4eaba41f..926374aae0 100644
--- a/src/lib/dns/tests/rdata_mx_unittest.cc
+++ b/src/lib/dns/tests/rdata_mx_unittest.cc
@@ -23,12 +23,14 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class Rdata_MX_Test : public RdataTest {
@@ -101,8 +103,8 @@ TEST_F(Rdata_MX_Test, toWireRenderer) {
vector<unsigned char> data;
UnitTestUtil::readWireData("rdata_mx_toWire1", data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(Rdata_MX_Test, toWireBuffer) {
@@ -111,8 +113,8 @@ TEST_F(Rdata_MX_Test, toWireBuffer) {
vector<unsigned char> data;
UnitTestUtil::readWireData("rdata_mx_toWire2", data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, obuffer.getData(),
- obuffer.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(Rdata_MX_Test, toText) {
diff --git a/src/lib/dns/tests/rdata_naptr_unittest.cc b/src/lib/dns/tests/rdata_naptr_unittest.cc
index d828e73ea2..982bf76505 100644
--- a/src/lib/dns/tests/rdata_naptr_unittest.cc
+++ b/src/lib/dns/tests/rdata_naptr_unittest.cc
@@ -24,13 +24,15 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
using namespace isc::dns::rdata::generic;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class Rdata_NAPTR_Test : public RdataTest {
@@ -165,19 +167,18 @@ TEST_F(Rdata_NAPTR_Test, createFromLexer) {
TEST_F(Rdata_NAPTR_Test, toWire) {
NAPTR naptr(naptr_str);
- naptr.toWire(obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, obuffer.getData(),
- obuffer.getLength(), naptr_rdata, sizeof(naptr_rdata));
+ naptr.toWire(obuffer);
+ matchWireData(naptr_rdata, sizeof(naptr_rdata),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(Rdata_NAPTR_Test, toWireRenderer) {
NAPTR naptr(naptr_str);
naptr.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), naptr_rdata,
- sizeof(naptr_rdata));
+ matchWireData(naptr_rdata, sizeof(naptr_rdata),
+ renderer.getData(), renderer.getLength());
}
TEST_F(Rdata_NAPTR_Test, toText) {
diff --git a/src/lib/dns/tests/rdata_ns_unittest.cc b/src/lib/dns/tests/rdata_ns_unittest.cc
index 53eb6700c3..305149c481 100644
--- a/src/lib/dns/tests/rdata_ns_unittest.cc
+++ b/src/lib/dns/tests/rdata_ns_unittest.cc
@@ -24,12 +24,14 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class Rdata_NS_Test : public RdataTest {
@@ -118,20 +120,18 @@ TEST_F(Rdata_NS_Test, createFromLexer) {
TEST_F(Rdata_NS_Test, toWireBuffer) {
rdata_ns.toWire(obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- obuffer.getData(), obuffer.getLength(),
- wiredata_ns, sizeof(wiredata_ns));
+ matchWireData(wiredata_ns, sizeof(wiredata_ns),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(Rdata_NS_Test, toWireRenderer) {
rdata_ns.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- wiredata_ns, sizeof(wiredata_ns));
+ matchWireData(wiredata_ns, sizeof(wiredata_ns),
+ renderer.getData(), renderer.getLength());
+
rdata_ns2.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- wiredata_ns2, sizeof(wiredata_ns2));
+ matchWireData(wiredata_ns2, sizeof(wiredata_ns2),
+ renderer.getData(), renderer.getLength());
}
TEST_F(Rdata_NS_Test, toText) {
diff --git a/src/lib/dns/tests/rdata_nsec3param_like_unittest.cc b/src/lib/dns/tests/rdata_nsec3param_like_unittest.cc
index 23d6d0ed68..e7962dd080 100644
--- a/src/lib/dns/tests/rdata_nsec3param_like_unittest.cc
+++ b/src/lib/dns/tests/rdata_nsec3param_like_unittest.cc
@@ -22,14 +22,16 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
#include <string>
#include <vector>
using namespace std;
-using isc::UnitTestUtil;
using namespace isc::dns;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
@@ -230,8 +232,8 @@ toWireCheck(RRType rrtype, OUTPUT_TYPE& output, const string& data_file) {
output.clear();
output.writeUint16(rdlen);
createRdata(rrtype, RRClass::IN(), buffer, rdlen)->toWire(output);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, output.getData(),
- output.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ output.getData(), output.getLength());
}
TYPED_TEST(NSEC3PARAMLikeTest, toWire) {
diff --git a/src/lib/dns/tests/rdata_nsec3param_unittest.cc b/src/lib/dns/tests/rdata_nsec3param_unittest.cc
index 4fccbf311b..9f121cc928 100644
--- a/src/lib/dns/tests/rdata_nsec3param_unittest.cc
+++ b/src/lib/dns/tests/rdata_nsec3param_unittest.cc
@@ -27,13 +27,15 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class Rdata_NSEC3PARAM_Test : public RdataTest {
@@ -170,9 +172,9 @@ TEST_F(Rdata_NSEC3PARAM_Test, toWireRenderer) {
vector<unsigned char> data;
UnitTestUtil::readWireData("rdata_nsec3param_fromWire1", data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- static_cast<const uint8_t *>(renderer.getData()) + 2,
- renderer.getLength() - 2, &data[2], data.size() - 2);
+ matchWireData(&data[2], data.size() - 2,
+ static_cast<const uint8_t *>(renderer.getData()) + 2,
+ renderer.getLength() - 2);
}
TEST_F(Rdata_NSEC3PARAM_Test, toWireBuffer) {
@@ -180,9 +182,8 @@ TEST_F(Rdata_NSEC3PARAM_Test, toWireBuffer) {
vector<unsigned char> data;
UnitTestUtil::readWireData("rdata_nsec3param_fromWire1", data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- obuffer.getData(), obuffer.getLength(),
- &data[2], data.size() - 2);
+ matchWireData(&data[2], data.size() - 2,
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(Rdata_NSEC3PARAM_Test, getHashAlg) {
diff --git a/src/lib/dns/tests/rdata_nsec_unittest.cc b/src/lib/dns/tests/rdata_nsec_unittest.cc
index 810e2cc3d0..dcbc1f312f 100644
--- a/src/lib/dns/tests/rdata_nsec_unittest.cc
+++ b/src/lib/dns/tests/rdata_nsec_unittest.cc
@@ -26,12 +26,14 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class Rdata_NSEC_Test : public RdataTest {
@@ -90,9 +92,9 @@ TEST_F(Rdata_NSEC_Test, toWireRenderer_NSEC) {
vector<unsigned char> data;
UnitTestUtil::readWireData("rdata_nsec_fromWire1", data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- static_cast<const uint8_t *>(renderer.getData()) + 2,
- renderer.getLength() - 2, &data[2], data.size() - 2);
+ matchWireData(&data[2], data.size() - 2,
+ static_cast<const uint8_t *>(renderer.getData()) + 2,
+ renderer.getLength() - 2);
}
TEST_F(Rdata_NSEC_Test, toWireBuffer_NSEC) {
diff --git a/src/lib/dns/tests/rdata_nsecbitmap_unittest.cc b/src/lib/dns/tests/rdata_nsecbitmap_unittest.cc
index fbb256a151..c057b58004 100644
--- a/src/lib/dns/tests/rdata_nsecbitmap_unittest.cc
+++ b/src/lib/dns/tests/rdata_nsecbitmap_unittest.cc
@@ -23,6 +23,7 @@
#include <gtest/gtest.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
#include <boost/lexical_cast.hpp>
@@ -30,10 +31,11 @@
#include <vector>
using namespace std;
-using boost::lexical_cast;
-using isc::UnitTestUtil;
using namespace isc::dns;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
+using boost::lexical_cast;
namespace {
@@ -253,16 +255,16 @@ TEST_F(NSEC3BitmapTest, emptyMap) {
OutputBuffer obuffer(0);
obuffer.writeUint16(rdlen);
empty_nsec3.toWire(obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, obuffer.getData(),
- obuffer.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ obuffer.getData(), obuffer.getLength());
// Same for MessageRenderer.
obuffer.clear();
MessageRenderer renderer;
renderer.writeUint16(rdlen);
empty_nsec3.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ renderer.getData(), renderer.getLength());
}
}
diff --git a/src/lib/dns/tests/rdata_ptr_unittest.cc b/src/lib/dns/tests/rdata_ptr_unittest.cc
index 5d6d37db91..d6a99f77f9 100644
--- a/src/lib/dns/tests/rdata_ptr_unittest.cc
+++ b/src/lib/dns/tests/rdata_ptr_unittest.cc
@@ -24,12 +24,14 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
//
// This test currently simply copies the NS RDATA tests.
@@ -118,20 +120,18 @@ TEST_F(Rdata_PTR_Test, createFromLexer) {
TEST_F(Rdata_PTR_Test, toWireBuffer) {
rdata_ptr.toWire(obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- obuffer.getData(), obuffer.getLength(),
- wiredata_ptr, sizeof(wiredata_ptr));
+ matchWireData(wiredata_ptr, sizeof(wiredata_ptr),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(Rdata_PTR_Test, toWireRenderer) {
rdata_ptr.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- wiredata_ptr, sizeof(wiredata_ptr));
+ matchWireData(wiredata_ptr, sizeof(wiredata_ptr),
+ renderer.getData(), renderer.getLength());
+
rdata_ptr2.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- wiredata_ptr2, sizeof(wiredata_ptr2));
+ matchWireData(wiredata_ptr2, sizeof(wiredata_ptr2),
+ renderer.getData(), renderer.getLength());
}
TEST_F(Rdata_PTR_Test, toText) {
diff --git a/src/lib/dns/tests/rdata_rp_unittest.cc b/src/lib/dns/tests/rdata_rp_unittest.cc
index 38bec04211..d8de028926 100644
--- a/src/lib/dns/tests/rdata_rp_unittest.cc
+++ b/src/lib/dns/tests/rdata_rp_unittest.cc
@@ -22,12 +22,14 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::util;
using namespace isc::dns;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class Rdata_RP_Test : public RdataTest {
@@ -157,9 +159,8 @@ TEST_F(Rdata_RP_Test, toWireBuffer) {
rdata_rp.toWire(obuffer);
// then compare them
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- obuffer.getData(), obuffer.getLength(),
- &expected_wire[0], expected_wire.size());
+ matchWireData(&expected_wire[0], expected_wire.size(),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(Rdata_RP_Test, toWireRenderer) {
@@ -172,9 +173,8 @@ TEST_F(Rdata_RP_Test, toWireRenderer) {
renderer.writeName(Name("a.example.com"));
renderer.writeName(Name("b.example.net"));
generic::RP(mailbox_name, Name("rp-text.example.net")).toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- &expected_wire[0], expected_wire.size());
+ matchWireData(&expected_wire[0], expected_wire.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(Rdata_RP_Test, toText) {
diff --git a/src/lib/dns/tests/rdata_soa_unittest.cc b/src/lib/dns/tests/rdata_soa_unittest.cc
index d919329c32..808ff8fba1 100644
--- a/src/lib/dns/tests/rdata_soa_unittest.cc
+++ b/src/lib/dns/tests/rdata_soa_unittest.cc
@@ -23,12 +23,14 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class Rdata_SOA_Test : public RdataTest {
@@ -180,9 +182,9 @@ TEST_F(Rdata_SOA_Test, toWireRenderer) {
vector<unsigned char> data;
UnitTestUtil::readWireData("rdata_soa_fromWire", data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- static_cast<const uint8_t *>(renderer.getData()) + 2,
- renderer.getLength() - 2, &data[2], data.size() - 2);
+ matchWireData(&data[2], data.size() - 2,
+ static_cast<const uint8_t *>(renderer.getData()) + 2,
+ renderer.getLength() - 2);
}
TEST_F(Rdata_SOA_Test, toWireBuffer) {
@@ -190,9 +192,9 @@ TEST_F(Rdata_SOA_Test, toWireBuffer) {
rdata_soa.toWire(obuffer);
vector<unsigned char> data;
UnitTestUtil::readWireData("rdata_soa_toWireUncompressed.wire", data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- static_cast<const uint8_t *>(obuffer.getData()) + 2,
- obuffer.getLength() - 2, &data[2], data.size() - 2);
+ matchWireData(&data[2], data.size() - 2,
+ static_cast<const uint8_t *>(obuffer.getData()) + 2,
+ obuffer.getLength() - 2);
}
TEST_F(Rdata_SOA_Test, toText) {
diff --git a/src/lib/dns/tests/rdata_srv_unittest.cc b/src/lib/dns/tests/rdata_srv_unittest.cc
index 6ca0c7fe7a..8608c48710 100644
--- a/src/lib/dns/tests/rdata_srv_unittest.cc
+++ b/src/lib/dns/tests/rdata_srv_unittest.cc
@@ -24,12 +24,14 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class Rdata_SRV_Test : public RdataTest {
@@ -159,26 +161,24 @@ TEST_F(Rdata_SRV_Test, createFromLexer) {
TEST_F(Rdata_SRV_Test, toWireBuffer) {
rdata_srv.toWire(obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- obuffer.getData(), obuffer.getLength(),
- wiredata_srv, sizeof(wiredata_srv));
+ matchWireData(wiredata_srv, sizeof(wiredata_srv),
+ obuffer.getData(), obuffer.getLength());
+
obuffer.clear();
rdata_srv2.toWire(obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- obuffer.getData(), obuffer.getLength(),
- wiredata_srv2, sizeof(wiredata_srv2));
+ matchWireData(wiredata_srv2, sizeof(wiredata_srv2),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(Rdata_SRV_Test, toWireRenderer) {
rdata_srv.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- wiredata_srv, sizeof(wiredata_srv));
+ matchWireData(wiredata_srv, sizeof(wiredata_srv),
+ renderer.getData(), renderer.getLength());
+
renderer.clear();
rdata_srv2.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- wiredata_srv2, sizeof(wiredata_srv2));
+ matchWireData(wiredata_srv2, sizeof(wiredata_srv2),
+ renderer.getData(), renderer.getLength());
}
TEST_F(Rdata_SRV_Test, toText) {
diff --git a/src/lib/dns/tests/rdata_sshfp_unittest.cc b/src/lib/dns/tests/rdata_sshfp_unittest.cc
index b85dfa5ebe..99ce810ab5 100644
--- a/src/lib/dns/tests/rdata_sshfp_unittest.cc
+++ b/src/lib/dns/tests/rdata_sshfp_unittest.cc
@@ -26,14 +26,17 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
+
#include <boost/algorithm/string.hpp>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class Rdata_SSHFP_Test : public RdataTest {
@@ -234,10 +237,8 @@ TEST_F(Rdata_SSHFP_Test, toWire) {
EXPECT_EQ(22, this->obuffer.getLength());
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- this->obuffer.getData(),
- this->obuffer.getLength(),
- rdata_sshfp_wiredata, sizeof(rdata_sshfp_wiredata));
+ matchWireData(rdata_sshfp_wiredata, sizeof(rdata_sshfp_wiredata),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(Rdata_SSHFP_Test, compare) {
@@ -280,10 +281,8 @@ TEST_F(Rdata_SSHFP_Test, emptyFingerprintFromWire) {
EXPECT_EQ(2, this->obuffer.getLength());
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- this->obuffer.getData(),
- this->obuffer.getLength(),
- rdf_wiredata, sizeof(rdf_wiredata));
+ matchWireData(rdf_wiredata, sizeof(rdf_wiredata),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(Rdata_SSHFP_Test, emptyFingerprintFromString) {
@@ -304,9 +303,7 @@ TEST_F(Rdata_SSHFP_Test, emptyFingerprintFromString) {
EXPECT_EQ(2, this->obuffer.getLength());
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- this->obuffer.getData(),
- this->obuffer.getLength(),
- rdata_sshfp2_wiredata, sizeof(rdata_sshfp2_wiredata));
+ matchWireData(rdata_sshfp2_wiredata, sizeof(rdata_sshfp2_wiredata),
+ obuffer.getData(), obuffer.getLength());
}
}
diff --git a/src/lib/dns/tests/rdata_tsig_unittest.cc b/src/lib/dns/tests/rdata_tsig_unittest.cc
index 270a1b284a..ab8fa273bf 100644
--- a/src/lib/dns/tests/rdata_tsig_unittest.cc
+++ b/src/lib/dns/tests/rdata_tsig_unittest.cc
@@ -29,32 +29,34 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class Rdata_TSIG_Test : public RdataTest {
protected:
Rdata_TSIG_Test() :
- // no MAC or Other Data
+ // no MAC or Other Data
valid_text1("hmac-md5.sig-alg.reg.int. 1286779327 300 "
"0 16020 BADKEY 0"),
- // MAC but no Other Data
+ // MAC but no Other Data
valid_text2("hmac-sha256. 1286779327 300 12 "
"FAKEFAKEFAKEFAKE 16020 BADSIG 0"),
- // MAC and Other Data
+ // MAC and Other Data
valid_text3("hmac-sha1. 1286779327 300 12 "
"FAKEFAKEFAKEFAKE 16020 BADTIME 6 FAKEFAKE"),
- // MAC and Other Data (with Error that doesn't expect Other Data)
+ // MAC and Other Data (with Error that doesn't expect Other Data)
valid_text4("hmac-sha1. 1286779327 300 12 "
"FAKEFAKEFAKEFAKE 16020 BADSIG 6 FAKEFAKE"),
- // numeric error code
+ // numeric error code
valid_text5("hmac-sha256. 1286779327 300 12 "
"FAKEFAKEFAKEFAKE 16020 2845 0"),
rdata_tsig(valid_text1)
@@ -204,9 +206,8 @@ fromWireCommonChecks(const any::TSIG& tsig) {
EXPECT_EQ(300, tsig.getFudge());
vector<uint8_t> expect_mac(32, 'x');
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- &expect_mac[0], expect_mac.size(),
- tsig.getMAC(), tsig.getMACSize());
+ matchWireData(&expect_mac[0], expect_mac.size(),
+ tsig.getMAC(), tsig.getMACSize());
EXPECT_EQ(2845, tsig.getOriginalID());
@@ -234,9 +235,8 @@ TEST_F(Rdata_TSIG_Test, createFromWireWithOtherData) {
expect_data[3] = ((otherdata >> 16) & 0xff);
expect_data[4] = ((otherdata >> 8) & 0xff);
expect_data[5] = (otherdata & 0xff);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- &expect_data[0], expect_data.size(),
- tsig.getOtherData(), tsig.getOtherLen());
+ matchWireData(&expect_data[0], expect_data.size(),
+ tsig.getOtherData(), tsig.getOtherLen());
}
TEST_F(Rdata_TSIG_Test, createFromWireWithoutMAC) {
@@ -351,27 +351,24 @@ Rdata_TSIG_Test::toWireCommonChecks(Output& output) const {
// read the expected wire format data and trim the RDLEN part.
UnitTestUtil::readWireData("rdata_tsig_toWire1.wire", expect_data);
expect_data.erase(expect_data.begin(), expect_data.begin() + 2);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- &expect_data[0], expect_data.size(),
- output.getData(), output.getLength());
+ matchWireData(&expect_data[0], expect_data.size(),
+ output.getData(), output.getLength());
expect_data.clear();
output.clear();
any::TSIG(valid_text2).toWire(output);
UnitTestUtil::readWireData("rdata_tsig_toWire2.wire", expect_data);
expect_data.erase(expect_data.begin(), expect_data.begin() + 2);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- &expect_data[0], expect_data.size(),
- output.getData(), output.getLength());
+ matchWireData(&expect_data[0], expect_data.size(),
+ output.getData(), output.getLength());
expect_data.clear();
output.clear();
any::TSIG(valid_text3).toWire(output);
UnitTestUtil::readWireData("rdata_tsig_toWire3.wire", expect_data);
expect_data.erase(expect_data.begin(), expect_data.begin() + 2);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- &expect_data[0], expect_data.size(),
- output.getData(), output.getLength());
+ matchWireData(&expect_data[0], expect_data.size(),
+ output.getData(), output.getLength());
}
TEST_F(Rdata_TSIG_Test, toWireBuffer) {
@@ -388,9 +385,8 @@ TEST_F(Rdata_TSIG_Test, toWireRenderer) {
renderer.writeUint16(42); // RDLEN
rdata_tsig.toWire(renderer);
UnitTestUtil::readWireData("rdata_tsig_toWire4.wire", expect_data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- &expect_data[0], expect_data.size(),
- renderer.getData(), renderer.getLength());
+ matchWireData(&expect_data[0], expect_data.size(),
+ renderer.getData(), renderer.getLength());
// check algorithm can be used as a compression target.
expect_data.clear();
@@ -399,9 +395,8 @@ TEST_F(Rdata_TSIG_Test, toWireRenderer) {
rdata_tsig.toWire(renderer);
renderer.writeName(Name("hmac-md5.sig-alg.reg.int"));
UnitTestUtil::readWireData("rdata_tsig_toWire5.wire", expect_data);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- &expect_data[0], expect_data.size(),
- renderer.getData(), renderer.getLength());
+ matchWireData(&expect_data[0], expect_data.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(Rdata_TSIG_Test, toText) {
diff --git a/src/lib/dns/tests/rdata_txt_like_unittest.cc b/src/lib/dns/tests/rdata_txt_like_unittest.cc
index cb3c44d889..573a4a1924 100644
--- a/src/lib/dns/tests/rdata_txt_like_unittest.cc
+++ b/src/lib/dns/tests/rdata_txt_like_unittest.cc
@@ -21,6 +21,8 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
+
#include <gtest/gtest.h>
#include <boost/bind.hpp>
@@ -29,11 +31,12 @@
#include <sstream>
#include <vector>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
@@ -133,31 +136,31 @@ TYPED_TEST(Rdata_TXT_LIKE_Test, createFromText) {
// Null character-string.
this->obuffer.clear();
TypeParam(string("\"\"")).toWire(this->obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- this->obuffer.getData(), this->obuffer.getLength(),
- wiredata_nulltxt, sizeof(wiredata_nulltxt));
+ matchWireData(wiredata_nulltxt, sizeof(wiredata_nulltxt),
+ this->obuffer.getData(), this->obuffer.getLength());
+
this->obuffer.clear();
TypeParam(this->lexer, NULL, MasterLoader::MANY_ERRORS, this->loader_cb).
toWire(this->obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- this->obuffer.getData(), this->obuffer.getLength(),
- wiredata_nulltxt, sizeof(wiredata_nulltxt));
+ matchWireData(wiredata_nulltxt, sizeof(wiredata_nulltxt),
+ this->obuffer.getData(), this->obuffer.getLength());
+
EXPECT_EQ(MasterToken::END_OF_LINE, this->lexer.getNextToken().getType());
// Longest possible character-string.
this->obuffer.clear();
TypeParam(string(255, 'a')).toWire(this->obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- this->obuffer.getData(), this->obuffer.getLength(),
- &this->wiredata_longesttxt[0],
- this->wiredata_longesttxt.size());
+ matchWireData(&this->wiredata_longesttxt[0],
+ this->wiredata_longesttxt.size(),
+ this->obuffer.getData(), this->obuffer.getLength());
+
this->obuffer.clear();
TypeParam(this->lexer, NULL, MasterLoader::MANY_ERRORS, this->loader_cb).
toWire(this->obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- this->obuffer.getData(), this->obuffer.getLength(),
- &this->wiredata_longesttxt[0],
- this->wiredata_longesttxt.size());
+ matchWireData(&this->wiredata_longesttxt[0],
+ this->wiredata_longesttxt.size(),
+ this->obuffer.getData(), this->obuffer.getLength());
+
EXPECT_EQ(MasterToken::END_OF_LINE, this->lexer.getNextToken().getType());
// Too long text for a valid character-string.
@@ -269,10 +272,8 @@ TYPED_TEST(Rdata_TXT_LIKE_Test, createFromWire) {
sizeof(wiredata_txt_like));
expected_data.insert(expected_data.end(), wiredata_txt_like,
wiredata_txt_like + sizeof(wiredata_txt_like));
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- this->obuffer.getData(),
- this->obuffer.getLength(),
- &expected_data[0], expected_data.size());
+ matchWireData(&expected_data[0], expected_data.size(),
+ this->obuffer.getData(), this->obuffer.getLength());
// Largest length of data. There's nothing special, but should be
// constructed safely, and the content should be identical to the original
@@ -284,11 +285,8 @@ TYPED_TEST(Rdata_TXT_LIKE_Test, createFromWire) {
TypeParam largest_txt_like(ibuffer, largest_txt_like_data.size());
this->obuffer.clear();
largest_txt_like.toWire(this->obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- this->obuffer.getData(),
- this->obuffer.getLength(),
- &largest_txt_like_data[0],
- largest_txt_like_data.size());
+ matchWireData(&largest_txt_like_data[0], largest_txt_like_data.size(),
+ this->obuffer.getData(), this->obuffer.getLength());
// rdlen parameter is out of range. This is a rare event because we'd
// normally call the constructor via a polymorphic wrapper, where the
@@ -316,18 +314,14 @@ TYPED_TEST(Rdata_TXT_LIKE_Test, createFromLexer) {
TYPED_TEST(Rdata_TXT_LIKE_Test, toWireBuffer) {
this->rdata_txt_like.toWire(this->obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- this->obuffer.getData(),
- this->obuffer.getLength(),
- wiredata_txt_like, sizeof(wiredata_txt_like));
+ matchWireData(wiredata_txt_like, sizeof(wiredata_txt_like),
+ this->obuffer.getData(), this->obuffer.getLength());
}
TYPED_TEST(Rdata_TXT_LIKE_Test, toWireRenderer) {
this->rdata_txt_like.toWire(this->renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- this->renderer.getData(),
- this->renderer.getLength(),
- wiredata_txt_like, sizeof(wiredata_txt_like));
+ matchWireData(wiredata_txt_like, sizeof(wiredata_txt_like),
+ this->renderer.getData(), this->renderer.getLength());
}
TYPED_TEST(Rdata_TXT_LIKE_Test, toText) {
diff --git a/src/lib/dns/tests/rdata_unittest.cc b/src/lib/dns/tests/rdata_unittest.cc
index 3839fbd24f..9739325014 100644
--- a/src/lib/dns/tests/rdata_unittest.cc
+++ b/src/lib/dns/tests/rdata_unittest.cc
@@ -28,14 +28,17 @@
#include <dns/tests/unittest_util.h>
#include <dns/tests/rdata_unittest.h>
+#include <util/unittests/wiredata.h>
+
#include <boost/bind.hpp>
#include <boost/lexical_cast.hpp>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace isc {
namespace dns {
@@ -393,16 +396,14 @@ TEST_F(Rdata_Unknown_Test, toText) {
TEST_F(Rdata_Unknown_Test, toWireBuffer) {
rdata_unknown.toWire(obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- obuffer.getData(), obuffer.getLength(),
- wiredata_unknown, sizeof(wiredata_unknown));
+ matchWireData(wiredata_unknown, sizeof(wiredata_unknown),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(Rdata_Unknown_Test, toWireRenderer) {
rdata_unknown.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- wiredata_unknown, sizeof(wiredata_unknown));
+ matchWireData(wiredata_unknown, sizeof(wiredata_unknown),
+ renderer.getData(), renderer.getLength());
}
TEST_F(Rdata_Unknown_Test, compare) {
diff --git a/src/lib/dns/tests/rdatafields_unittest.cc b/src/lib/dns/tests/rdatafields_unittest.cc
index ef83ed4b26..a6bead79bb 100644
--- a/src/lib/dns/tests/rdatafields_unittest.cc
+++ b/src/lib/dns/tests/rdatafields_unittest.cc
@@ -24,14 +24,17 @@
#include <dns/rdatafields.h>
#include <dns/tests/unittest_util.h>
+#include <util/unittests/wiredata.h>
+
#include <gtest/gtest.h>
-using isc::UnitTestUtil;
using namespace std;
using namespace isc::dns;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
using isc::util::OutputBuffer;
using isc::util::InputBuffer;
+using isc::util::unittests::matchWireData;
namespace {
class RdataFieldsTest : public ::testing::Test {
@@ -67,23 +70,21 @@ RdataFieldsTest::constructCommonTests(const RdataFields& fields,
const uint8_t* const expected_data,
const size_t expected_data_len)
{
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, expected_data,
- expected_data_len, fields.getData(),
- fields.getDataLength());
+ matchWireData(expected_data, expected_data_len,
+ fields.getData(), fields.getDataLength());
+
EXPECT_EQ(sizeof(RdataFields::FieldSpec), fields.getFieldSpecDataSize());
EXPECT_EQ(1, fields.getFieldCount());
EXPECT_EQ(RdataFields::DATA, fields.getFieldSpec(0).type);
EXPECT_EQ(4, fields.getFieldSpec(0).len);
fields.toWire(obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, expected_data,
- expected_data_len, obuffer.getData(),
- obuffer.getLength());
+ matchWireData(expected_data, expected_data_len,
+ obuffer.getData(), obuffer.getLength());
fields.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, expected_data,
- expected_data_len, renderer.getData(),
- renderer.getLength());
+ matchWireData(expected_data, expected_data_len,
+ renderer.getData(), renderer.getLength());
}
TEST_F(RdataFieldsTest, constructFromRdata) {
@@ -112,17 +113,15 @@ RdataFieldsTest::constructCommonTestsNS(const RdataFields& fields) {
UnitTestUtil::readWireData("rdatafields1.wire", expected_wire);
other_name.toWire(obuffer);
fields.toWire(obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, &expected_wire[0],
- expected_wire.size(), obuffer.getData(),
- obuffer.getLength());
+ matchWireData(&expected_wire[0], expected_wire.size(),
+ obuffer.getData(), obuffer.getLength());
expected_wire.clear();
UnitTestUtil::readWireData("rdatafields2.wire", expected_wire);
other_name.toWire(renderer);
fields.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, &expected_wire[0],
- expected_wire.size(), renderer.getData(),
- renderer.getLength());
+ matchWireData(&expected_wire[0], expected_wire.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(RdataFieldsTest, constructFromRdataNS) {
@@ -150,14 +149,12 @@ RdataFieldsTest::constructCommonTestsTXT(const RdataFields& fields) {
EXPECT_EQ(expected_wire.size(), fields.getFieldSpec(0).len);
fields.toWire(obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, &expected_wire[0],
- expected_wire.size(), obuffer.getData(),
- obuffer.getLength());
+ matchWireData(&expected_wire[0], expected_wire.size(),
+ obuffer.getData(), obuffer.getLength());
fields.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, &expected_wire[0],
- expected_wire.size(), renderer.getData(),
- renderer.getLength());
+ matchWireData(&expected_wire[0], expected_wire.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(RdataFieldsTest, constructFromRdataTXT) {
@@ -208,9 +205,8 @@ RdataFieldsTest::constructCommonTestsRRSIG(const RdataFields& fields) {
obuffer.writeUint16(fields.getDataLength());
fields.toWire(obuffer);
other_name.toWire(obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, &expected_wire[0],
- expected_wire.size(), obuffer.getData(),
- obuffer.getLength());
+ matchWireData(&expected_wire[0], expected_wire.size(),
+ obuffer.getData(), obuffer.getLength());
expected_wire.clear();
UnitTestUtil::readWireData("rdatafields6.wire", expected_wire);
@@ -218,9 +214,8 @@ RdataFieldsTest::constructCommonTestsRRSIG(const RdataFields& fields) {
renderer.writeUint16(fields.getDataLength());
fields.toWire(renderer); // the signer field won't be compressed
other_name.toWire(renderer); // but will be used as a compression target
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, &expected_wire[0],
- expected_wire.size(), renderer.getData(),
- renderer.getLength());
+ matchWireData(&expected_wire[0], expected_wire.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(RdataFieldsTest, constructFromRdataRRSIG) {
diff --git a/src/lib/dns/tests/rrclass_unittest.cc b/src/lib/dns/tests/rrclass_unittest.cc
index b79aedff5f..c20125e0b5 100644
--- a/src/lib/dns/tests/rrclass_unittest.cc
+++ b/src/lib/dns/tests/rrclass_unittest.cc
@@ -19,6 +19,7 @@
#include <dns/rrclass.h>
#include <dns/tests/unittest_util.h>
+#include <util/unittests/wiredata.h>
#include <boost/scoped_ptr.hpp>
@@ -27,6 +28,7 @@ using namespace isc;
using namespace isc::dns;
using namespace isc::util;
using boost::scoped_ptr;
+using isc::util::unittests::matchWireData;
namespace {
class RRClassTest : public ::testing::Test {
@@ -115,9 +117,8 @@ TEST_F(RRClassTest, toWireBuffer) {
rrclass_0x8000.toWire(obuffer);
rrclass_max.toWire(obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- obuffer.getData(), obuffer.getLength(),
- wiredata, sizeof(wiredata));
+ matchWireData(wiredata, sizeof (wiredata),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(RRClassTest, toWireRenderer) {
@@ -127,9 +128,8 @@ TEST_F(RRClassTest, toWireRenderer) {
rrclass_0x8000.toWire(renderer);
rrclass_max.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- wiredata, sizeof(wiredata));
+ matchWireData(wiredata, sizeof (wiredata),
+ renderer.getData(), renderer.getLength());
}
TEST_F(RRClassTest, wellKnownClasss) {
diff --git a/src/lib/dns/tests/rrset_unittest.cc b/src/lib/dns/tests/rrset_unittest.cc
index 0967fce46d..66621b9a15 100644
--- a/src/lib/dns/tests/rrset_unittest.cc
+++ b/src/lib/dns/tests/rrset_unittest.cc
@@ -23,18 +23,19 @@
#include <dns/rrset.h>
#include <dns/tests/unittest_util.h>
+#include <util/unittests/wiredata.h>
#include <gtest/gtest.h>
#include <stdexcept>
#include <sstream>
-using isc::UnitTestUtil;
-
using namespace std;
using namespace isc::dns;
using namespace isc::util;
using namespace isc::dns::rdata;
+using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class RRsetTest : public ::testing::Test {
@@ -208,8 +209,8 @@ TEST_F(RRsetTest, toWireBuffer) {
rrset_a.toWire(buffer);
UnitTestUtil::readWireData("rrset_toWire1", wiredata);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, buffer.getData(),
- buffer.getLength(), &wiredata[0], wiredata.size());
+ matchWireData(&wiredata[0], wiredata.size(),
+ buffer.getData(), buffer.getLength());
// toWire() cannot be performed for an empty RRset.
buffer.clear();
@@ -220,14 +221,15 @@ TEST_F(RRsetTest, toWireBuffer) {
rrset_any_a_empty.toWire(buffer);
wiredata.clear();
UnitTestUtil::readWireData("rrset_toWire3", wiredata);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, buffer.getData(),
- buffer.getLength(), &wiredata[0], wiredata.size());
+ matchWireData(&wiredata[0], wiredata.size(),
+ buffer.getData(), buffer.getLength());
+
buffer.clear();
rrset_none_a_empty.toWire(buffer);
wiredata.clear();
UnitTestUtil::readWireData("rrset_toWire4", wiredata);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, buffer.getData(),
- buffer.getLength(), &wiredata[0], wiredata.size());
+ matchWireData(&wiredata[0], wiredata.size(),
+ buffer.getData(), buffer.getLength());
}
TEST_F(RRsetTest, toWireRenderer) {
@@ -237,8 +239,8 @@ TEST_F(RRsetTest, toWireRenderer) {
rrset_ns.toWire(renderer);
UnitTestUtil::readWireData("rrset_toWire2", wiredata);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, renderer.getData(),
- renderer.getLength(), &wiredata[0], wiredata.size());
+ matchWireData(&wiredata[0], wiredata.size(),
+ renderer.getData(), renderer.getLength());
// toWire() cannot be performed for an empty RRset.
buffer.clear();
@@ -250,15 +252,15 @@ TEST_F(RRsetTest, toWireRenderer) {
rrset_any_a_empty.toWire(buffer);
wiredata.clear();
UnitTestUtil::readWireData("rrset_toWire3", wiredata);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, buffer.getData(),
- buffer.getLength(), &wiredata[0], wiredata.size());
+ matchWireData(&wiredata[0], wiredata.size(),
+ buffer.getData(), buffer.getLength());
buffer.clear();
rrset_none_a_empty.toWire(buffer);
wiredata.clear();
UnitTestUtil::readWireData("rrset_toWire4", wiredata);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, buffer.getData(),
- buffer.getLength(), &wiredata[0], wiredata.size());
+ matchWireData(&wiredata[0], wiredata.size(),
+ buffer.getData(), buffer.getLength());
}
// test operator<<. We simply confirm it appends the result of toText().
diff --git a/src/lib/dns/tests/rrttl_unittest.cc b/src/lib/dns/tests/rrttl_unittest.cc
index c849c444ca..23b7c2d9ce 100644
--- a/src/lib/dns/tests/rrttl_unittest.cc
+++ b/src/lib/dns/tests/rrttl_unittest.cc
@@ -19,6 +19,7 @@
#include <dns/rrttl.h>
#include <dns/tests/unittest_util.h>
+#include <util/unittests/wiredata.h>
#include <boost/scoped_ptr.hpp>
@@ -27,6 +28,7 @@ using namespace isc;
using namespace isc::dns;
using namespace isc::util;
using boost::scoped_ptr;
+using isc::util::unittests::matchWireData;
namespace {
class RRTTLTest : public ::testing::Test {
@@ -193,9 +195,8 @@ TEST_F(RRTTLTest, toWireBuffer) {
ttl_32bit.toWire(obuffer);
ttl_max.toWire(obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- obuffer.getData(), obuffer.getLength(),
- wiredata, sizeof(wiredata));
+ matchWireData(wiredata, sizeof(wiredata),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(RRTTLTest, toWireRenderer) {
@@ -205,9 +206,8 @@ TEST_F(RRTTLTest, toWireRenderer) {
ttl_32bit.toWire(renderer);
ttl_max.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- wiredata, sizeof(wiredata));
+ matchWireData(wiredata, sizeof(wiredata),
+ renderer.getData(), renderer.getLength());
}
TEST_F(RRTTLTest, equal) {
diff --git a/src/lib/dns/tests/rrtype_unittest.cc b/src/lib/dns/tests/rrtype_unittest.cc
index ee302a1c41..84d52a9131 100644
--- a/src/lib/dns/tests/rrtype_unittest.cc
+++ b/src/lib/dns/tests/rrtype_unittest.cc
@@ -19,11 +19,13 @@
#include <dns/rrtype.h>
#include <dns/tests/unittest_util.h>
+#include <util/unittests/wiredata.h>
using namespace std;
using namespace isc;
using namespace isc::dns;
using namespace isc::util;
+using isc::util::unittests::matchWireData;
namespace {
class RRTypeTest : public ::testing::Test {
@@ -107,9 +109,8 @@ TEST_F(RRTypeTest, toWireBuffer) {
rrtype_0x8000.toWire(obuffer);
rrtype_max.toWire(obuffer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- obuffer.getData(), obuffer.getLength(),
- wiredata, sizeof(wiredata));
+ matchWireData(wiredata, sizeof(wiredata),
+ obuffer.getData(), obuffer.getLength());
}
TEST_F(RRTypeTest, toWireRenderer) {
@@ -119,9 +120,8 @@ TEST_F(RRTypeTest, toWireRenderer) {
rrtype_0x8000.toWire(renderer);
rrtype_max.toWire(renderer);
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- wiredata, sizeof(wiredata));
+ matchWireData(wiredata, sizeof(wiredata),
+ renderer.getData(), renderer.getLength());
}
TEST_F(RRTypeTest, wellKnownTypes) {
diff --git a/src/lib/dns/tests/tsig_unittest.cc b/src/lib/dns/tests/tsig_unittest.cc
index 458a6e0cf3..40a58c0e2c 100644
--- a/src/lib/dns/tests/tsig_unittest.cc
+++ b/src/lib/dns/tests/tsig_unittest.cc
@@ -40,6 +40,7 @@
#include <dns/tsigrecord.h>
#include <dns/tests/unittest_util.h>
+#include <util/unittests/wiredata.h>
using namespace std;
using namespace isc;
@@ -48,6 +49,7 @@ using namespace isc::util;
using namespace isc::util::encode;
using namespace isc::dns::rdata;
using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
// See dnssectime.cc
namespace isc {
@@ -224,15 +226,14 @@ commonSignChecks(ConstTSIGRecordPtr tsig, uint16_t expected_qid,
EXPECT_EQ(expected_timesigned, tsig_rdata.getTimeSigned());
EXPECT_EQ(300, tsig_rdata.getFudge());
EXPECT_EQ(expected_maclen, tsig_rdata.getMACSize());
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- tsig_rdata.getMAC(), tsig_rdata.getMACSize(),
- expected_mac, expected_maclen);
+ matchWireData(expected_mac, expected_maclen,
+ tsig_rdata.getMAC(), tsig_rdata.getMACSize());
+
EXPECT_EQ(expected_qid, tsig_rdata.getOriginalID());
EXPECT_EQ(expected_error, tsig_rdata.getError());
EXPECT_EQ(expected_otherlen, tsig_rdata.getOtherLen());
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- tsig_rdata.getOtherData(), tsig_rdata.getOtherLen(),
- expected_otherdata, expected_otherlen);
+ matchWireData(expected_otherdata, expected_otherlen,
+ tsig_rdata.getOtherData(), tsig_rdata.getOtherLen());
}
void
diff --git a/src/lib/dns/tests/tsigkey_unittest.cc b/src/lib/dns/tests/tsigkey_unittest.cc
index eaf4040d44..8a9d86f73a 100644
--- a/src/lib/dns/tests/tsigkey_unittest.cc
+++ b/src/lib/dns/tests/tsigkey_unittest.cc
@@ -23,10 +23,12 @@
#include <dns/tsigkey.h>
#include <dns/tests/unittest_util.h>
+#include <util/unittests/wiredata.h>
using namespace std;
using namespace isc::dns;
using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class TSIGKeyTest : public ::testing::Test {
@@ -72,15 +74,16 @@ TEST_F(TSIGKeyTest, construct) {
secret.c_str(), secret.size());
EXPECT_EQ(key_name, key.getKeyName());
EXPECT_EQ(Name("hmac-md5.sig-alg.reg.int"), key.getAlgorithmName());
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, secret.c_str(),
- secret.size(), key.getSecret(), key.getSecretLength());
+ matchWireData(secret.c_str(), secret.size(),
+ key.getSecret(), key.getSecretLength());
TSIGKey key_short_md5(key_name, TSIGKey::HMACMD5_SHORT_NAME(),
secret.c_str(), secret.size());
- EXPECT_EQ(key_name, key.getKeyName());
- EXPECT_EQ(Name("hmac-md5.sig-alg.reg.int"), key.getAlgorithmName());
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, secret.c_str(),
- secret.size(), key.getSecret(), key.getSecretLength());
+ EXPECT_EQ(key_name, key_short_md5.getKeyName());
+ EXPECT_EQ(Name("hmac-md5.sig-alg.reg.int"),
+ key_short_md5.getAlgorithmName());
+ matchWireData(secret.c_str(), secret.size(),
+ key_short_md5.getSecret(), key_short_md5.getSecretLength());
// "unknown" algorithm is only accepted with empty secret.
EXPECT_THROW(TSIGKey(key_name, Name("unknown-alg"),
@@ -113,9 +116,8 @@ void
compareTSIGKeys(const TSIGKey& expect, const TSIGKey& actual) {
EXPECT_EQ(expect.getKeyName(), actual.getKeyName());
EXPECT_EQ(expect.getAlgorithmName(), actual.getAlgorithmName());
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- expect.getSecret(), expect.getSecretLength(),
- actual.getSecret(), actual.getSecretLength());
+ matchWireData(expect.getSecret(), expect.getSecretLength(),
+ actual.getSecret(), actual.getSecretLength());
}
TEST_F(TSIGKeyTest, copyConstruct) {
@@ -249,9 +251,8 @@ TEST_F(TSIGKeyRingTest, find) {
EXPECT_EQ(TSIGKeyRing::SUCCESS, result1.code);
EXPECT_EQ(key_name, result1.key->getKeyName());
EXPECT_EQ(TSIGKey::HMACSHA256_NAME(), result1.key->getAlgorithmName());
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, secret, secret_len,
- result1.key->getSecret(),
- result1.key->getSecretLength());
+ matchWireData(secret, secret_len,
+ result1.key->getSecret(), result1.key->getSecretLength());
// If either key name or algorithm doesn't match, search should fail.
const TSIGKeyRing::FindResult result2 =
@@ -268,9 +269,8 @@ TEST_F(TSIGKeyRingTest, find) {
EXPECT_EQ(TSIGKeyRing::SUCCESS, result4.code);
EXPECT_EQ(key_name, result4.key->getKeyName());
EXPECT_EQ(TSIGKey::HMACSHA256_NAME(), result4.key->getAlgorithmName());
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, secret, secret_len,
- result4.key->getSecret(),
- result4.key->getSecretLength());
+ matchWireData(secret, secret_len,
+ result4.key->getSecret(), result4.key->getSecretLength());
}
TEST_F(TSIGKeyRingTest, findFromSome) {
diff --git a/src/lib/dns/tests/tsigrecord_unittest.cc b/src/lib/dns/tests/tsigrecord_unittest.cc
index 532681ac2d..9c08fe0dfe 100644
--- a/src/lib/dns/tests/tsigrecord_unittest.cc
+++ b/src/lib/dns/tests/tsigrecord_unittest.cc
@@ -29,12 +29,14 @@
#include <dns/tsigrecord.h>
#include <dns/tests/unittest_util.h>
+#include <util/unittests/wiredata.h>
using namespace std;
using namespace isc::util;
using namespace isc::dns;
using namespace isc::dns::rdata;
using isc::UnitTestUtil;
+using isc::util::unittests::matchWireData;
namespace {
class TSIGRecordTest : public ::testing::Test {
@@ -108,16 +110,14 @@ TEST_F(TSIGRecordTest, fromParams) {
TEST_F(TSIGRecordTest, recordToWire) {
UnitTestUtil::readWireData("tsigrecord_toWire1.wire", data);
EXPECT_EQ(1, test_record.toWire(renderer));
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ renderer.getData(), renderer.getLength());
// Same test for a dumb buffer
buffer.clear();
EXPECT_EQ(1, test_record.toWire(buffer));
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- buffer.getData(), buffer.getLength(),
- &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ buffer.getData(), buffer.getLength());
}
TEST_F(TSIGRecordTest, recordToOLongToWire) {
@@ -139,9 +139,8 @@ TEST_F(TSIGRecordTest, recordToWireAfterNames) {
renderer.writeName(TSIGKey::HMACMD5_NAME());
renderer.writeName(Name("foo.example.com"));
EXPECT_EQ(1, test_record.toWire(renderer));
- EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
- renderer.getData(), renderer.getLength(),
- &data[0], data.size());
+ matchWireData(&data[0], data.size(),
+ renderer.getData(), renderer.getLength());
}
TEST_F(TSIGRecordTest, toText) {