virtual std::string toText() const;
+ virtual bool isSameKind(const AbstractRRset& other) {
+ const AbstractRRset* t = &other;
+ const RBNodeRRset* rb;
+
+ rb = dynamic_cast<const RBNodeRRset*>(t);
+ if (rb)
+ return (this == rb);
+ else
+ return AbstractRRset::isSameKind(other);
+ }
+
virtual unsigned int toWire(
isc::dns::AbstractMessageRenderer& renderer) const;
EXPECT_THROW(rrset_a_empty.toText(), EmptyRRset);
}
+TEST_F(RBNodeRRsetTest, isSameKind) {
+ RBNodeRRset rrset_p(ConstRRsetPtr(new RRset(test_name, RRClass::IN(), RRType::A(), RRTTL(3600))));
+ RBNodeRRset rrset_q(ConstRRsetPtr(new RRset(test_name, RRClass::IN(), RRType::A(), RRTTL(3600))));
+ RRset rrset_w(test_name, RRClass::IN(), RRType::A(), RRTTL(3600));
+ RRset rrset_x(test_name, RRClass::IN(), RRType::A(), RRTTL(3600));
+ RRset rrset_y(test_name, RRClass::IN(), RRType::NS(), RRTTL(3600));
+ RRset rrset_z(test_name, RRClass::CH(), RRType::A(), RRTTL(3600));
+
+ EXPECT_TRUE(rrset_p.isSameKind(rrset_p));
+ EXPECT_FALSE(rrset_p.isSameKind(rrset_q));
+
+ EXPECT_TRUE(rrset_p.isSameKind(rrset_w));
+ EXPECT_TRUE(rrset_p.isSameKind(rrset_x));
+ EXPECT_FALSE(rrset_p.isSameKind(rrset_y));
+ EXPECT_FALSE(rrset_p.isSameKind(rrset_z));
+}
+
// Note: although the next two tests are essentially the same and used common
// test code, they use different test data: the MessageRenderer produces
// compressed wire data whereas the OutputBuffer does not.