Browse Source

applied the same fix as r1709 and r1710. This will make it possible to run tests in a separate build tree. (trac ticket #143)

also applied the DRY principle to unittest_util*: remove the local copies and simply referred to the dns/tests versions of these files.


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1713 e5f2f494-b856-4b98-b285-d166d9295462
JINMEI Tatuya 15 years ago
parent
commit
1413ac244b

+ 3 - 1
src/lib/auth/tests/Makefile.am

@@ -1,5 +1,6 @@
 AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
 AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
 AM_CPPFLAGS += -I$(top_builddir)/src/lib/dns -I$(top_srcdir)/src/lib/dns
 AM_CPPFLAGS += -I$(top_builddir)/src/lib/dns -I$(top_srcdir)/src/lib/dns
+AM_CPPFLAGS += -DTEST_DATA_DIR=\"$(srcdir)/testdata\"
 
 
 CLEANFILES = *.gcno *.gcda
 CLEANFILES = *.gcno *.gcda
 
 
@@ -7,7 +8,8 @@ TESTS =
 if HAVE_GTEST
 if HAVE_GTEST
 TESTS += run_unittests
 TESTS += run_unittests
 run_unittests_SOURCES = run_unittests.cc
 run_unittests_SOURCES = run_unittests.cc
-run_unittests_SOURCES += unittest_util.h unittest_util.cc
+run_unittests_SOURCES += $(top_srcdir)/src/lib/dns/tests/unittest_util.h
+run_unittests_SOURCES += $(top_srcdir)/src/lib/dns/tests/unittest_util.cc
 run_unittests_SOURCES += datasrc_unittest.cc
 run_unittests_SOURCES += datasrc_unittest.cc
 run_unittests_SOURCES += sqlite3_unittest.cc
 run_unittests_SOURCES += sqlite3_unittest.cc
 run_unittests_SOURCES += static_unittest.cc
 run_unittests_SOURCES += static_unittest.cc

+ 22 - 22
src/lib/auth/tests/datasrc_unittest.cc

@@ -38,7 +38,7 @@
 #include <auth/sqlite3_datasrc.h>
 #include <auth/sqlite3_datasrc.h>
 #include <auth/static_datasrc.h>
 #include <auth/static_datasrc.h>
 
 
-#include "unittest_util.h"
+#include <dns/tests/unittest_util.h>
 #include "test_datasrc.h"
 #include "test_datasrc.h"
 
 
 using isc::UnitTestUtil;
 using isc::UnitTestUtil;
@@ -50,7 +50,7 @@ using namespace isc::data;
 
 
 namespace {
 namespace {
 const ElementPtr SQLITE_DBFILE_EXAMPLE = Element::createFromString(
 const ElementPtr SQLITE_DBFILE_EXAMPLE = Element::createFromString(
-    "{ \"database_file\": \"testdata/example.org.sqlite3\"}");
+    "{ \"database_file\": \"" TEST_DATA_DIR "/example.org.sqlite3\"}");
 
 
 class DataSrcTest : public ::testing::Test {
 class DataSrcTest : public ::testing::Test {
 protected:
 protected:
@@ -192,7 +192,7 @@ TEST_F(DataSrcTest, QueryClassAny) {
 }
 }
 
 
 TEST_F(DataSrcTest, NSQuery) {
 TEST_F(DataSrcTest, NSQuery) {
-    readAndProcessQuery("testdata/q_example_ns");
+    readAndProcessQuery("q_example_ns");
 
 
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 0, 6);
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 0, 6);
 
 
@@ -214,7 +214,7 @@ TEST_F(DataSrcTest, NSQuery) {
 }
 }
 
 
 TEST_F(DataSrcTest, NxRRset) {
 TEST_F(DataSrcTest, NxRRset) {
-    readAndProcessQuery("testdata/q_example_ptr");
+    readAndProcessQuery("q_example_ptr");
 
 
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 0, 4, 0);
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 0, 4, 0);
 
 
@@ -225,7 +225,7 @@ TEST_F(DataSrcTest, NxRRset) {
 }
 }
 
 
 TEST_F(DataSrcTest, Nxdomain) {
 TEST_F(DataSrcTest, Nxdomain) {
-    readAndProcessQuery("testdata/q_glork");
+    readAndProcessQuery("q_glork");
 
 
     headerCheck(msg, Rcode::NXDOMAIN(), true, true, true, 0, 6, 0);
     headerCheck(msg, Rcode::NXDOMAIN(), true, true, true, 0, 6, 0);
 
 
@@ -238,7 +238,7 @@ TEST_F(DataSrcTest, Nxdomain) {
 }
 }
 
 
 TEST_F(DataSrcTest, NxZone) {
 TEST_F(DataSrcTest, NxZone) {
-    readAndProcessQuery("testdata/q_spork");
+    readAndProcessQuery("q_spork");
 
 
     headerCheck(msg, Rcode::REFUSED(), true, false, true, 0, 0, 0);
     headerCheck(msg, Rcode::REFUSED(), true, false, true, 0, 0, 0);
 
 
@@ -249,7 +249,7 @@ TEST_F(DataSrcTest, NxZone) {
 }
 }
 
 
 TEST_F(DataSrcTest, Wildcard) {
 TEST_F(DataSrcTest, Wildcard) {
-    readAndProcessQuery("testdata/q_wild_a");
+    readAndProcessQuery("q_wild_a");
 
 
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 6, 6);
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 6, 6);
 
 
@@ -305,14 +305,14 @@ TEST_F(DataSrcTest, WildcardNodata) {
 
 
     // Check that a query for a data type not covered by the wildcard
     // Check that a query for a data type not covered by the wildcard
     // returns NOERROR
     // returns NOERROR
-    readAndProcessQuery("testdata/q_wild_aaaa");
+    readAndProcessQuery("q_wild_aaaa");
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 0, 2, 0);
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 0, 2, 0);
 }
 }
 
 
 TEST_F(DataSrcTest, WildcardCname) {
 TEST_F(DataSrcTest, WildcardCname) {
     // Check that wildcard answers containing CNAMES are followed
     // Check that wildcard answers containing CNAMES are followed
     // correctly
     // correctly
-    readAndProcessQuery("testdata/q_wild2_a");
+    readAndProcessQuery("q_wild2_a");
 
 
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 6, 6);
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 6, 6);
 
 
@@ -380,7 +380,7 @@ TEST_F(DataSrcTest, WildcardCname) {
 TEST_F(DataSrcTest, WildcardCnameNodata) {
 TEST_F(DataSrcTest, WildcardCnameNodata) {
     // A wildcard containing a CNAME whose target does not include
     // A wildcard containing a CNAME whose target does not include
     // data of this type.
     // data of this type.
-    readAndProcessQuery("testdata/q_wild2_aaaa");
+    readAndProcessQuery("q_wild2_aaaa");
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 4, 0);
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 4, 0);
 
 
     RRsetIterator rit = msg.beginSection(Section::ANSWER());
     RRsetIterator rit = msg.beginSection(Section::ANSWER());
@@ -411,7 +411,7 @@ TEST_F(DataSrcTest, WildcardCnameNodata) {
 
 
 TEST_F(DataSrcTest, WildcardCnameNxdomain) {
 TEST_F(DataSrcTest, WildcardCnameNxdomain) {
     // A wildcard containing a CNAME whose target does not exist
     // A wildcard containing a CNAME whose target does not exist
-    readAndProcessQuery("testdata/q_wild3_a");
+    readAndProcessQuery("q_wild3_a");
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 6, 0);
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 6, 0);
 
 
     RRsetIterator rit = msg.beginSection(Section::ANSWER());
     RRsetIterator rit = msg.beginSection(Section::ANSWER());
@@ -447,7 +447,7 @@ TEST_F(DataSrcTest, WildcardCnameNxdomain) {
     EXPECT_EQ(RRClass::IN(), rrset->getClass());
     EXPECT_EQ(RRClass::IN(), rrset->getClass());
 }
 }
 TEST_F(DataSrcTest, AuthDelegation) {
 TEST_F(DataSrcTest, AuthDelegation) {
-    readAndProcessQuery("testdata/q_sql1");
+    readAndProcessQuery("q_sql1");
 
 
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 4, 6);
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 4, 6);
 
 
@@ -493,7 +493,7 @@ TEST_F(DataSrcTest, AuthDelegation) {
 }
 }
 
 
 TEST_F(DataSrcTest, Dname) {
 TEST_F(DataSrcTest, Dname) {
-    readAndProcessQuery("testdata/q_dname");
+    readAndProcessQuery("q_dname");
 
 
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 5, 4, 6);
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 5, 4, 6);
 
 
@@ -541,7 +541,7 @@ TEST_F(DataSrcTest, Dname) {
 }
 }
 
 
 TEST_F(DataSrcTest, Cname) {
 TEST_F(DataSrcTest, Cname) {
-    readAndProcessQuery("testdata/q_cname");
+    readAndProcessQuery("q_cname");
 
 
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 0, 0);
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 0, 0);
 
 
@@ -559,7 +559,7 @@ TEST_F(DataSrcTest, Cname) {
 }
 }
 
 
 TEST_F(DataSrcTest, CnameInt) {
 TEST_F(DataSrcTest, CnameInt) {
-    readAndProcessQuery("testdata/q_cname_int");
+    readAndProcessQuery("q_cname_int");
 
 
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 4, 6);
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 4, 6);
 
 
@@ -585,7 +585,7 @@ TEST_F(DataSrcTest, CnameInt) {
 }
 }
 
 
 TEST_F(DataSrcTest, CnameExt) {
 TEST_F(DataSrcTest, CnameExt) {
-    readAndProcessQuery("testdata/q_cname_ext");
+    readAndProcessQuery("q_cname_ext");
 
 
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 4, 6);
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 4, 4, 6);
 
 
@@ -609,7 +609,7 @@ TEST_F(DataSrcTest, CnameExt) {
 }
 }
 
 
 TEST_F(DataSrcTest, Delegation) {
 TEST_F(DataSrcTest, Delegation) {
-    readAndProcessQuery("testdata/q_subzone");
+    readAndProcessQuery("q_subzone");
 
 
     headerCheck(msg, Rcode::NOERROR(), true, false, true, 0, 5, 2);
     headerCheck(msg, Rcode::NOERROR(), true, false, true, 0, 5, 2);
 
 
@@ -639,7 +639,7 @@ TEST_F(DataSrcTest, Delegation) {
 }
 }
 
 
 TEST_F(DataSrcTest, NSDelegation) {
 TEST_F(DataSrcTest, NSDelegation) {
-    readAndProcessQuery("testdata/q_subzone_ns");
+    readAndProcessQuery("q_subzone_ns");
 
 
     headerCheck(msg, Rcode::NOERROR(), true, false, true, 0, 5, 2);
     headerCheck(msg, Rcode::NOERROR(), true, false, true, 0, 5, 2);
 
 
@@ -671,12 +671,12 @@ TEST_F(DataSrcTest, NSDelegation) {
 TEST_F(DataSrcTest, ANYZonecut) {
 TEST_F(DataSrcTest, ANYZonecut) {
     // An ANY query at a zone cut should behave the same as any other
     // An ANY query at a zone cut should behave the same as any other
     // delegation
     // delegation
-    readAndProcessQuery("testdata/q_subzone_any");
+    readAndProcessQuery("q_subzone_any");
 
 
 }
 }
 
 
 TEST_F(DataSrcTest, NSECZonecut) {
 TEST_F(DataSrcTest, NSECZonecut) {
-    readAndProcessQuery("testdata/q_subzone_nsec");
+    readAndProcessQuery("q_subzone_nsec");
 
 
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 4, 6);
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 2, 4, 6);
 
 
@@ -704,7 +704,7 @@ TEST_F(DataSrcTest, NSECZonecut) {
 }
 }
 
 
 TEST_F(DataSrcTest, DNAMEZonecut) {
 TEST_F(DataSrcTest, DNAMEZonecut) {
-    readAndProcessQuery("testdata/q_subzone_dname");
+    readAndProcessQuery("q_subzone_dname");
 
 
     headerCheck(msg, Rcode::NOERROR(), true, false, true, 0, 5, 2);
     headerCheck(msg, Rcode::NOERROR(), true, false, true, 0, 5, 2);
     RRsetIterator rit = msg.beginSection(Section::AUTHORITY());
     RRsetIterator rit = msg.beginSection(Section::AUTHORITY());
@@ -733,7 +733,7 @@ TEST_F(DataSrcTest, DNAMEZonecut) {
 }
 }
 
 
 TEST_F(DataSrcTest, DS) {
 TEST_F(DataSrcTest, DS) {
-    readAndProcessQuery("testdata/q_subzone_ds");
+    readAndProcessQuery("q_subzone_ds");
 
 
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 3, 4, 6);
     headerCheck(msg, Rcode::NOERROR(), true, true, true, 3, 4, 6);
 
 

+ 4 - 0
src/lib/auth/tests/run_unittests.cc

@@ -16,9 +16,13 @@
 
 
 #include <gtest/gtest.h>
 #include <gtest/gtest.h>
 
 
+#include <dns/tests/unittest_util.h>
+
 int
 int
 main(int argc, char* argv[])
 main(int argc, char* argv[])
 {
 {
     ::testing::InitGoogleTest(&argc, argv);
     ::testing::InitGoogleTest(&argc, argv);
+    isc::UnitTestUtil::addDataPath(TEST_DATA_DIR);
+
     return (RUN_ALL_TESTS());
     return (RUN_ALL_TESTS());
 }
 }

+ 5 - 5
src/lib/auth/tests/sqlite3_unittest.cc

@@ -44,13 +44,13 @@ using namespace isc::data;
 
 
 namespace {
 namespace {
 ElementPtr SQLITE_DBFILE_EXAMPLE = Element::createFromString(
 ElementPtr SQLITE_DBFILE_EXAMPLE = Element::createFromString(
-    "{ \"database_file\": \"testdata/test.sqlite3\"}");
+    "{ \"database_file\": \"" TEST_DATA_DIR "/test.sqlite3\"}");
 ElementPtr SQLITE_DBFILE_EXAMPLE2 = Element::createFromString(
 ElementPtr SQLITE_DBFILE_EXAMPLE2 = Element::createFromString(
-    "{ \"database_file\": \"testdata/test2.sqlite3\"}");
+    "{ \"database_file\": \"" TEST_DATA_DIR "/test2.sqlite3\"}");
 ElementPtr SQLITE_DBFILE_EXAMPLE_ROOT = Element::createFromString(
 ElementPtr SQLITE_DBFILE_EXAMPLE_ROOT = Element::createFromString(
-    "{ \"database_file\": \"testdata/test-root.sqlite3\"}");
+    "{ \"database_file\": \"" TEST_DATA_DIR "/test-root.sqlite3\"}");
 ElementPtr SQLITE_DBFILE_BROKENDB = Element::createFromString(
 ElementPtr SQLITE_DBFILE_BROKENDB = Element::createFromString(
-    "{ \"database_file\": \"testdata/brokendb.sqlite3\"}");
+    "{ \"database_file\": \"" TEST_DATA_DIR "/brokendb.sqlite3\"}");
 ElementPtr SQLITE_DBFILE_MEMORY = Element::createFromString(
 ElementPtr SQLITE_DBFILE_MEMORY = Element::createFromString(
     "{ \"database_file\": \":memory:\"}");
     "{ \"database_file\": \":memory:\"}");
 
 
@@ -59,7 +59,7 @@ ElementPtr SQLITE_DBFILE_MEMORY = Element::createFromString(
 // so to test a failure case the create operation should also fail.
 // so to test a failure case the create operation should also fail.
 // The "nodir", a non existent directory, is inserted for this purpose.
 // The "nodir", a non existent directory, is inserted for this purpose.
 ElementPtr SQLITE_DBFILE_NOTEXIST = Element::createFromString(
 ElementPtr SQLITE_DBFILE_NOTEXIST = Element::createFromString(
-    "{ \"database_file\": \"testdata/nodir/notexist\"}");
+    "{ \"database_file\": \"" TEST_DATA_DIR "/nodir/notexist\"}");
 
 
 const string sigdata_common(" 20100322084538 20100220084538 "
 const string sigdata_common(" 20100322084538 20100220084538 "
                             "33495 example.com. FAKEFAKEFAKEFAKE");
                             "33495 example.com. FAKEFAKEFAKEFAKE");

+ 1 - 1
src/lib/auth/tests/test_datasrc.cc

@@ -18,7 +18,7 @@
 
 
 #include <cassert>
 #include <cassert>
 
 
-#include "unittest_util.h"
+#include <dns/tests/unittest_util.h>
 #include "test_datasrc.h"
 #include "test_datasrc.h"
 
 
 #include <auth/data_source.h>
 #include <auth/data_source.h>

+ 0 - 127
src/lib/auth/tests/unittest_util.cc

@@ -1,127 +0,0 @@
-// Copyright (C) 2009  Internet Systems Consortium, Inc. ("ISC")
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// PERFORMANCE OF THIS SOFTWARE.
-
-// $Id$
-
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <stdexcept>
-#include <vector>
-#include <string>
-
-#include <gtest/gtest.h>
-
-#include <dns/name.h>
-#include "unittest_util.h"
-
-using isc::UnitTestUtil;
-using isc::dns::NameComparisonResult;
-
-namespace isc {
-
-void
-UnitTestUtil::readWireData(const char* datafile,
-                           std::vector<unsigned char>& data)
-{
-    std::ifstream ifs;
- 
-    ifs.open(datafile, std::ios_base::in);
-    if ((ifs.rdstate() & std::istream::failbit) != 0) {
-        throw std::runtime_error("failed to open data file: " +
-                                 std::string(datafile));
-    }
-
-    data.clear();
-
-    std::string s;
-    while (getline(ifs, s), !ifs.eof()) {
-        if (ifs.bad() || ifs.fail()) {
-            throw std::runtime_error("unexpected data line");
-        }
-        if (s.empty() || s[0] == '#') {
-            continue;
-        }
-
-        readWireData(s, data);
-    }
-}
-
-void
-UnitTestUtil::readWireData(const std::string& datastr,
-                           std::vector<unsigned char>& data)
-{
-    std::istringstream iss(datastr);
-
-    do {
-        std::string bytes;
-        iss >> bytes;
-        if (iss.bad() || iss.fail() || (bytes.size() % 2) != 0) {
-            throw std::runtime_error("unexpected input or I/O error");
-        }
-
-        for (int pos = 0; pos < bytes.size(); pos += 2) {
-            unsigned int ch;
-            std::istringstream(bytes.substr(pos, 2)) >> std::hex >> ch;
-            data.push_back(static_cast<unsigned char>(ch));
-        }
-    } while (!iss.eof());
-}
-
-::testing::AssertionResult
-UnitTestUtil::matchWireData(const char* dataexp1, const char* lenexp1,
-                            const char* dataexp2, const char* lenexp2,
-                            const void* data1, size_t len1,
-                            const void* data2, size_t len2)
-{
-    ::testing::Message msg;
-    size_t cmplen = std::min(len1, len2);
-
-    for (int i = 0; i < cmplen; i++) {
-        int ch1 = static_cast<const uint8_t*>(data1)[i];
-        int ch2 = static_cast<const uint8_t*>(data2)[i];
-        if (ch1 != ch2) {
-            msg << "Wire data mismatch at " << i << "th byte\n"
-                << "  Actual: " << ch1 << "\n"
-                << "Expected: " << ch2 << "\n";
-            return (::testing::AssertionFailure(msg));
-        }
-    }
-    if (len1 != len2) {
-        msg << "Wire data mismatch in length:\n"
-            << "  Actual: " << len1 << "\n"
-            << "Expected: " << len2 << "\n";
-        return (::testing::AssertionFailure(msg));
-    }
-    return ::testing::AssertionSuccess();
-}
-
-::testing::AssertionResult
-UnitTestUtil::matchName(const char* nameexp1, const char* nameexp2,
-                        const isc::dns::Name& name1,
-                        const isc::dns::Name& name2)
-{
-    ::testing::Message msg;
-
-    NameComparisonResult cmpresult = name1.compare(name2);
-    if (cmpresult.getOrder() != 0 ||
-        cmpresult.getRelation() != NameComparisonResult::EQUAL) {
-        msg << "Two names are expected to be equal but not:\n"
-            << "  One: " << name1 << "\n"
-            << "Other: " << name2 << "\n";
-        return (::testing::AssertionFailure(msg));
-    }
-    return ::testing::AssertionSuccess();
-}
-}

+ 0 - 84
src/lib/auth/tests/unittest_util.h

@@ -1,84 +0,0 @@
-// Copyright (C) 2009  Internet Systems Consortium, Inc. ("ISC")
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// PERFORMANCE OF THIS SOFTWARE.
-
-// $Id$
-
-#ifndef __UNITTEST_UTIL_H
-#define __UNITTEST_UTIL_H 1
-
-#include <vector>
-#include <string>
-
-#include <dns/name.h>
-
-#include <gtest/gtest.h>
-
-namespace isc {
-
-class UnitTestUtil {
-public:
-    ///
-    /// read text format wire data from a file and put it to the given vector.
-    ///
-    static void readWireData(const char*datafile,
-                             std::vector<unsigned char>& data);
-
-    ///
-    /// convert a sequence of hex strings into the corresponding list of
-    /// 8-bit integers, and append them to the vector.
-    ///
-    static void readWireData(const std::string& datastr,
-                             std::vector<unsigned char>& data);
-
-    ///
-    /// Compare len1 bytes of data1 with len2 bytes of data2 as binary data.
-    ///
-    /// If they don't match report the point of mismatch in the google test
-    /// format.  This method is expected to be used from the EXPECT_PRED_FORMAT4
-    /// macro of google test as follows:
-    /// \code EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
-    ///                           actual_data, actual_data_len,
-    ///                           expected_data, expected_data_len); \endcode
-    /// Parameters from dataexp1 to lenexp2 are passed via the macro but will
-    /// be ignored by this method.
-    /// Note: newer versions of google test supports the direct use of
-    /// AssertionResult with the EXPECT_TRUE macro, which would be more
-    /// intuitive, but to be as compatible as possible we use the more primitive
-    /// macro, i.e., EXPECT_PRED_FORMAT4.
-    ///
-    static ::testing::AssertionResult
-    matchWireData(const char* dataexp1, const char* lenexp1,
-                  const char* dataexp2, const char* lenexp2,
-                  const void* data1, size_t len1,
-                  const void* data2, size_t len2);
-
-    ///
-    /// Compare two names.
-    ///
-    /// This check method uses \c Name::compare() for comparison, which performs
-    /// deeper checks including the equality of offsets, and should be better
-    /// than EXPECT_EQ, which uses operater==.  Like the \c matchWireData()
-    /// method, the usage is a bit awkward; the caller should use
-    /// \c EXPECT_PRED_FORMAT2.
-    ///
-    static ::testing::AssertionResult
-    matchName(const char* nameexp1, const char* nameexp2,
-              const isc::dns::Name& name1, const isc::dns::Name& name2);
-};
-}
-#endif // __UNITTEST_UTIL_H
-
-// Local Variables: 
-// mode: c++
-// End: