]> git.ipfire.org Git - thirdparty/pdns.git/blame - pdns/recursordist/test-rpzloader_cc.cc
rec: Remove unused getQueryLocalAddress stub in the unit tests
[thirdparty/pdns.git] / pdns / recursordist / test-rpzloader_cc.cc
CommitLineData
301148e6
OM
1#define BOOST_TEST_RPZ_LOADER
2#define BOOST_TEST_RPZ_LOADER
3#ifdef HAVE_CONFIG_H
4#include "config.h"
5#endif
6
7#include "rpzloader.hh"
050e6877
RG
8#include "syncres.hh"
9
301148e6
OM
10#include <boost/test/unit_test.hpp>
11
12// Provide stubs for some symbols
13bool g_logRPZChanges{false};
301148e6
OM
14
15BOOST_AUTO_TEST_SUITE(rpzloader_cc)
16
42dcf516
OM
17BOOST_AUTO_TEST_CASE(test_rpz_loader)
18{
301148e6
OM
19
20 string tests[][2] = {
42dcf516 21 {"32.3.2.168.192", "192.168.2.3/32"},
7c408ab4 22 {"27.73.2.168.192", "192.168.2.64/27"},
42dcf516
OM
23 {"24.0.2.168.192", "192.168.2.0/24"},
24 {"128.57.zz.1.0.db8.2001", "2001:db8:0:1::57/128"},
7c408ab4 25 {"48.zz.1.0.db8.2001", "2001:db8::/48"},
42dcf516
OM
26 {"128.5.C0A8.FFFF.0.1.0.db8.2001", "2001:db8:0:1:0:ffff:c0a8:5/128"},
27
28 {"21.0.248.44.5", "5.44.248.0/21"},
29 {"64.0.0.0.0.0.1.0.0.", "0:0:1::/64"},
30 {"64.zz.2.0.0", "0:0:2::/64"},
31 {"80.0.0.0.1.0.0.0.0", "::1:0:0:0/80"},
32 {"80.0.0.0.1.zz", "::1:0:0:0/80"}};
33
34 for (auto& test : tests) {
301148e6
OM
35 Netmask n = makeNetmaskFromRPZ(DNSName(test[0]));
36 BOOST_CHECK_EQUAL(n.toString(), test[1]);
37 }
38}
39
40BOOST_AUTO_TEST_SUITE_END()