]>
git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/test-dnsrecordcontent.cc
1 #define BOOST_TEST_DYN_LINK
2 #define BOOST_TEST_NO_MAIN
6 #include <boost/test/unit_test.hpp>
7 #include "dnsrecords.hh"
10 BOOST_AUTO_TEST_SUITE(test_dnsrecordcontent
)
12 BOOST_AUTO_TEST_CASE(test_equality
) {
13 ComboAddress
ip("1.2.3.4"), ip2("10.0.0.1"), ip6("::1");
14 ARecordContent
a1(ip
), a2(ip
), a3(ip2
);
15 AAAARecordContent
aaaa(ip6
), aaaa1(ip6
);
18 BOOST_CHECK(!(a1
==a3
));
20 BOOST_CHECK(aaaa
== aaaa1
);
23 auto rec1
=DNSRecordContent::mastermake(QType::A
, 1, "192.168.0.1");
24 auto rec2
=DNSRecordContent::mastermake(QType::A
, 1, "192.168.222.222");
25 auto rec3
=DNSRecordContent::mastermake(QType::AAAA
, 1, "::1");
26 auto recMX
=DNSRecordContent::mastermake(QType::MX
, 1, "25 smtp.powerdns.com");
27 auto recMX2
=DNSRecordContent::mastermake(QType::MX
, 1, "26 smtp.powerdns.com");
28 auto recMX3
=DNSRecordContent::mastermake(QType::MX
, 1, "26 SMTP.powerdns.com");
29 BOOST_CHECK(!(*rec1
==*rec2
));
30 BOOST_CHECK(*rec1
==*rec1
);
31 BOOST_CHECK(*rec3
==*rec3
);
33 BOOST_CHECK(*recMX
==*recMX
);
34 BOOST_CHECK(*recMX2
==*recMX3
);
35 BOOST_CHECK(!(*recMX
==*recMX3
));
38 BOOST_CHECK(!(*rec1
==*rec3
));
40 NSRecordContent
ns1(DNSName("ns1.powerdns.com")), ns2(DNSName("NS1.powerdns.COM")), ns3(DNSName("powerdns.net"));
41 BOOST_CHECK(ns1
==ns2
);
42 BOOST_CHECK(!(ns1
==ns3
));
45 BOOST_AUTO_TEST_SUITE_END()