Remove dependency on system netlibs for ip test
This commit is contained in:
parent
28bfa42ec3
commit
e67e0329fa
@ -25,8 +25,9 @@ TEST_BIN = \
|
|||||||
AM_DEFAULT_SOURCE_EXT = .cpp
|
AM_DEFAULT_SOURCE_EXT = .cpp
|
||||||
LDADD = $(builddir)/../libutil.la
|
LDADD = $(builddir)/../libutil.la
|
||||||
|
|
||||||
|
if PLATFORM_WIN32
|
||||||
hton_LDFLAGS = -lws2_32
|
hton_LDFLAGS = -lws2_32
|
||||||
ip_LDFLAGS = -lws2_32
|
endif
|
||||||
|
|
||||||
TESTS = $(TEST_BIN) json.pl
|
TESTS = $(TEST_BIN) json.pl
|
||||||
check_PROGRAMS = $(TEST_BIN)
|
check_PROGRAMS = $(TEST_BIN)
|
||||||
|
19
test/ip.cpp
19
test/ip.cpp
@ -7,13 +7,6 @@
|
|||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#if defined(PLATFORM_WIN32)
|
|
||||||
#include <ws2tcpip.h>
|
|
||||||
#else
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
@ -31,18 +24,6 @@ main (int, char **) {
|
|||||||
for (unsigned int i = 0; i < elems (data); ++i) {
|
for (unsigned int i = 0; i < elems (data); ++i) {
|
||||||
ipv4::ip parsed (ipv4::ip::parse (data[i].str));
|
ipv4::ip parsed (ipv4::ip::parse (data[i].str));
|
||||||
CHECK_HARD (parsed == data[i].ip);
|
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;
|
return EXIT_SUCCESS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user