Commit f6161c16 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

- changed 'if 0'ed tests to DISABLED_xxx

  (except tests for base32, which is being addressed)
- also made trivial style fixes on brace positions

This is suggested in review comments for trac #256.  Reasonable, but not
related to the main issue of that ticket, so I'm making the changes right
now directly to trunk.  Pretty trivial, so skipping explicit review.


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@2523 e5f2f494-b856-4b98-b285-d166d9295462
parent 8c60a2c5
......@@ -48,21 +48,18 @@ string dnskey_txt("257 3 5 BEAAAAOhHQDBrhQbtphgq2wQUpEQ5t4DtUHxoMV"
"7+ysyLKOOedS39Z7SDmsn2eA0FKtQpwA6LXeG2w+jxmw3oA"
"8lVUgEf/rzeC/bByBNsO70aEFTd");
TEST_F(Rdata_DNSKEY_Test, fromText)
{
TEST_F(Rdata_DNSKEY_Test, fromText) {
generic::DNSKEY rdata_dnskey(dnskey_txt);
EXPECT_EQ(dnskey_txt, rdata_dnskey.toText());
}
TEST_F(Rdata_DNSKEY_Test, assign)
{
TEST_F(Rdata_DNSKEY_Test, assign) {
generic::DNSKEY rdata_dnskey(dnskey_txt);
generic::DNSKEY rdata_dnskey2 = rdata_dnskey;
EXPECT_EQ(0, rdata_dnskey.compare(rdata_dnskey2));
}
TEST_F(Rdata_DNSKEY_Test, badText)
{
TEST_F(Rdata_DNSKEY_Test, badText) {
EXPECT_THROW(generic::DNSKEY("257 3 5"),
InvalidRdataText);
EXPECT_THROW(generic::DNSKEY("99999 3 5 BAAAAAAAAAAAD"),
......@@ -73,7 +70,9 @@ TEST_F(Rdata_DNSKEY_Test, badText)
InvalidRdataText);
EXPECT_THROW(generic::DNSKEY("257 3 5 BAAAAAAAAAAAD"),
BadBase64String);
#if 0
}
TEST_F(Rdata_DNSKEY_Test, DISABLED_badText) {
// Should this be allowed? Probably not. But the test currently fails.
EXPECT_THROW(generic::DNSKEY("257 3 5BEAAEFTd"),
InvalidRdataText);
......@@ -81,11 +80,9 @@ TEST_F(Rdata_DNSKEY_Test, badText)
// it could be ambiguous '51 EAAA' vs '5 1EAA..'
EXPECT_THROW(generic::DNSKEY("257 3 51EAAEFTd"),
InvalidRdataText);
#endif
}
TEST_F(Rdata_DNSKEY_Test, toWireRenderer)
{
TEST_F(Rdata_DNSKEY_Test, toWireRenderer) {
renderer.skip(2);
generic::DNSKEY rdata_dnskey(dnskey_txt);
rdata_dnskey.toWire(renderer);
......@@ -97,34 +94,29 @@ TEST_F(Rdata_DNSKEY_Test, toWireRenderer)
obuffer.getLength() - 2, &data[2], data.size() - 2);
}
TEST_F(Rdata_DNSKEY_Test, toWireBuffer)
{
TEST_F(Rdata_DNSKEY_Test, toWireBuffer) {
generic::DNSKEY rdata_dnskey(dnskey_txt);
rdata_dnskey.toWire(obuffer);
}
TEST_F(Rdata_DNSKEY_Test, createFromWire)
{
TEST_F(Rdata_DNSKEY_Test, createFromWire) {
generic::DNSKEY rdata_dnskey(dnskey_txt);
EXPECT_EQ(0, rdata_dnskey.compare(
*rdataFactoryFromFile(RRType("DNSKEY"), RRClass("IN"),
"rdata_dnskey_fromWire")));
}
TEST_F(Rdata_DNSKEY_Test, getTag)
{
TEST_F(Rdata_DNSKEY_Test, getTag) {
generic::DNSKEY rdata_dnskey(dnskey_txt);
EXPECT_EQ(12892, rdata_dnskey.getTag());
}
TEST_F(Rdata_DNSKEY_Test, getAlgorithm)
{
TEST_F(Rdata_DNSKEY_Test, getAlgorithm) {
generic::DNSKEY rdata_dnskey(dnskey_txt);
EXPECT_EQ(5, rdata_dnskey.getAlgorithm());
}
TEST_F(Rdata_DNSKEY_Test, getFlags)
{
TEST_F(Rdata_DNSKEY_Test, getFlags) {
generic::DNSKEY rdata_dnskey(dnskey_txt);
EXPECT_EQ(257, rdata_dnskey.getFlags());
}
......
......@@ -38,14 +38,12 @@ class Rdata_MX_Test : public RdataTest {
const generic::MX rdata_mx(10, Name("mx.example.com"));
TEST_F(Rdata_MX_Test, createFromText)
{
TEST_F(Rdata_MX_Test, createFromText) {
const generic::MX rdata_mx2("10 mx.example.com");
EXPECT_EQ(0, rdata_mx2.compare(rdata_mx));
}
TEST_F(Rdata_MX_Test, badText)
{
TEST_F(Rdata_MX_Test, badText) {
EXPECT_THROW(const generic::MX rdata_mx("99999999 mx."), InvalidRdataText);
EXPECT_THROW(const generic::MX rdata_mx("10"), InvalidRdataText);
EXPECT_THROW(const generic::MX rdata_mx("SPOON"), InvalidRdataText);
......@@ -53,22 +51,19 @@ TEST_F(Rdata_MX_Test, badText)
InvalidRdataText);
}
TEST_F(Rdata_MX_Test, copy)
{
TEST_F(Rdata_MX_Test, copy) {
const generic::MX rdata_mx2(rdata_mx);
EXPECT_EQ(0, rdata_mx.compare(rdata_mx2));
}
TEST_F(Rdata_MX_Test, createFromWire)
{
TEST_F(Rdata_MX_Test, createFromWire) {
EXPECT_EQ(0, rdata_mx.compare(
*rdataFactoryFromFile(RRType("MX"), RRClass("IN"),
"rdata_mx_fromWire")));
// TBD: more tests
}
TEST_F(Rdata_MX_Test, toWireRenderer)
{
TEST_F(Rdata_MX_Test, toWireRenderer) {
renderer.writeName(Name("example.com"));
rdata_mx.toWire(renderer);
......@@ -78,37 +73,32 @@ TEST_F(Rdata_MX_Test, toWireRenderer)
obuffer.getLength(), &data[0], data.size());
}
TEST_F(Rdata_MX_Test, toWireBuffer)
{
TEST_F(Rdata_MX_Test, toWireBuffer) {
renderer.writeName(Name("example.com"));
rdata_mx.toWire(obuffer);
}
#if 0
TEST_F(Rdata_MX_Test, DISABLED_toWireBuffer) {
// XXX: does not pass
vector<unsigned char> data;
UnitTestUtil::readWireData("rdata_mx_toWire1", data);
EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData, obuffer.getData(),
obuffer.getLength(), &data[0], data.size());
#endif
}
TEST_F(Rdata_MX_Test, toText)
{
TEST_F(Rdata_MX_Test, toText) {
EXPECT_EQ("10 mx.example.com.", rdata_mx.toText());
}
TEST_F(Rdata_MX_Test, getMXName)
{
TEST_F(Rdata_MX_Test, getMXName) {
EXPECT_EQ(Name("mx.example.com."), rdata_mx.getMXName());
}
TEST_F(Rdata_MX_Test, getMXPref)
{
TEST_F(Rdata_MX_Test, getMXPref) {
EXPECT_EQ(10, rdata_mx.getMXPref());
}
TEST_F(Rdata_MX_Test, compare)
{
TEST_F(Rdata_MX_Test, compare) {
generic::MX small1(1, Name("mx.example.com"));
generic::MX small2(10, Name("mx.example.com"));
generic::MX large1(65535, Name("mx.example.com"));
......
......@@ -44,14 +44,12 @@ string nsec3_txt("1 1 1 D399EAAB H9RSFB7FPF2L8HG35CMPC765TDK23RP6 "
"NS SOA RRSIG DNSKEY NSEC3PARAM");
TEST_F(Rdata_NSEC3_Test, toText)
{
TEST_F(Rdata_NSEC3_Test, toText) {
const generic::NSEC3 rdata_nsec3(nsec3_txt);
EXPECT_EQ(nsec3_txt, rdata_nsec3.toText());
}
TEST_F(Rdata_NSEC3_Test, badText)
{
TEST_F(Rdata_NSEC3_Test, badText) {
EXPECT_THROW(generic::NSEC3 rdata_nsec3("1 1 1 ADDAFEE "
"0123456789ABCDEFGHIJKLMNOPQRSTUV "
"BIFF POW SPOON"),
......@@ -72,16 +70,16 @@ TEST_F(Rdata_NSEC3_Test, badText)
"0123456789ABCDEFGHIJKLMNOPQRSTUV "
"A NS SOA"),
InvalidRdataText);
}
#if 0 // this currently fails
TEST_F(Rdata_NSEC3_Test, DISABLED_badText) {
// this currently fails
EXPECT_THROW(generic::NSEC3(
"1 1 1D399EAAB H9RSFB7FPF2L8HG35CMPC765TDK23RP6 "
"NS SOA RRSIG DNSKEY NSEC3PARAM"), InvalidRdataText);
#endif
}
TEST_F(Rdata_NSEC3_Test, createFromWire)
{
TEST_F(Rdata_NSEC3_Test, createFromWire) {
const generic::NSEC3 rdata_nsec3(nsec3_txt);
EXPECT_EQ(0, rdata_nsec3.compare(
*rdataFactoryFromFile(RRType::NSEC3(), RRClass::IN(),
......@@ -98,8 +96,7 @@ TEST_F(Rdata_NSEC3_Test, createFromWire)
DNSMessageFORMERR);
}
TEST_F(Rdata_NSEC3_Test, toWireRenderer)
{
TEST_F(Rdata_NSEC3_Test, toWireRenderer) {
renderer.skip(2);
const generic::NSEC3 rdata_nsec3(nsec3_txt);
rdata_nsec3.toWire(renderer);
......@@ -111,14 +108,12 @@ TEST_F(Rdata_NSEC3_Test, toWireRenderer)
obuffer.getLength() - 2, &data[2], data.size() - 2);
}
TEST_F(Rdata_NSEC3_Test, toWireBuffer)
{
TEST_F(Rdata_NSEC3_Test, toWireBuffer) {
const generic::NSEC3 rdata_nsec3(nsec3_txt);
rdata_nsec3.toWire(obuffer);
}
TEST_F(Rdata_NSEC3_Test, assign)
{
TEST_F(Rdata_NSEC3_Test, assign) {
generic::NSEC3 rdata_nsec3(nsec3_txt);
generic::NSEC3 other_nsec3 = rdata_nsec3;
EXPECT_EQ(0, rdata_nsec3.compare(other_nsec3));
......
......@@ -41,35 +41,32 @@ class Rdata_NSEC3PARAM_Test : public RdataTest {
};
string nsec3param_txt("1 0 1 D399EAAB");
TEST_F(Rdata_NSEC3PARAM_Test, toText)
{
TEST_F(Rdata_NSEC3PARAM_Test, toText) {
const generic::NSEC3PARAM rdata_nsec3param(nsec3param_txt);
EXPECT_EQ(nsec3param_txt, rdata_nsec3param.toText());
}
TEST_F(Rdata_NSEC3PARAM_Test, badText)
{
TEST_F(Rdata_NSEC3PARAM_Test, badText) {
EXPECT_THROW(generic::NSEC3PARAM("1 1 1 SPORK"), BadHexString);
EXPECT_THROW(generic::NSEC3PARAM("100000 1 1 ADDAFEE"), InvalidRdataText);
EXPECT_THROW(generic::NSEC3PARAM("1 100000 1 ADDAFEE"), InvalidRdataText);
EXPECT_THROW(generic::NSEC3PARAM("1 1 100000 ADDAFEE"), InvalidRdataText);
EXPECT_THROW(generic::NSEC3PARAM("1"), InvalidRdataText);
}
#if 0 // this currently fails
TEST_F(Rdata_NSEC3PARAM_Test, DISABLED_badText) {
// this currently fails
EXPECT_THROW(generic::NSEC3PARAM("1 0 1D399EAAB"), InvalidRdataText);
#endif
}
TEST_F(Rdata_NSEC3PARAM_Test, createFromWire)
{
TEST_F(Rdata_NSEC3PARAM_Test, createFromWire) {
const generic::NSEC3PARAM rdata_nsec3param(nsec3param_txt);
EXPECT_EQ(0, rdata_nsec3param.compare(
*rdataFactoryFromFile(RRType::NSEC3PARAM(), RRClass::IN(),
"rdata_nsec3param_fromWire1")));
}
TEST_F(Rdata_NSEC3PARAM_Test, toWireRenderer)
{
TEST_F(Rdata_NSEC3PARAM_Test, toWireRenderer) {
renderer.skip(2);
const generic::NSEC3PARAM rdata_nsec3param(nsec3param_txt);
rdata_nsec3param.toWire(renderer);
......@@ -81,14 +78,12 @@ TEST_F(Rdata_NSEC3PARAM_Test, toWireRenderer)
obuffer.getLength() - 2, &data[2], data.size() - 2);
}
TEST_F(Rdata_NSEC3PARAM_Test, toWireBuffer)
{
TEST_F(Rdata_NSEC3PARAM_Test, toWireBuffer) {
const generic::NSEC3PARAM rdata_nsec3param(nsec3param_txt);
rdata_nsec3param.toWire(obuffer);
}
TEST_F(Rdata_NSEC3PARAM_Test, assign)
{
TEST_F(Rdata_NSEC3PARAM_Test, assign) {
generic::NSEC3PARAM rdata_nsec3param(nsec3param_txt);
generic::NSEC3PARAM other_nsec3param = rdata_nsec3param;
EXPECT_EQ(0, rdata_nsec3param.compare(other_nsec3param));
......
......@@ -38,8 +38,7 @@ class Rdata_RRSIG_Test : public RdataTest {
// there's nothing to specialize
};
TEST_F(Rdata_RRSIG_Test, fromText)
{
TEST_F(Rdata_RRSIG_Test, fromText) {
string rrsig_txt("A 5 4 43200 20100223214617 20100222214617 8496 isc.org. "
"evxhlGx13mpKLVkKsjpGzycS5twtIoxOmlN14w9t5AgzGBmz"
"diGdLIrFabqr72af2rUq+UDBKMWXujwZTZUTws32sVldDPk/"
......@@ -50,8 +49,7 @@ TEST_F(Rdata_RRSIG_Test, fromText)
}
TEST_F(Rdata_RRSIG_Test, badText)
{
TEST_F(Rdata_RRSIG_Test, badText) {
EXPECT_THROW(const generic::RRSIG sig("SPORK"), InvalidRdataText);
EXPECT_THROW(const generic::RRSIG sig("A 555 4 43200 "
"20100223214617 20100222214617 8496 isc.org. "
......@@ -87,16 +85,16 @@ TEST_F(Rdata_RRSIG_Test, badText)
"20100223214617 20100222214617 8496 isc.org. "
"EEeeeeeeEEEeeeeeeGaaahAAAAAAAAHHHHHHHHHHH!="),
BadBase64String);
}
#if 0 // this currently fails
TEST_F(Rdata_RRSIG_Test, DISABLED_badText) {
// this currently fails
// no space between the tag and signer
EXPECT_THROW(generic::RRSIG("A 5 4 43200 20100223214617 20100222214617 "
"8496isc.org. ofc="), InvalidRdataText);
#endif
}
TEST_F(Rdata_RRSIG_Test, toWireRenderer)
{
TEST_F(Rdata_RRSIG_Test, toWireRenderer) {
string rrsig_txt("A 5 4 43200 20100223214617 20100222214617 8496 isc.org. "
"evxhlGx13mpKLVkKsjpGzycS5twtIoxOmlN14w9t5AgzGBmz"
"diGdLIrFabqr72af2rUq+UDBKMWXujwZTZUTws32sVldDPk/"
......@@ -106,8 +104,7 @@ TEST_F(Rdata_RRSIG_Test, toWireRenderer)
rdata_rrsig.toWire(renderer);
}
TEST_F(Rdata_RRSIG_Test, toWireBuffer)
{
TEST_F(Rdata_RRSIG_Test, toWireBuffer) {
string rrsig_txt("A 5 4 43200 20100223214617 20100222214617 8496 isc.org. "
"evxhlGx13mpKLVkKsjpGzycS5twtIoxOmlN14w9t5AgzGBmz"
"diGdLIrFabqr72af2rUq+UDBKMWXujwZTZUTws32sVldDPk/"
......@@ -117,8 +114,7 @@ TEST_F(Rdata_RRSIG_Test, toWireBuffer)
rdata_rrsig.toWire(obuffer);
}
TEST_F(Rdata_RRSIG_Test, createFromWire)
{
TEST_F(Rdata_RRSIG_Test, createFromWire) {
string rrsig_txt("A 5 2 43200 20100327070149 20100225070149 2658 isc.org. "
"HkJk/xZTvzePU8NENl/ley8bbUumhk1hXciyqhLnz1VQFzkDooej6neX"
"ZgWZzQKeTKPOYWrnYtdZW4PnPQFeUl3orgLev7F8J6FZlDn0y/J/ThR5"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment