diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 14 | ||||
-rw-r--r-- | tests/unit_tests/dns_resolver.cpp | 27 |
2 files changed, 25 insertions, 16 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 92c21dad9..14695ddd8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -61,16 +61,16 @@ add_executable(unit_tests ${UNIT_TESTS}) add_executable(net_load_tests_clt net_load_tests/clt.cpp) add_executable(net_load_tests_srv net_load_tests/srv.cpp) -target_link_libraries(core_proxy cryptonote_core common crypto ${UNBOUND_LIBRARIES} ${UPNP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) -target_link_libraries(coretests cryptonote_core common crypto ${UNBOUND_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) +target_link_libraries(core_proxy cryptonote_core common crypto ${UNBOUND_LIBRARIES} ${UPNP_LIBRARIES} ${Boost_LIBRARIES}) +target_link_libraries(coretests cryptonote_core common crypto ${UNBOUND_LIBRARIES} ${Boost_LIBRARIES}) target_link_libraries(difficulty-tests cryptonote_core) -target_link_libraries(functional_tests cryptonote_core wallet common crypto ${UNBOUND_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) +target_link_libraries(functional_tests cryptonote_core wallet common crypto ${UNBOUND_LIBRARIES} ${Boost_LIBRARIES}) target_link_libraries(hash-tests crypto) target_link_libraries(hash-target-tests crypto cryptonote_core) -target_link_libraries(performance_tests cryptonote_core common crypto ${UNBOUND_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) -target_link_libraries(unit_tests gtest_main cryptonote_core wallet crypto common ${UNBOUND_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) -target_link_libraries(net_load_tests_clt cryptonote_core common crypto gtest_main ${UNBOUND_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) -target_link_libraries(net_load_tests_srv cryptonote_core common crypto gtest_main ${UNBOUND_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) +target_link_libraries(performance_tests cryptonote_core common crypto ${UNBOUND_LIBRARIES} ${Boost_LIBRARIES}) +target_link_libraries(unit_tests gtest_main cryptonote_core wallet crypto common ${UNBOUND_LIBRARIES} ${Boost_LIBRARIES}) +target_link_libraries(net_load_tests_clt cryptonote_core common crypto gtest_main ${UNBOUND_LIBRARIES} ${Boost_LIBRARIES}) +target_link_libraries(net_load_tests_srv cryptonote_core common crypto gtest_main ${UNBOUND_LIBRARIES} ${Boost_LIBRARIES}) if(NOT MSVC) set_property(TARGET gtest gtest_main unit_tests net_load_tests_clt net_load_tests_srv APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-sign-compare") diff --git a/tests/unit_tests/dns_resolver.cpp b/tests/unit_tests/dns_resolver.cpp index 27e981ef1..d4b0efe43 100644 --- a/tests/unit_tests/dns_resolver.cpp +++ b/tests/unit_tests/dns_resolver.cpp @@ -37,13 +37,15 @@ TEST(DNSResolver, IPv4Success) { tools::DNSResolver resolver; - auto ips = resolver.get_ipv4("example.com"); + bool avail, valid; + + auto ips = resolver.get_ipv4("example.com", avail, valid); ASSERT_EQ(1, ips.size()); ASSERT_STREQ("93.184.216.119", ips[0].c_str()); - ips = tools::DNSResolver::instance().get_ipv4("example.com"); + ips = tools::DNSResolver::instance().get_ipv4("example.com", avail, valid); ASSERT_EQ(1, ips.size()); @@ -55,11 +57,13 @@ TEST(DNSResolver, IPv4Failure) // guaranteed by IANA/ICANN/RFC to be invalid tools::DNSResolver resolver; - auto ips = resolver.get_ipv4("example.invalid"); + bool avail, valid; + + auto ips = resolver.get_ipv4("example.invalid", avail, valid); ASSERT_EQ(0, ips.size()); - ips = tools::DNSResolver::instance().get_ipv4("example.invalid"); + ips = tools::DNSResolver::instance().get_ipv4("example.invalid", avail, valid); ASSERT_EQ(0, ips.size()); } @@ -68,13 +72,15 @@ TEST(DNSResolver, IPv6Success) { tools::DNSResolver resolver; - auto ips = resolver.get_ipv6("example.com"); + bool avail, valid; + + auto ips = resolver.get_ipv6("example.com", avail, valid); ASSERT_EQ(1, ips.size()); ASSERT_STREQ("2606:2800:220:6d:26bf:1447:1097:aa7", ips[0].c_str()); - ips = tools::DNSResolver::instance().get_ipv6("example.com"); + ips = tools::DNSResolver::instance().get_ipv6("example.com", avail, valid); ASSERT_EQ(1, ips.size()); @@ -86,19 +92,22 @@ TEST(DNSResolver, IPv6Failure) // guaranteed by IANA/ICANN/RFC to be invalid tools::DNSResolver resolver; - auto ips = resolver.get_ipv6("example.invalid"); + bool avail, valid; + + auto ips = resolver.get_ipv6("example.invalid", avail, valid); ASSERT_EQ(0, ips.size()); - ips = tools::DNSResolver::instance().get_ipv6("example.invalid"); + ips = tools::DNSResolver::instance().get_ipv6("example.invalid", avail, valid); ASSERT_EQ(0, ips.size()); } TEST(DNSResolver, GetTXTRecord) { + bool avail, valid; - std::vector<std::string> records = tools::DNSResolver::instance().get_txt_record("donate.monero.cc"); + std::vector<std::string> records = tools::DNSResolver::instance().get_txt_record("donate.monero.cc", avail, valid); EXPECT_NE(0, records.size()); |