Remove dependency on system netlibs for ip test

This commit is contained in:
Danny Robson 2013-08-05 21:45:30 +10:00
parent 28bfa42ec3
commit e67e0329fa
2 changed files with 2 additions and 20 deletions

View File

@ -25,8 +25,9 @@ TEST_BIN = \
AM_DEFAULT_SOURCE_EXT = .cpp
LDADD = $(builddir)/../libutil.la
if PLATFORM_WIN32
hton_LDFLAGS = -lws2_32
ip_LDFLAGS = -lws2_32
endif
TESTS = $(TEST_BIN) json.pl
check_PROGRAMS = $(TEST_BIN)

View File

@ -7,13 +7,6 @@
#include <cstdlib>
#if defined(PLATFORM_WIN32)
#include <ws2tcpip.h>
#else
#include <arpa/inet.h>
#endif
using namespace std;
@ -31,18 +24,6 @@ main (int, char **) {
for (unsigned int i = 0; i < elems (data); ++i) {
ipv4::ip parsed (ipv4::ip::parse (data[i].str));
CHECK_HARD (parsed == data[i].ip);
uint32_t mine = *(uint32_t*)(parsed.m_octets);
struct addrinfo *theirs;
int err = getaddrinfo (data[i].str, nullptr, nullptr, &theirs);
CHECK_EQ (err, 0);
CHECK_EQ (mine, reinterpret_cast<sockaddr_in*> (theirs)->sin_addr.s_addr);
//CHECK_HARD (inet_pton (AF_INET, data[i].str, &theirs) == 1);
//CHECK_HARD (theirs == mine);
}
return EXIT_SUCCESS;