]>
Commit | Line | Data |
---|---|---|
f18e430f | 1 | #define BOOST_TEST_DYN_LINK |
2 | #define BOOST_TEST_NO_MAIN | |
3 | #ifdef HAVE_CONFIG_H | |
4 | #include "config.h" | |
5 | #endif | |
6 | #include <boost/test/unit_test.hpp> | |
7 | #include "dnsrecords.hh" | |
8 | #include "iputils.hh" | |
9 | ||
10 | BOOST_AUTO_TEST_SUITE(test_dnsrecordcontent) | |
11 | ||
12 | BOOST_AUTO_TEST_CASE(test_equality) { | |
f18e430f | 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); | |
16 | ||
17 | BOOST_CHECK(a1==a2); | |
18 | BOOST_CHECK(!(a1==a3)); | |
19 | ||
20 | BOOST_CHECK(aaaa == aaaa1); | |
21 | ||
22 | ||
32122aab RG |
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"); | |
f18e430f | 29 | BOOST_CHECK(!(*rec1==*rec2)); |
30 | BOOST_CHECK(*rec1==*rec1); | |
31 | BOOST_CHECK(*rec3==*rec3); | |
32 | ||
33 | BOOST_CHECK(*recMX==*recMX); | |
34 | BOOST_CHECK(*recMX2==*recMX3); | |
35 | BOOST_CHECK(!(*recMX==*recMX3)); | |
36 | ||
37 | ||
38 | BOOST_CHECK(!(*rec1==*rec3)); | |
39 | ||
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)); | |
43 | } | |
44 | ||
45 | BOOST_AUTO_TEST_SUITE_END() |