1 #include "async_resolve.hpp"
2 
3 #include <boost/asio/ip/tcp.hpp>
4 
5 #include <gmock/gmock.h>
6 
7 TEST(AsyncResolve, ipv4Positive)
8 {
9     boost::asio::ip::tcp::endpoint ep;
10     ASSERT_TRUE(async_resolve::endpointFromResolveTuple({1, 2, 3, 4}, ep));
11     EXPECT_TRUE(ep.address().is_v4());
12     EXPECT_FALSE(ep.address().is_v6());
13 
14     EXPECT_EQ(ep.address().to_string(), "1.2.3.4");
15 }
16 
17 TEST(AsyncResolve, ipv6Positive)
18 {
19     boost::asio::ip::tcp::endpoint ep;
20     ASSERT_TRUE(async_resolve::endpointFromResolveTuple(
21         {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}, ep));
22     EXPECT_FALSE(ep.address().is_v4());
23     EXPECT_TRUE(ep.address().is_v6());
24     EXPECT_EQ(ep.address().to_string(), "102:304:506:708:90a:b0c:d0e:f10");
25 }
26