]>
git.ipfire.org Git - thirdparty/pdns.git/blob - pdns/recursordist/test-rpzloader_cc.cc
1 #define BOOST_TEST_RPZ_LOADER
2 #define BOOST_TEST_RPZ_LOADER
7 #include "rpzloader.hh"
10 #include <boost/test/unit_test.hpp>
12 // Provide stubs for some symbols
13 bool g_logRPZChanges
{false};
14 ComboAddress
getQueryLocalAddress(int family
, uint16_t port
)
16 cerr
<< "getQueryLocalAddress() STUBBED IN TEST!" << endl
;
18 return ComboAddress();
21 BOOST_AUTO_TEST_SUITE(rpzloader_cc
)
23 BOOST_AUTO_TEST_CASE(test_rpz_loader
)
27 {"32.3.2.168.192", "192.168.2.3/32"},
28 {"27.73.2.168.192", "192.168.2.64/27"},
29 {"24.0.2.168.192", "192.168.2.0/24"},
30 {"128.57.zz.1.0.db8.2001", "2001:db8:0:1::57/128"},
31 {"48.zz.1.0.db8.2001", "2001:db8::/48"},
32 {"128.5.C0A8.FFFF.0.1.0.db8.2001", "2001:db8:0:1:0:ffff:c0a8:5/128"},
34 {"21.0.248.44.5", "5.44.248.0/21"},
35 {"64.0.0.0.0.0.1.0.0.", "0:0:1::/64"},
36 {"64.zz.2.0.0", "0:0:2::/64"},
37 {"80.0.0.0.1.0.0.0.0", "::1:0:0:0/80"},
38 {"80.0.0.0.1.zz", "::1:0:0:0/80"}};
40 for (auto& test
: tests
) {
41 Netmask n
= makeNetmaskFromRPZ(DNSName(test
[0]));
42 BOOST_CHECK_EQUAL(n
.toString(), test
[1]);
46 BOOST_AUTO_TEST_SUITE_END()