File: test-rec-system-resolve.cc

package info (click to toggle)
pdns-recursor 5.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,116 kB
  • sloc: cpp: 109,650; javascript: 20,651; python: 5,657; sh: 5,094; makefile: 780; ansic: 582; xml: 37
file content (25 lines) | stat: -rw-r--r-- 763 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef BOOST_TEST_DYN_LINK
#define BOOST_TEST_DYN_LINK
#endif

#include <boost/test/unit_test.hpp>

#include "rec-system-resolve.hh"

BOOST_AUTO_TEST_SUITE(rec_system_resolve)

BOOST_AUTO_TEST_CASE(test_basic_resolve)
{

  pdns::RecResolve::setInstanceParameters("foo", 60, 10, false, nullptr);
  auto& sysResolve = pdns::RecResolve::getInstance();

  auto address = sysResolve.lookupAndRegister("localhost", time(nullptr));
  BOOST_CHECK(address.toString() == "127.0.0.1" || address.toString() == "::1");
  address = sysResolve.lookup("localhost");
  BOOST_CHECK(address.toString() == "127.0.0.1" || address.toString() == "::1");
  sysResolve.wipe("localhost");
  BOOST_CHECK_THROW(sysResolve.lookup("localhost"), PDNSException);
}

BOOST_AUTO_TEST_SUITE_END()