[svn] commit: r3861 - /trunk/src/lib/dns/tests/masterload_unittest.cc
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Dec 16 08:45:02 UTC 2010
Author: jinmei
Date: Thu Dec 16 08:45:02 2010
New Revision: 3861
Log:
corrected the path to test data file (not build dir but src dir).
this should fix the distcheck failure.
also using this opportunity to add minor cleanups: use consistent naming
for tests with function/file names.
should be quite trivial and causing a buildbot error, so committing directly
to trunk.
Modified:
trunk/src/lib/dns/tests/masterload_unittest.cc
Modified: trunk/src/lib/dns/tests/masterload_unittest.cc
==============================================================================
--- trunk/src/lib/dns/tests/masterload_unittest.cc (original)
+++ trunk/src/lib/dns/tests/masterload_unittest.cc Thu Dec 16 08:45:02 2010
@@ -49,9 +49,9 @@
rrsets->push_back(rrset);
}
-class MasterTest : public ::testing::Test {
+class MasterLoadTest : public ::testing::Test {
protected:
- MasterTest() : origin("example.com"), zclass(RRClass::IN()),
+ MasterLoadTest() : origin("example.com"), zclass(RRClass::IN()),
callback(results) {}
public:
void rrsetCallback(ConstRRsetPtr rrset) {
@@ -73,7 +73,7 @@
// multi-field RR case
const char* const soa_rr = "example.com. 7200 IN SOA . . 0 0 0 0 0\n";
-TEST_F(MasterTest, loadRRs) {
+TEST_F(MasterLoadTest, loadRRs) {
// a simple case: loading 3 RRs, each consists of a single RRset.
rr_stream << txt_rr << a_rr1 << soa_rr;
masterLoad(rr_stream, origin, zclass, callback);
@@ -83,7 +83,7 @@
EXPECT_EQ(soa_rr, results[2]->toText());
}
-TEST_F(MasterTest, loadWithFunctionCallback) {
+TEST_F(MasterLoadTest, loadWithFunctionCallback) {
// The same test as loadRRs but using a normal function (not a functor
// object)
rr_stream << txt_rr << a_rr1 << soa_rr;
@@ -95,19 +95,19 @@
EXPECT_EQ(soa_rr, results[2]->toText());
}
-TEST_F(MasterTest, loadWithMemFunctionCallback) {
+TEST_F(MasterLoadTest, loadWithMemFunctionCallback) {
// The same test as loadRRs but using a class member function (with a
// help of Boost.bind)
rr_stream << txt_rr << a_rr1 << soa_rr;
masterLoad(rr_stream, origin, zclass,
- boost::bind(&MasterTest::rrsetCallback, this, _1));
+ boost::bind(&MasterLoadTest::rrsetCallback, this, _1));
ASSERT_EQ(3, results.size());
EXPECT_EQ(txt_rr, results[0]->toText());
EXPECT_EQ(a_rr1, results[1]->toText());
EXPECT_EQ(soa_rr, results[2]->toText());
}
-TEST_F(MasterTest, loadComments) {
+TEST_F(MasterLoadTest, loadComments) {
rr_stream << ";; comment line, should be skipped\n"
<< "\n" // blank line (should be skipped)
<< txt_rr;
@@ -116,7 +116,7 @@
EXPECT_EQ(txt_rr, results[0]->toText());
}
-TEST_F(MasterTest, loadRRset) {
+TEST_F(MasterLoadTest, loadRRset) {
// load an RRset containing two RRs
rr_stream << a_rr1 << a_rr2;
masterLoad(rr_stream, origin, zclass, callback);
@@ -124,7 +124,7 @@
EXPECT_EQ(string(a_rr1) + string(a_rr2), results[0]->toText());
}
-TEST_F(MasterTest, loadRRsetsOfSameType) {
+TEST_F(MasterLoadTest, loadRRsetsOfSameType) {
// load two RRsets with the same RR type and different owner names.
// the loader must distinguish them as separate RRsets.
rr_stream << a_rr1 << a_rr3;
@@ -134,7 +134,7 @@
EXPECT_EQ(a_rr3, results[1]->toText());
}
-TEST_F(MasterTest, loadRRsetsInterleaved) {
+TEST_F(MasterLoadTest, loadRRsetsInterleaved) {
// two RRs that belongs to the same RRset (rr1 and rr2) are interleaved
// by another. This is an unexpected case for this loader, but it's
// not considered an error. The loader will simply treat them separate
@@ -147,7 +147,7 @@
EXPECT_EQ(a_rr2, results[2]->toText());
}
-TEST_F(MasterTest, loadWithNoEOF) {
+TEST_F(MasterLoadTest, loadWithNoEOF) {
// the input stream doesn't end with a new line (and the following blank
// line). It should be accepted.
string rr_string(a_rr1);
@@ -158,44 +158,44 @@
EXPECT_EQ(a_rr1, results[0]->toText());
}
-TEST_F(MasterTest, loadEmpty) {
+TEST_F(MasterLoadTest, loadEmpty) {
// an unusual case: empty input. load must succeed with an empty result.
masterLoad(rr_stream, origin, zclass, callback);
EXPECT_EQ(0, results.size());
}
-TEST_F(MasterTest, loadWithBeginningSpace) {
+TEST_F(MasterLoadTest, loadWithBeginningSpace) {
rr_stream << " " << a_rr1;
EXPECT_THROW(masterLoad(rr_stream, origin, zclass, callback),
MasterLoadError);
}
-TEST_F(MasterTest, loadWithBeginningTab) {
+TEST_F(MasterLoadTest, loadWithBeginningTab) {
rr_stream << "\t" << a_rr1;
EXPECT_THROW(masterLoad(rr_stream, origin, zclass, callback),
MasterLoadError);
}
-TEST_F(MasterTest, loadInvalidRRClass) {
+TEST_F(MasterLoadTest, loadInvalidRRClass) {
rr_stream << "example.com. 3600 CH TXT \"test text\"";
EXPECT_THROW(masterLoad(rr_stream, origin, zclass, callback),
MasterLoadError);
}
-TEST_F(MasterTest, loadOutOfZoneData) {
+TEST_F(MasterLoadTest, loadOutOfZoneData) {
rr_stream << "example.org. 3600 IN A 192.0.2.255";
EXPECT_THROW(masterLoad(rr_stream, origin, zclass, callback),
MasterLoadError);
}
-TEST_F(MasterTest, loadNonAtopSOA) {
+TEST_F(MasterLoadTest, loadNonAtopSOA) {
// SOA's owner name must be zone's origin.
rr_stream << "soa.example.com. 3600 IN SOA . . 0 0 0 0 0";
EXPECT_THROW(masterLoad(rr_stream, origin, zclass, callback),
MasterLoadError);
}
-TEST_F(MasterTest, loadBadRRText) {
+TEST_F(MasterLoadTest, loadBadRRText) {
rr_stream << "example..com. 3600 IN A 192.0.2.1"; // bad owner name
EXPECT_THROW(masterLoad(rr_stream, origin, zclass, callback),
MasterLoadError);
@@ -243,17 +243,17 @@
stringstream& ss_;
};
-TEST_F(MasterTest, loadBadStream) {
+TEST_F(MasterLoadTest, loadBadStream) {
rr_stream << txt_rr << a_rr1;
StreamInvalidator invalidator(rr_stream);
EXPECT_THROW(masterLoad(rr_stream, origin, zclass, invalidator),
MasterLoadError);
}
-TEST_F(MasterTest, loadFromFile) {
+TEST_F(MasterLoadTest, loadFromFile) {
// The main parser is shared with the stream version, so we simply test
// file I/O specific parts.
- masterLoad(TEST_DATA_BUILDDIR "/masterload.txt", origin, zclass, callback);
+ masterLoad(TEST_DATA_SRCDIR "/masterload.txt", origin, zclass, callback);
ASSERT_EQ(2, results.size());
EXPECT_EQ(txt_rr, results[0]->toText());
EXPECT_EQ(string(a_rr1) + string(a_rr2), results[1]->toText());
More information about the bind10-changes
mailing list