Commit 5c8cd401 authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[2497] Add tests for OPT, PTR and RP rrtypes

parent 3563065b
......@@ -56,6 +56,14 @@ TEST_F(Rdata_OPT_Test, createFromWire) {
InvalidRdataLength);
}
TEST_F(Rdata_OPT_Test, createFromLexer) {
// OPT RR cannot be created from text.
EXPECT_THROW({
*test::createRdataUsingLexer(RRType::OPT(), RRClass::IN(),
"this does not matter");
}, InvalidRdataText);
}
TEST_F(Rdata_OPT_Test, toWireBuffer) {
rdata_opt.toWire(obuffer);
EXPECT_EQ(0, obuffer.getLength());
......
......@@ -90,6 +90,12 @@ TEST_F(Rdata_PTR_Test, createFromWire) {
InvalidRdataLength);
}
TEST_F(Rdata_PTR_Test, createFromLexer) {
EXPECT_EQ(0, rdata_ptr.compare(
*test::createRdataUsingLexer(RRType::PTR(), RRClass::IN(),
"ns.example.com")));
}
TEST_F(Rdata_PTR_Test, toWireBuffer) {
rdata_ptr.toWire(obuffer);
EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
......
......@@ -106,6 +106,19 @@ TEST_F(Rdata_RP_Test, createFromParams) {
EXPECT_EQ(text_name, generic::RP(mailbox_name, text_name).getText());
}
TEST_F(Rdata_RP_Test, createFromLexer) {
EXPECT_EQ(0, rdata_rp.compare(
*test::createRdataUsingLexer(RRType::RP(), RRClass::IN(),
"root.example.com. "
"rp-text.example.com.")));
// Check that bad input throws as usual
EXPECT_THROW({
*test::createRdataUsingLexer(RRType::RP(), RRClass::IN(),
"mailbox.example.com.");
}, InvalidRdataText);
}
TEST_F(Rdata_RP_Test, toWireBuffer) {
// construct expected data
UnitTestUtil::readWireData("rdata_rp_toWire1.wire", expected_wire);
......
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