diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-26 19:24:53 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-26 19:24:53 +0000 |
| commit | 5060b64b7d79491d507a75201be161fd0c38fcbb (patch) | |
| tree | f4791d04b99ac52da01e646e5a6c9ce22ade61b9 /unittests/Host/SocketAddressTest.cpp | |
| parent | d44a35e87e405ae98902dc491ba70ed82f58f592 (diff) | |
Notes
Diffstat (limited to 'unittests/Host/SocketAddressTest.cpp')
| -rw-r--r-- | unittests/Host/SocketAddressTest.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/unittests/Host/SocketAddressTest.cpp b/unittests/Host/SocketAddressTest.cpp index 3c18137ac063..17f9ccc19028 100644 --- a/unittests/Host/SocketAddressTest.cpp +++ b/unittests/Host/SocketAddressTest.cpp @@ -12,8 +12,21 @@ #include "lldb/Host/SocketAddress.h" namespace { -class SocketAddressTest : public ::testing::Test {}; -} +class SocketAddressTest : public testing::Test { +public: + static void SetUpTestCase() { +#ifdef _MSC_VER + WSADATA data; + ASSERT_EQ(0, WSAStartup(MAKEWORD(2, 2), &data)); +#endif + } + static void TearDownTestCase() { +#ifdef _MSC_VER + ASSERT_EQ(0, WSACleanup()); +#endif + } +}; +} // namespace using namespace lldb_private; @@ -34,6 +47,14 @@ TEST_F(SocketAddressTest, Set) { ASSERT_EQ(1139, sa.GetPort()); } +TEST_F(SocketAddressTest, GetAddressInfo) { + auto addr = SocketAddress::GetAddressInfo("127.0.0.1", nullptr, AF_UNSPEC, + SOCK_STREAM, IPPROTO_TCP); + ASSERT_EQ(1u, addr.size()); + EXPECT_EQ(AF_INET, addr[0].GetFamily()); + EXPECT_EQ("127.0.0.1", addr[0].GetIPAddress()); +} + #ifdef _WIN32 // we need to test our inet_ntop implementation for Windows XP |
