2018-01-15 21:03:07 +08:00
|
|
|
#include "gmock/gmock.h"
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
2018-05-29 17:13:13 +08:00
|
|
|
#include "io/network/utils.hpp"
|
2018-01-15 21:03:07 +08:00
|
|
|
|
2018-05-29 17:13:13 +08:00
|
|
|
using namespace io::network;
|
2018-01-15 21:03:07 +08:00
|
|
|
|
|
|
|
TEST(ResolveHostname, Simple) {
|
|
|
|
auto result = ResolveHostname("localhost");
|
|
|
|
EXPECT_TRUE(result == "127.0.0.1" || result == "::1");
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(ResolveHostname, PassThroughIpv4) {
|
|
|
|
auto result = ResolveHostname("127.0.0.1");
|
|
|
|
EXPECT_EQ(result, "127.0.0.1");
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(ResolveHostname, PassThroughIpv6) {
|
|
|
|
auto result = ResolveHostname("::1");
|
|
|
|
EXPECT_EQ(result, "::1");
|
|
|
|
}
|