Skip to content

Commit

Permalink
"Unittests" for getBestPublicIp() & getNetworkInterfaces()
Browse files Browse the repository at this point in the history
The unit-tests only call the said functions and print their output
which should then be examined by the maintainer.
  • Loading branch information
veloman-yunkan committed Jun 3, 2024
1 parent be0874c commit 1caa1fd
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/otherTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,30 @@ TEST(I18n, parseUserLanguagePreferences)
"{fr, 1}{en, 0.5}"
);
}

#include "../include/tools.h"

TEST(networkTools, getNetworkInterfacesIPv4Or6)
{
for ( const auto& kv : kiwix::getNetworkInterfacesIPv4Or6() ) {
std::cout << kv.first << " : IPv4 addr = " << kv.second.addr
<< " ; IPv6 addr = " << kv.second.addr6
<< std::endl;
}
}

TEST(networkTools, getNetworkInterfaces)
{
for ( const auto& kv : kiwix::getNetworkInterfaces() ) {
std::cout << kv.first << " : IPv4 addr = " << kv.second << std::endl;
}
}

TEST(networkTools, getBestPublicIp)
{
using kiwix::getBestPublicIp;

std::cout << "getBestPublicIp(true) " << getBestPublicIp(true) << std::endl;
std::cout << "getBestPublicIp(false) " << getBestPublicIp(false) << std::endl;
std::cout << "getBestPublicIp() " << getBestPublicIp() << std::endl;
}

0 comments on commit 1caa1fd

Please sign in to comment.