aboutsummaryrefslogtreecommitdiff
path: root/lldb/unittests/Host/SocketAddressTest.cpp
diff options
context:
space:
mode:
authorKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
committerKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
commitb9c1b51e45b845debb76d8658edabca70ca56079 (patch)
treedfcb5a13ef2b014202340f47036da383eaee74aa /lldb/unittests/Host/SocketAddressTest.cpp
parentd5aa73376966339caad04013510626ec2e42c760 (diff)
downloadllvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip
llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz
llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.bz2
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
Diffstat (limited to 'lldb/unittests/Host/SocketAddressTest.cpp')
-rw-r--r--lldb/unittests/Host/SocketAddressTest.cpp88
1 files changed, 42 insertions, 46 deletions
diff --git a/lldb/unittests/Host/SocketAddressTest.cpp b/lldb/unittests/Host/SocketAddressTest.cpp
index 6b27e04c..3c18137 100644
--- a/lldb/unittests/Host/SocketAddressTest.cpp
+++ b/lldb/unittests/Host/SocketAddressTest.cpp
@@ -7,68 +7,64 @@
//
//===----------------------------------------------------------------------===//
-
#include "gtest/gtest.h"
#include "lldb/Host/SocketAddress.h"
-namespace
-{
- class SocketAddressTest: public ::testing::Test
- {
- };
+namespace {
+class SocketAddressTest : public ::testing::Test {};
}
using namespace lldb_private;
-TEST_F (SocketAddressTest, Set)
-{
- SocketAddress sa;
- ASSERT_TRUE (sa.SetToLocalhost (AF_INET, 1138));
- ASSERT_STREQ ("127.0.0.1", sa.GetIPAddress ().c_str ());
- ASSERT_EQ (1138, sa.GetPort ());
+TEST_F(SocketAddressTest, Set) {
+ SocketAddress sa;
+ ASSERT_TRUE(sa.SetToLocalhost(AF_INET, 1138));
+ ASSERT_STREQ("127.0.0.1", sa.GetIPAddress().c_str());
+ ASSERT_EQ(1138, sa.GetPort());
- ASSERT_TRUE (sa.SetToAnyAddress (AF_INET, 0));
- ASSERT_STREQ ("0.0.0.0", sa.GetIPAddress ().c_str ());
- ASSERT_EQ (0, sa.GetPort ());
+ ASSERT_TRUE(sa.SetToAnyAddress(AF_INET, 0));
+ ASSERT_STREQ("0.0.0.0", sa.GetIPAddress().c_str());
+ ASSERT_EQ(0, sa.GetPort());
- ASSERT_TRUE (sa.SetToLocalhost (AF_INET6, 1139));
- ASSERT_TRUE(sa.GetIPAddress() == "::1" || sa.GetIPAddress() == "0:0:0:0:0:0:0:1") << "Address was: "
- << sa.GetIPAddress();
- ASSERT_EQ (1139, sa.GetPort ());
+ ASSERT_TRUE(sa.SetToLocalhost(AF_INET6, 1139));
+ ASSERT_TRUE(sa.GetIPAddress() == "::1" ||
+ sa.GetIPAddress() == "0:0:0:0:0:0:0:1")
+ << "Address was: " << sa.GetIPAddress();
+ ASSERT_EQ(1139, sa.GetPort());
}
#ifdef _WIN32
// we need to test our inet_ntop implementation for Windows XP
-const char* inet_ntop (int af, const void * src,
- char * dst, socklen_t size);
+const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
-TEST_F (SocketAddressTest, inet_ntop)
-{
- const uint8_t address4[4] = {255, 0, 1, 100};
- const uint8_t address6[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 255, 0};
-
- char buffer[INET6_ADDRSTRLEN];
- memset (buffer, 'x', sizeof (buffer));
- EXPECT_STREQ ("1:203:405:607:809:a0b:c0d:ff00", inet_ntop (AF_INET6, address6, buffer, sizeof (buffer)));
- memset (buffer, 'x', sizeof (buffer));
- EXPECT_STREQ ("1:203:405:607:809:a0b:c0d:ff00", inet_ntop (AF_INET6, address6, buffer, 31));
- memset (buffer, 'x', sizeof (buffer));
- EXPECT_STREQ (nullptr, inet_ntop (AF_INET6, address6, buffer, 0));
- memset (buffer, 'x', sizeof (buffer));
- EXPECT_STREQ (nullptr, inet_ntop (AF_INET6, address6, buffer, 30));
-
- memset (buffer, 'x', sizeof (buffer));
- EXPECT_STREQ ("255.0.1.100", inet_ntop (AF_INET, address4, buffer, sizeof (buffer)));
- memset (buffer, 'x', sizeof (buffer));
- EXPECT_STREQ ("255.0.1.100", inet_ntop (AF_INET, address4, buffer, 12));
- memset (buffer, 'x', sizeof (buffer));
- EXPECT_STREQ (nullptr, inet_ntop (AF_INET, address4, buffer, 0));
- memset (buffer, 'x', sizeof (buffer));
- EXPECT_STREQ (nullptr, inet_ntop (AF_INET, address4, buffer, 11));
-}
+TEST_F(SocketAddressTest, inet_ntop) {
+ const uint8_t address4[4] = {255, 0, 1, 100};
+ const uint8_t address6[16] = {0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 255, 0};
-#endif
+ char buffer[INET6_ADDRSTRLEN];
+ memset(buffer, 'x', sizeof(buffer));
+ EXPECT_STREQ("1:203:405:607:809:a0b:c0d:ff00",
+ inet_ntop(AF_INET6, address6, buffer, sizeof(buffer)));
+ memset(buffer, 'x', sizeof(buffer));
+ EXPECT_STREQ("1:203:405:607:809:a0b:c0d:ff00",
+ inet_ntop(AF_INET6, address6, buffer, 31));
+ memset(buffer, 'x', sizeof(buffer));
+ EXPECT_STREQ(nullptr, inet_ntop(AF_INET6, address6, buffer, 0));
+ memset(buffer, 'x', sizeof(buffer));
+ EXPECT_STREQ(nullptr, inet_ntop(AF_INET6, address6, buffer, 30));
+ memset(buffer, 'x', sizeof(buffer));
+ EXPECT_STREQ("255.0.1.100",
+ inet_ntop(AF_INET, address4, buffer, sizeof(buffer)));
+ memset(buffer, 'x', sizeof(buffer));
+ EXPECT_STREQ("255.0.1.100", inet_ntop(AF_INET, address4, buffer, 12));
+ memset(buffer, 'x', sizeof(buffer));
+ EXPECT_STREQ(nullptr, inet_ntop(AF_INET, address4, buffer, 0));
+ memset(buffer, 'x', sizeof(buffer));
+ EXPECT_STREQ(nullptr, inet_ntop(AF_INET, address4, buffer, 11));
+}
+#endif