Commit 3e964a48 authored by Mukund Sivaraman's avatar Mukund Sivaraman Committed by JINMEI Tatuya
Browse files

[2497] Add tests for NSEC3, NSEC and TSIG rrtypes

parent 8e32eb96
......@@ -130,6 +130,20 @@ TEST_F(Rdata_NSEC3_Test, createFromWire) {
}
}
TEST_F(Rdata_NSEC3_Test, createFromLexer) {
const generic::NSEC3 rdata_nsec3(nsec3_txt);
EXPECT_EQ(0, rdata_nsec3.compare(
*test::createRdataUsingLexer(RRType::NSEC3(), RRClass::IN(),
nsec3_txt)));
// Check that bad input throws as usual (next hash shouldn't be
// padded)
EXPECT_THROW({
*test::createRdataUsingLexer(RRType::NSEC3(), RRClass::IN(),
"1 1 1 ADDAFEEE CPNMU=== A NS SOA");
}, InvalidRdataText);
}
TEST_F(Rdata_NSEC3_Test, assign) {
generic::NSEC3 rdata_nsec3(nsec3_txt);
generic::NSEC3 other_nsec3 = rdata_nsec3;
......
......@@ -66,6 +66,19 @@ TEST_F(Rdata_NSEC_Test, createFromWire_NSEC) {
// Invalid bitmap cases are tested in Rdata_NSECBITMAP_Test.
}
TEST_F(Rdata_NSEC_Test, createFromLexer_NSEC) {
const generic::NSEC rdata_nsec(nsec_txt);
EXPECT_EQ(0, rdata_nsec.compare(
*test::createRdataUsingLexer(RRType::NSEC(), RRClass::IN(),
nsec_txt)));
// Check that bad input throws as usual
EXPECT_THROW({
*test::createRdataUsingLexer(RRType::NSEC(), RRClass::IN(),
"www.isc.org.");
}, InvalidRdataText);
}
TEST_F(Rdata_NSEC_Test, toWireRenderer_NSEC) {
renderer.skip(2);
const generic::NSEC rdata_nsec(nsec_txt);
......
......@@ -247,6 +247,18 @@ TEST_F(Rdata_TSIG_Test, createFromParams) {
isc::InvalidParameter);
}
TEST_F(Rdata_TSIG_Test, createFromLexer) {
EXPECT_EQ(0, rdata_tsig.compare(
*test::createRdataUsingLexer(RRType::TSIG(), RRClass::ANY(),
valid_text1)));
// Check that bad input throws as usual
EXPECT_THROW({
*test::createRdataUsingLexer(RRType::TSIG(), RRClass::ANY(),
"foo 0 0 0 0 BADKEY 0 0");
}, InvalidRdataText);
}
TEST_F(Rdata_TSIG_Test, assignment) {
any::TSIG copy((string(valid_text2)));
copy = rdata_tsig;
......
Markdown is supported
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