2 * Copyright 2014, Haiku, inc.
3 * Distributed under the terms of the MIT licence
7 #include "GetAddrInfo.h"
10 #include <sys/socket.h>
13 #include <cppunit/TestCaller.h>
14 #include <cppunit/TestSuite.h>
17 GetAddrInfoTest::GetAddrInfoTest()
22 GetAddrInfoTest::~GetAddrInfoTest()
28 GetAddrInfoTest::EmptyTest()
30 struct addrinfo
* info
;
32 hint
.ai_family
= AF_INET
;
33 hint
.ai_flags
= AI_PASSIVE
;
35 // Trying to resolve an empty host...
36 int result
= getaddrinfo("", NULL
, &hint
, &info
);
41 // getaddrinfo shouldn't suggest that this may work better by trying again.
42 CPPUNIT_ASSERT(result
!= EAI_AGAIN
);
47 GetAddrInfoTest::AddTests(BTestSuite
& parent
)
49 CppUnit::TestSuite
& suite
= *new CppUnit::TestSuite("GetAddrInfoTest");
51 suite
.addTest(new CppUnit::TestCaller
<GetAddrInfoTest
>(
52 "GetAddrInfoTest::EmptyTest", &GetAddrInfoTest::EmptyTest
));
54 parent
.addTest("GetAddrInfoTest", &suite
);