/*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2014-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <sstream>
#include <system_error>
-#include <folly/Array.h>
#include <folly/String.h>
+#include <folly/container/Array.h>
#include <folly/experimental/TestUtil.h>
#include <folly/portability/GTest.h>
#include <folly/portability/Sockets.h>
unix3.setFromPath("/bar");
SocketAddress unixAnon;
unixAnon.setFromPath("");
+ auto unix5 = SocketAddress::makeFromPath("/foo");
+ auto unixAnon2 = SocketAddress::makeFromPath("");
EXPECT_EQ(unix1, unix2);
+ EXPECT_EQ(unix1, unix5);
EXPECT_EQ(unix1.hash(), unix2.hash());
+ EXPECT_EQ(unix1.hash(), unix5.hash());
EXPECT_NE(unix1, unix3);
EXPECT_NE(unix1, unixAnon);
+ EXPECT_NE(unix1, unixAnon2);
EXPECT_NE(unix2, unix3);
+ EXPECT_NE(unix5, unix3);
EXPECT_NE(unix2, unixAnon);
+ EXPECT_NE(unix2, unixAnon2);
+ EXPECT_NE(unix5, unixAnon);
+ EXPECT_NE(unix5, unixAnon2);
// anonymous addresses aren't equal to any other address,
// including themselves
EXPECT_NE(unixAnon, unixAnon);
+ EXPECT_NE(unixAnon2, unixAnon2);
// It isn't strictly required that hashes for different addresses be
// different, but we should have very few collisions. It generally indicates
EXPECT_NE(unix1.hash(), unix3.hash());
EXPECT_NE(unix1.hash(), unixAnon.hash());
EXPECT_NE(unix3.hash(), unixAnon.hash());
+ EXPECT_NE(unix1.hash(), unixAnon2.hash());
+ EXPECT_NE(unix3.hash(), unixAnon2.hash());
}
TEST(SocketAddress, IsPrivate) {