Bug Summary

File:out/../test/cctest/test_sockaddr.cc
Warning:line 102, column 3
Value stored to 'foo' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name test_sockaddr.cc -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/home/maurizio/node-v18.6.0/out -resource-dir /usr/local/lib/clang/16.0.0 -D V8_DEPRECATION_WARNINGS -D V8_IMMINENT_DEPRECATION_WARNINGS -D _GLIBCXX_USE_CXX11_ABI=1 -D NODE_OPENSSL_CONF_NAME=nodejs_conf -D NODE_OPENSSL_HAS_QUIC -D __STDC_FORMAT_MACROS -D OPENSSL_NO_PINSHARED -D OPENSSL_THREADS -D NODE_ARCH="x64" -D NODE_PLATFORM="linux" -D NODE_WANT_INTERNALS=1 -D HAVE_OPENSSL=1 -D HAVE_INSPECTOR=1 -D __POSIX__ -D NODE_USE_V8_PLATFORM=1 -D NODE_HAVE_I18N_SUPPORT=1 -D OPENSSL_API_COMPAT=0x10100000L -D GTEST_HAS_POSIX_RE=0 -D GTEST_LANG_CXX11=1 -D UNIT_TEST -D UCONFIG_NO_SERVICE=1 -D U_ENABLE_DYLOAD=0 -D U_STATIC_IMPLEMENTATION=1 -D U_HAVE_STD_STRING=1 -D UCONFIG_NO_BREAK_ITERATION=0 -D _LARGEFILE_SOURCE -D _FILE_OFFSET_BITS=64 -D _POSIX_C_SOURCE=200112 -D NGHTTP2_STATICLIB -D NDEBUG -D OPENSSL_USE_NODELETE -D L_ENDIAN -D OPENSSL_BUILDING_OPENSSL -D AES_ASM -D BSAES_ASM -D CMLL_ASM -D ECP_NISTZ256_ASM -D GHASH_ASM -D KECCAK1600_ASM -D MD5_ASM -D OPENSSL_BN_ASM_GF2m -D OPENSSL_BN_ASM_MONT -D OPENSSL_BN_ASM_MONT5 -D OPENSSL_CPUID_OBJ -D OPENSSL_IA32_SSE2 -D PADLOCK_ASM -D POLY1305_ASM -D SHA1_ASM -D SHA256_ASM -D SHA512_ASM -D VPAES_ASM -D WHIRLPOOL_ASM -D X25519_ASM -D OPENSSL_PIC -D NGTCP2_STATICLIB -D NGHTTP3_STATICLIB -I ../src -I ../tools/msvs/genfiles -I ../deps/v8/include -I ../deps/cares/include -I ../deps/uv/include -I ../deps/uvwasi/include -I ../test/cctest -I ../deps/googletest/include -I ../deps/histogram/src -I ../deps/icu-small/source/i18n -I ../deps/icu-small/source/common -I ../deps/zlib -I ../deps/llhttp/include -I ../deps/nghttp2/lib/includes -I ../deps/brotli/c/include -I ../deps/openssl/openssl/include -I ../deps/openssl/openssl/crypto/include -I ../deps/openssl/config/archs/linux-x86_64/asm/include -I ../deps/openssl/config/archs/linux-x86_64/asm -I ../deps/ngtcp2 -I ../deps/ngtcp2/ngtcp2/lib/includes -I ../deps/ngtcp2/ngtcp2/crypto/includes -I ../deps/ngtcp2/nghttp3/lib/includes -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/x86_64-redhat-linux -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/backward -internal-isystem /usr/local/lib/clang/16.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/8/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wno-unused-parameter -Wno-unused-parameter -std=gnu++17 -fdeprecated-macro -fdebug-compilation-dir=/home/maurizio/node-v18.6.0/out -ferror-limit 19 -fno-rtti -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2022-08-22-142216-507842-1 -x c++ ../test/cctest/test_sockaddr.cc
1#include "node_sockaddr-inl.h"
2#include "gtest/gtest.h"
3
4using node::SocketAddress;
5using node::SocketAddressBlockList;
6using node::SocketAddressLRU;
7
8TEST(SocketAddress, SocketAddress)static_assert(sizeof("SocketAddress") > 1, "test_suite_name must not be empty"
); static_assert(sizeof("SocketAddress") > 1, "test_name must not be empty"
); class SocketAddress_SocketAddress_Test : public ::testing::
Test { public: SocketAddress_SocketAddress_Test() = default; ~
SocketAddress_SocketAddress_Test() override = default; SocketAddress_SocketAddress_Test
(SocketAddress_SocketAddress_Test const&) = delete; SocketAddress_SocketAddress_Test
& operator=(SocketAddress_SocketAddress_Test const&) =
delete; SocketAddress_SocketAddress_Test(SocketAddress_SocketAddress_Test
&&) noexcept = delete; SocketAddress_SocketAddress_Test
& operator=(SocketAddress_SocketAddress_Test&&) noexcept
= delete; private: void TestBody() override; static ::testing
::TestInfo* const test_info_ __attribute__ ((unused)); }; ::testing
::TestInfo* const SocketAddress_SocketAddress_Test::test_info_
= ::testing::internal::MakeAndRegisterTestInfo( "SocketAddress"
, "SocketAddress", nullptr, nullptr, ::testing::internal::CodeLocation
("../test/cctest/test_sockaddr.cc", 8), (::testing::internal::
GetTestTypeId()), ::testing::internal::SuiteApiResolver< ::
testing::Test>::GetSetUpCaseOrSuite("../test/cctest/test_sockaddr.cc"
, 8), ::testing::internal::SuiteApiResolver< ::testing::Test
>::GetTearDownCaseOrSuite("../test/cctest/test_sockaddr.cc"
, 8), new ::testing::internal::TestFactoryImpl<SocketAddress_SocketAddress_Test
>); void SocketAddress_SocketAddress_Test::TestBody()
{
9 CHECK(SocketAddress::is_numeric_host("123.123.123.123"))do { if (__builtin_expect(!!(!(SocketAddress::is_numeric_host
("123.123.123.123"))), 0)) { do { static const node::AssertionInfo
args = { "../test/cctest/test_sockaddr.cc" ":" "9", "SocketAddress::is_numeric_host(\"123.123.123.123\")"
, __PRETTY_FUNCTION__ }; node::Assert(args); } while (0); } }
while (0)
;
10 CHECK(!SocketAddress::is_numeric_host("localhost"))do { if (__builtin_expect(!!(!(!SocketAddress::is_numeric_host
("localhost"))), 0)) { do { static const node::AssertionInfo args
= { "../test/cctest/test_sockaddr.cc" ":" "10", "!SocketAddress::is_numeric_host(\"localhost\")"
, __PRETTY_FUNCTION__ }; node::Assert(args); } while (0); } }
while (0)
;
11
12 sockaddr_storage storage;
13 sockaddr_storage storage2;
14 SocketAddress::ToSockAddr(AF_INET2, "123.123.123.123", 443, &storage);
15 SocketAddress::ToSockAddr(AF_INET2, "1.1.1.1", 80, &storage2);
16
17 SocketAddress addr(reinterpret_cast<const sockaddr*>(&storage));
18 SocketAddress addr2(reinterpret_cast<const sockaddr*>(&storage2));
19
20 CHECK_EQ(addr.length(), sizeof(sockaddr_in))do { if (__builtin_expect(!!(!((addr.length()) == (sizeof(sockaddr_in
)))), 0)) { do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "20", "(addr.length()) == (sizeof(sockaddr_in))", __PRETTY_FUNCTION__
}; node::Assert(args); } while (0); } } while (0)
;
21 CHECK_EQ(addr.family(), AF_INET)do { if (__builtin_expect(!!(!((addr.family()) == (2))), 0)) {
do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "21", "(addr.family()) == (2)", __PRETTY_FUNCTION__ }; node
::Assert(args); } while (0); } } while (0)
;
22 CHECK_EQ(addr.address(), "123.123.123.123")do { if (__builtin_expect(!!(!((addr.address()) == ("123.123.123.123"
))), 0)) { do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "22", "(addr.address()) == (\"123.123.123.123\")", __PRETTY_FUNCTION__
}; node::Assert(args); } while (0); } } while (0)
;
23 CHECK_EQ(addr.port(), 443)do { if (__builtin_expect(!!(!((addr.port()) == (443))), 0)) {
do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "23", "(addr.port()) == (443)", __PRETTY_FUNCTION__ }; node
::Assert(args); } while (0); } } while (0)
;
24
25 addr.set_flow_label(12345);
26 CHECK_EQ(addr.flow_label(), 0)do { if (__builtin_expect(!!(!((addr.flow_label()) == (0))), 0
)) { do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "26", "(addr.flow_label()) == (0)", __PRETTY_FUNCTION__ }
; node::Assert(args); } while (0); } } while (0)
;
27
28 CHECK_NE(addr, addr2)do { if (__builtin_expect(!!(!((addr) != (addr2))), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "28", "(addr) != (addr2)", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
29 CHECK_EQ(addr, addr)do { if (__builtin_expect(!!(!((addr) == (addr))), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "29", "(addr) == (addr)", __PRETTY_FUNCTION__ }; node::Assert
(args); } while (0); } } while (0)
;
30
31 CHECK_EQ(SocketAddress::Hash()(addr), SocketAddress::Hash()(addr))do { if (__builtin_expect(!!(!((SocketAddress::Hash()(addr)) ==
(SocketAddress::Hash()(addr)))), 0)) { do { static const node
::AssertionInfo args = { "../test/cctest/test_sockaddr.cc" ":"
"31", "(SocketAddress::Hash()(addr)) == (SocketAddress::Hash()(addr))"
, __PRETTY_FUNCTION__ }; node::Assert(args); } while (0); } }
while (0)
;
32 CHECK_NE(SocketAddress::Hash()(addr), SocketAddress::Hash()(addr2))do { if (__builtin_expect(!!(!((SocketAddress::Hash()(addr)) !=
(SocketAddress::Hash()(addr2)))), 0)) { do { static const node
::AssertionInfo args = { "../test/cctest/test_sockaddr.cc" ":"
"32", "(SocketAddress::Hash()(addr)) != (SocketAddress::Hash()(addr2))"
, __PRETTY_FUNCTION__ }; node::Assert(args); } while (0); } }
while (0)
;
33
34 addr.Update(reinterpret_cast<uint8_t*>(&storage2), sizeof(sockaddr_in));
35 CHECK_EQ(addr.length(), sizeof(sockaddr_in))do { if (__builtin_expect(!!(!((addr.length()) == (sizeof(sockaddr_in
)))), 0)) { do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "35", "(addr.length()) == (sizeof(sockaddr_in))", __PRETTY_FUNCTION__
}; node::Assert(args); } while (0); } } while (0)
;
36 CHECK_EQ(addr.family(), AF_INET)do { if (__builtin_expect(!!(!((addr.family()) == (2))), 0)) {
do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "36", "(addr.family()) == (2)", __PRETTY_FUNCTION__ }; node
::Assert(args); } while (0); } } while (0)
;
37 CHECK_EQ(addr.address(), "1.1.1.1")do { if (__builtin_expect(!!(!((addr.address()) == ("1.1.1.1"
))), 0)) { do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "37", "(addr.address()) == (\"1.1.1.1\")", __PRETTY_FUNCTION__
}; node::Assert(args); } while (0); } } while (0)
;
38 CHECK_EQ(addr.port(), 80)do { if (__builtin_expect(!!(!((addr.port()) == (80))), 0)) {
do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "38", "(addr.port()) == (80)", __PRETTY_FUNCTION__ }; node
::Assert(args); } while (0); } } while (0)
;
39
40 SocketAddress::Map<size_t> map;
41 map[addr]++;
42 map[addr]++;
43 CHECK_EQ(map[addr], 2)do { if (__builtin_expect(!!(!((map[addr]) == (2))), 0)) { do
{ static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "43", "(map[addr]) == (2)", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
44}
45
46TEST(SocketAddress, SocketAddressIPv6)static_assert(sizeof("SocketAddress") > 1, "test_suite_name must not be empty"
); static_assert(sizeof("SocketAddressIPv6") > 1, "test_name must not be empty"
); class SocketAddress_SocketAddressIPv6_Test : public ::testing
::Test { public: SocketAddress_SocketAddressIPv6_Test() = default
; ~SocketAddress_SocketAddressIPv6_Test() override = default;
SocketAddress_SocketAddressIPv6_Test(SocketAddress_SocketAddressIPv6_Test
const&) = delete; SocketAddress_SocketAddressIPv6_Test&
operator=(SocketAddress_SocketAddressIPv6_Test const&) =
delete; SocketAddress_SocketAddressIPv6_Test(SocketAddress_SocketAddressIPv6_Test
&&) noexcept = delete; SocketAddress_SocketAddressIPv6_Test
& operator=(SocketAddress_SocketAddressIPv6_Test&&
) noexcept = delete; private: void TestBody() override; static
::testing::TestInfo* const test_info_ __attribute__ ((unused
)); }; ::testing::TestInfo* const SocketAddress_SocketAddressIPv6_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo( "SocketAddress"
, "SocketAddressIPv6", nullptr, nullptr, ::testing::internal::
CodeLocation("../test/cctest/test_sockaddr.cc", 46), (::testing
::internal::GetTestTypeId()), ::testing::internal::SuiteApiResolver
< ::testing::Test>::GetSetUpCaseOrSuite("../test/cctest/test_sockaddr.cc"
, 46), ::testing::internal::SuiteApiResolver< ::testing::Test
>::GetTearDownCaseOrSuite("../test/cctest/test_sockaddr.cc"
, 46), new ::testing::internal::TestFactoryImpl<SocketAddress_SocketAddressIPv6_Test
>); void SocketAddress_SocketAddressIPv6_Test::TestBody()
{
47 sockaddr_storage storage;
48 SocketAddress::ToSockAddr(AF_INET610, "::1", 443, &storage);
49
50 SocketAddress addr(reinterpret_cast<const sockaddr*>(&storage));
51
52 CHECK_EQ(addr.length(), sizeof(sockaddr_in6))do { if (__builtin_expect(!!(!((addr.length()) == (sizeof(sockaddr_in6
)))), 0)) { do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "52", "(addr.length()) == (sizeof(sockaddr_in6))", __PRETTY_FUNCTION__
}; node::Assert(args); } while (0); } } while (0)
;
53 CHECK_EQ(addr.family(), AF_INET6)do { if (__builtin_expect(!!(!((addr.family()) == (10))), 0))
{ do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "53", "(addr.family()) == (10)", __PRETTY_FUNCTION__ }; node
::Assert(args); } while (0); } } while (0)
;
54 CHECK_EQ(addr.address(), "::1")do { if (__builtin_expect(!!(!((addr.address()) == ("::1"))),
0)) { do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "54", "(addr.address()) == (\"::1\")", __PRETTY_FUNCTION__
}; node::Assert(args); } while (0); } } while (0)
;
55 CHECK_EQ(addr.port(), 443)do { if (__builtin_expect(!!(!((addr.port()) == (443))), 0)) {
do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "55", "(addr.port()) == (443)", __PRETTY_FUNCTION__ }; node
::Assert(args); } while (0); } } while (0)
;
56
57 addr.set_flow_label(12345);
58 CHECK_EQ(addr.flow_label(), 12345)do { if (__builtin_expect(!!(!((addr.flow_label()) == (12345)
)), 0)) { do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "58", "(addr.flow_label()) == (12345)", __PRETTY_FUNCTION__
}; node::Assert(args); } while (0); } } while (0)
;
59}
60
61TEST(SocketAddressLRU, SocketAddressLRU)static_assert(sizeof("SocketAddressLRU") > 1, "test_suite_name must not be empty"
); static_assert(sizeof("SocketAddressLRU") > 1, "test_name must not be empty"
); class SocketAddressLRU_SocketAddressLRU_Test : public ::testing
::Test { public: SocketAddressLRU_SocketAddressLRU_Test() = default
; ~SocketAddressLRU_SocketAddressLRU_Test() override = default
; SocketAddressLRU_SocketAddressLRU_Test(SocketAddressLRU_SocketAddressLRU_Test
const&) = delete; SocketAddressLRU_SocketAddressLRU_Test
& operator=(SocketAddressLRU_SocketAddressLRU_Test const&
) = delete; SocketAddressLRU_SocketAddressLRU_Test(SocketAddressLRU_SocketAddressLRU_Test
&&) noexcept = delete; SocketAddressLRU_SocketAddressLRU_Test
& operator=(SocketAddressLRU_SocketAddressLRU_Test&&
) noexcept = delete; private: void TestBody() override; static
::testing::TestInfo* const test_info_ __attribute__ ((unused
)); }; ::testing::TestInfo* const SocketAddressLRU_SocketAddressLRU_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo( "SocketAddressLRU"
, "SocketAddressLRU", nullptr, nullptr, ::testing::internal::
CodeLocation("../test/cctest/test_sockaddr.cc", 61), (::testing
::internal::GetTestTypeId()), ::testing::internal::SuiteApiResolver
< ::testing::Test>::GetSetUpCaseOrSuite("../test/cctest/test_sockaddr.cc"
, 61), ::testing::internal::SuiteApiResolver< ::testing::Test
>::GetTearDownCaseOrSuite("../test/cctest/test_sockaddr.cc"
, 61), new ::testing::internal::TestFactoryImpl<SocketAddressLRU_SocketAddressLRU_Test
>); void SocketAddressLRU_SocketAddressLRU_Test::TestBody(
)
{
62 struct Foo {
63 int c;
64 bool expired;
65 };
66
67 struct FooLRUTraits {
68 using Type = Foo;
69
70 static bool CheckExpired(const SocketAddress& address, const Type& type) {
71 return type.expired;
72 }
73
74 static void Touch(const SocketAddress& address, Type* type) {
75 type->expired = false;
76 }
77 };
78
79 SocketAddressLRU<FooLRUTraits> lru(2);
80
81 sockaddr_storage storage[4];
82
83 SocketAddress::ToSockAddr(AF_INET2, "123.123.123.123", 443, &storage[0]);
84 SocketAddress::ToSockAddr(AF_INET2, "123.123.123.124", 443, &storage[1]);
85 SocketAddress::ToSockAddr(AF_INET2, "123.123.123.125", 443, &storage[2]);
86 SocketAddress::ToSockAddr(AF_INET2, "123.123.123.123", 443, &storage[3]);
87
88
89 SocketAddress addr1(reinterpret_cast<const sockaddr*>(&storage[0]));
90 SocketAddress addr2(reinterpret_cast<const sockaddr*>(&storage[1]));
91 SocketAddress addr3(reinterpret_cast<const sockaddr*>(&storage[2]));
92 SocketAddress addr4(reinterpret_cast<const sockaddr*>(&storage[3]));
93
94 Foo* foo = lru.Upsert(addr1);
95 CHECK_NOT_NULL(foo)do { if (__builtin_expect(!!(!((foo) != nullptr)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "95", "(foo) != nullptr", __PRETTY_FUNCTION__ }; node::Assert
(args); } while (0); } } while (0)
;
96 CHECK_EQ(foo->c, 0)do { if (__builtin_expect(!!(!((foo->c) == (0))), 0)) { do
{ static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "96", "(foo->c) == (0)", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
97 CHECK_EQ(foo->expired, false)do { if (__builtin_expect(!!(!((foo->expired) == (false)))
, 0)) { do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "97", "(foo->expired) == (false)", __PRETTY_FUNCTION__
}; node::Assert(args); } while (0); } } while (0)
;
98
99 foo->c = 1;
100 foo->expired = true;
101
102 foo = lru.Upsert(addr1);
Value stored to 'foo' is never read
103 CHECK_NOT_NULL(lru.Peek(addr1))do { if (__builtin_expect(!!(!((lru.Peek(addr1)) != nullptr))
, 0)) { do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "103", "(lru.Peek(addr1)) != nullptr", __PRETTY_FUNCTION__
}; node::Assert(args); } while (0); } } while (0)
;
104 CHECK_EQ(lru.Peek(addr1), lru.Peek(addr4))do { if (__builtin_expect(!!(!((lru.Peek(addr1)) == (lru.Peek
(addr4)))), 0)) { do { static const node::AssertionInfo args =
{ "../test/cctest/test_sockaddr.cc" ":" "104", "(lru.Peek(addr1)) == (lru.Peek(addr4))"
, __PRETTY_FUNCTION__ }; node::Assert(args); } while (0); } }
while (0)
;
105 CHECK_EQ(lru.Peek(addr1)->c, 1)do { if (__builtin_expect(!!(!((lru.Peek(addr1)->c) == (1)
)), 0)) { do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "105", "(lru.Peek(addr1)->c) == (1)", __PRETTY_FUNCTION__
}; node::Assert(args); } while (0); } } while (0)
;
106 CHECK_EQ(lru.Peek(addr1)->expired, false)do { if (__builtin_expect(!!(!((lru.Peek(addr1)->expired) ==
(false))), 0)) { do { static const node::AssertionInfo args =
{ "../test/cctest/test_sockaddr.cc" ":" "106", "(lru.Peek(addr1)->expired) == (false)"
, __PRETTY_FUNCTION__ }; node::Assert(args); } while (0); } }
while (0)
;
107 CHECK_EQ(lru.size(), 1)do { if (__builtin_expect(!!(!((lru.size()) == (1))), 0)) { do
{ static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "107", "(lru.size()) == (1)", __PRETTY_FUNCTION__ }; node
::Assert(args); } while (0); } } while (0)
;
108
109 foo = lru.Upsert(addr2);
110 foo->c = 2;
111 foo->expired = true;
112 CHECK_NOT_NULL(lru.Peek(addr2))do { if (__builtin_expect(!!(!((lru.Peek(addr2)) != nullptr))
, 0)) { do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "112", "(lru.Peek(addr2)) != nullptr", __PRETTY_FUNCTION__
}; node::Assert(args); } while (0); } } while (0)
;
113 CHECK_EQ(lru.Peek(addr2)->c, 2)do { if (__builtin_expect(!!(!((lru.Peek(addr2)->c) == (2)
)), 0)) { do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "113", "(lru.Peek(addr2)->c) == (2)", __PRETTY_FUNCTION__
}; node::Assert(args); } while (0); } } while (0)
;
114 CHECK_EQ(lru.size(), 2)do { if (__builtin_expect(!!(!((lru.size()) == (2))), 0)) { do
{ static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "114", "(lru.size()) == (2)", __PRETTY_FUNCTION__ }; node
::Assert(args); } while (0); } } while (0)
;
115
116 foo->expired = true;
117
118 foo = lru.Upsert(addr3);
119 foo->c = 3;
120 foo->expired = false;
121 CHECK_NOT_NULL(lru.Peek(addr3))do { if (__builtin_expect(!!(!((lru.Peek(addr3)) != nullptr))
, 0)) { do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "121", "(lru.Peek(addr3)) != nullptr", __PRETTY_FUNCTION__
}; node::Assert(args); } while (0); } } while (0)
;
122 CHECK_EQ(lru.Peek(addr3)->c, 3)do { if (__builtin_expect(!!(!((lru.Peek(addr3)->c) == (3)
)), 0)) { do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "122", "(lru.Peek(addr3)->c) == (3)", __PRETTY_FUNCTION__
}; node::Assert(args); } while (0); } } while (0)
;
123 CHECK_EQ(lru.size(), 1)do { if (__builtin_expect(!!(!((lru.size()) == (1))), 0)) { do
{ static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "123", "(lru.size()) == (1)", __PRETTY_FUNCTION__ }; node
::Assert(args); } while (0); } } while (0)
;
124
125 // addr1 was removed because we exceeded size.
126 // addr2 was removed because it was expired.
127 CHECK_NULL(lru.Peek(addr1))do { if (__builtin_expect(!!(!((lru.Peek(addr1)) == nullptr))
, 0)) { do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "127", "(lru.Peek(addr1)) == nullptr", __PRETTY_FUNCTION__
}; node::Assert(args); } while (0); } } while (0)
;
128 CHECK_NULL(lru.Peek(addr2))do { if (__builtin_expect(!!(!((lru.Peek(addr2)) == nullptr))
, 0)) { do { static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "128", "(lru.Peek(addr2)) == nullptr", __PRETTY_FUNCTION__
}; node::Assert(args); } while (0); } } while (0)
;
129}
130
131TEST(SocketAddress, Comparison)static_assert(sizeof("SocketAddress") > 1, "test_suite_name must not be empty"
); static_assert(sizeof("Comparison") > 1, "test_name must not be empty"
); class SocketAddress_Comparison_Test : public ::testing::Test
{ public: SocketAddress_Comparison_Test() = default; ~SocketAddress_Comparison_Test
() override = default; SocketAddress_Comparison_Test(SocketAddress_Comparison_Test
const&) = delete; SocketAddress_Comparison_Test& operator
=(SocketAddress_Comparison_Test const&) = delete; SocketAddress_Comparison_Test
(SocketAddress_Comparison_Test&&) noexcept = delete; SocketAddress_Comparison_Test
& operator=(SocketAddress_Comparison_Test&&) noexcept
= delete; private: void TestBody() override; static ::testing
::TestInfo* const test_info_ __attribute__ ((unused)); }; ::testing
::TestInfo* const SocketAddress_Comparison_Test::test_info_ =
::testing::internal::MakeAndRegisterTestInfo( "SocketAddress"
, "Comparison", nullptr, nullptr, ::testing::internal::CodeLocation
("../test/cctest/test_sockaddr.cc", 131), (::testing::internal
::GetTestTypeId()), ::testing::internal::SuiteApiResolver<
::testing::Test>::GetSetUpCaseOrSuite("../test/cctest/test_sockaddr.cc"
, 131), ::testing::internal::SuiteApiResolver< ::testing::
Test>::GetTearDownCaseOrSuite("../test/cctest/test_sockaddr.cc"
, 131), new ::testing::internal::TestFactoryImpl<SocketAddress_Comparison_Test
>); void SocketAddress_Comparison_Test::TestBody()
{
132 sockaddr_storage storage[6];
133
134 SocketAddress::ToSockAddr(AF_INET2, "10.0.0.1", 0, &storage[0]);
135 SocketAddress::ToSockAddr(AF_INET2, "10.0.0.2", 0, &storage[1]);
136 SocketAddress::ToSockAddr(AF_INET610, "::1", 0, &storage[2]);
137 SocketAddress::ToSockAddr(AF_INET610, "::2", 0, &storage[3]);
138 SocketAddress::ToSockAddr(AF_INET610, "::ffff:10.0.0.1", 0, &storage[4]);
139 SocketAddress::ToSockAddr(AF_INET610, "::ffff:10.0.0.2", 0, &storage[5]);
140
141 SocketAddress addr1(reinterpret_cast<const sockaddr*>(&storage[0]));
142 SocketAddress addr2(reinterpret_cast<const sockaddr*>(&storage[1]));
143 SocketAddress addr3(reinterpret_cast<const sockaddr*>(&storage[2]));
144 SocketAddress addr4(reinterpret_cast<const sockaddr*>(&storage[3]));
145 SocketAddress addr5(reinterpret_cast<const sockaddr*>(&storage[4]));
146 SocketAddress addr6(reinterpret_cast<const sockaddr*>(&storage[5]));
147
148 CHECK_EQ(addr1.compare(addr1), SocketAddress::CompareResult::SAME)do { if (__builtin_expect(!!(!((addr1.compare(addr1)) == (SocketAddress
::CompareResult::SAME))), 0)) { do { static const node::AssertionInfo
args = { "../test/cctest/test_sockaddr.cc" ":" "148", "(addr1.compare(addr1)) == (SocketAddress::CompareResult::SAME)"
, __PRETTY_FUNCTION__ }; node::Assert(args); } while (0); } }
while (0)
;
149 CHECK_EQ(addr1.compare(addr2), SocketAddress::CompareResult::LESS_THAN)do { if (__builtin_expect(!!(!((addr1.compare(addr2)) == (SocketAddress
::CompareResult::LESS_THAN))), 0)) { do { static const node::
AssertionInfo args = { "../test/cctest/test_sockaddr.cc" ":" "149"
, "(addr1.compare(addr2)) == (SocketAddress::CompareResult::LESS_THAN)"
, __PRETTY_FUNCTION__ }; node::Assert(args); } while (0); } }
while (0)
;
150 CHECK_EQ(addr2.compare(addr1), SocketAddress::CompareResult::GREATER_THAN)do { if (__builtin_expect(!!(!((addr2.compare(addr1)) == (SocketAddress
::CompareResult::GREATER_THAN))), 0)) { do { static const node
::AssertionInfo args = { "../test/cctest/test_sockaddr.cc" ":"
"150", "(addr2.compare(addr1)) == (SocketAddress::CompareResult::GREATER_THAN)"
, __PRETTY_FUNCTION__ }; node::Assert(args); } while (0); } }
while (0)
;
151 CHECK(addr1 <= addr1)do { if (__builtin_expect(!!(!(addr1 <= addr1)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "151", "addr1 <= addr1", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
152 CHECK(addr1 < addr2)do { if (__builtin_expect(!!(!(addr1 < addr2)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "152", "addr1 < addr2", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
153 CHECK(addr1 <= addr2)do { if (__builtin_expect(!!(!(addr1 <= addr2)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "153", "addr1 <= addr2", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
154 CHECK(addr2 >= addr2)do { if (__builtin_expect(!!(!(addr2 >= addr2)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "154", "addr2 >= addr2", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
155 CHECK(addr2 > addr1)do { if (__builtin_expect(!!(!(addr2 > addr1)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "155", "addr2 > addr1", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
156 CHECK(addr2 >= addr1)do { if (__builtin_expect(!!(!(addr2 >= addr1)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "156", "addr2 >= addr1", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
157
158 CHECK_EQ(addr3.compare(addr3), SocketAddress::CompareResult::SAME)do { if (__builtin_expect(!!(!((addr3.compare(addr3)) == (SocketAddress
::CompareResult::SAME))), 0)) { do { static const node::AssertionInfo
args = { "../test/cctest/test_sockaddr.cc" ":" "158", "(addr3.compare(addr3)) == (SocketAddress::CompareResult::SAME)"
, __PRETTY_FUNCTION__ }; node::Assert(args); } while (0); } }
while (0)
;
159 CHECK_EQ(addr3.compare(addr4), SocketAddress::CompareResult::LESS_THAN)do { if (__builtin_expect(!!(!((addr3.compare(addr4)) == (SocketAddress
::CompareResult::LESS_THAN))), 0)) { do { static const node::
AssertionInfo args = { "../test/cctest/test_sockaddr.cc" ":" "159"
, "(addr3.compare(addr4)) == (SocketAddress::CompareResult::LESS_THAN)"
, __PRETTY_FUNCTION__ }; node::Assert(args); } while (0); } }
while (0)
;
160 CHECK_EQ(addr4.compare(addr3), SocketAddress::CompareResult::GREATER_THAN)do { if (__builtin_expect(!!(!((addr4.compare(addr3)) == (SocketAddress
::CompareResult::GREATER_THAN))), 0)) { do { static const node
::AssertionInfo args = { "../test/cctest/test_sockaddr.cc" ":"
"160", "(addr4.compare(addr3)) == (SocketAddress::CompareResult::GREATER_THAN)"
, __PRETTY_FUNCTION__ }; node::Assert(args); } while (0); } }
while (0)
;
161 CHECK(addr3 <= addr3)do { if (__builtin_expect(!!(!(addr3 <= addr3)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "161", "addr3 <= addr3", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
162 CHECK(addr3 < addr4)do { if (__builtin_expect(!!(!(addr3 < addr4)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "162", "addr3 < addr4", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
163 CHECK(addr3 <= addr4)do { if (__builtin_expect(!!(!(addr3 <= addr4)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "163", "addr3 <= addr4", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
164 CHECK(addr4 >= addr4)do { if (__builtin_expect(!!(!(addr4 >= addr4)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "164", "addr4 >= addr4", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
165 CHECK(addr4 > addr3)do { if (__builtin_expect(!!(!(addr4 > addr3)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "165", "addr4 > addr3", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
166 CHECK(addr4 >= addr3)do { if (__builtin_expect(!!(!(addr4 >= addr3)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "166", "addr4 >= addr3", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
167
168 // Not comparable
169 CHECK_EQ(addr1.compare(addr3), SocketAddress::CompareResult::NOT_COMPARABLE)do { if (__builtin_expect(!!(!((addr1.compare(addr3)) == (SocketAddress
::CompareResult::NOT_COMPARABLE))), 0)) { do { static const node
::AssertionInfo args = { "../test/cctest/test_sockaddr.cc" ":"
"169", "(addr1.compare(addr3)) == (SocketAddress::CompareResult::NOT_COMPARABLE)"
, __PRETTY_FUNCTION__ }; node::Assert(args); } while (0); } }
while (0)
;
170 CHECK_EQ(addr3.compare(addr1), SocketAddress::CompareResult::NOT_COMPARABLE)do { if (__builtin_expect(!!(!((addr3.compare(addr1)) == (SocketAddress
::CompareResult::NOT_COMPARABLE))), 0)) { do { static const node
::AssertionInfo args = { "../test/cctest/test_sockaddr.cc" ":"
"170", "(addr3.compare(addr1)) == (SocketAddress::CompareResult::NOT_COMPARABLE)"
, __PRETTY_FUNCTION__ }; node::Assert(args); } while (0); } }
while (0)
;
171 CHECK(!(addr1 < addr3))do { if (__builtin_expect(!!(!(!(addr1 < addr3))), 0)) { do
{ static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "171", "!(addr1 < addr3)", __PRETTY_FUNCTION__ }; node
::Assert(args); } while (0); } } while (0)
;
172 CHECK(!(addr1 > addr3))do { if (__builtin_expect(!!(!(!(addr1 > addr3))), 0)) { do
{ static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "172", "!(addr1 > addr3)", __PRETTY_FUNCTION__ }; node
::Assert(args); } while (0); } } while (0)
;
173 CHECK(!(addr1 >= addr3))do { if (__builtin_expect(!!(!(!(addr1 >= addr3))), 0)) { do
{ static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "173", "!(addr1 >= addr3)", __PRETTY_FUNCTION__ }; node
::Assert(args); } while (0); } } while (0)
;
174 CHECK(!(addr1 <= addr3))do { if (__builtin_expect(!!(!(!(addr1 <= addr3))), 0)) { do
{ static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "174", "!(addr1 <= addr3)", __PRETTY_FUNCTION__ }; node
::Assert(args); } while (0); } } while (0)
;
175 CHECK(!(addr3 < addr1))do { if (__builtin_expect(!!(!(!(addr3 < addr1))), 0)) { do
{ static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "175", "!(addr3 < addr1)", __PRETTY_FUNCTION__ }; node
::Assert(args); } while (0); } } while (0)
;
176 CHECK(!(addr3 > addr1))do { if (__builtin_expect(!!(!(!(addr3 > addr1))), 0)) { do
{ static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "176", "!(addr3 > addr1)", __PRETTY_FUNCTION__ }; node
::Assert(args); } while (0); } } while (0)
;
177 CHECK(!(addr3 >= addr1))do { if (__builtin_expect(!!(!(!(addr3 >= addr1))), 0)) { do
{ static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "177", "!(addr3 >= addr1)", __PRETTY_FUNCTION__ }; node
::Assert(args); } while (0); } } while (0)
;
178 CHECK(!(addr3 <= addr1))do { if (__builtin_expect(!!(!(!(addr3 <= addr1))), 0)) { do
{ static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "178", "!(addr3 <= addr1)", __PRETTY_FUNCTION__ }; node
::Assert(args); } while (0); } } while (0)
;
179
180 // Comparable
181 CHECK_EQ(addr1.compare(addr5), SocketAddress::CompareResult::SAME)do { if (__builtin_expect(!!(!((addr1.compare(addr5)) == (SocketAddress
::CompareResult::SAME))), 0)) { do { static const node::AssertionInfo
args = { "../test/cctest/test_sockaddr.cc" ":" "181", "(addr1.compare(addr5)) == (SocketAddress::CompareResult::SAME)"
, __PRETTY_FUNCTION__ }; node::Assert(args); } while (0); } }
while (0)
;
182 CHECK_EQ(addr2.compare(addr6), SocketAddress::CompareResult::SAME)do { if (__builtin_expect(!!(!((addr2.compare(addr6)) == (SocketAddress
::CompareResult::SAME))), 0)) { do { static const node::AssertionInfo
args = { "../test/cctest/test_sockaddr.cc" ":" "182", "(addr2.compare(addr6)) == (SocketAddress::CompareResult::SAME)"
, __PRETTY_FUNCTION__ }; node::Assert(args); } while (0); } }
while (0)
;
183 CHECK_EQ(addr1.compare(addr6), SocketAddress::CompareResult::LESS_THAN)do { if (__builtin_expect(!!(!((addr1.compare(addr6)) == (SocketAddress
::CompareResult::LESS_THAN))), 0)) { do { static const node::
AssertionInfo args = { "../test/cctest/test_sockaddr.cc" ":" "183"
, "(addr1.compare(addr6)) == (SocketAddress::CompareResult::LESS_THAN)"
, __PRETTY_FUNCTION__ }; node::Assert(args); } while (0); } }
while (0)
;
184 CHECK_EQ(addr6.compare(addr1), SocketAddress::CompareResult::GREATER_THAN)do { if (__builtin_expect(!!(!((addr6.compare(addr1)) == (SocketAddress
::CompareResult::GREATER_THAN))), 0)) { do { static const node
::AssertionInfo args = { "../test/cctest/test_sockaddr.cc" ":"
"184", "(addr6.compare(addr1)) == (SocketAddress::CompareResult::GREATER_THAN)"
, __PRETTY_FUNCTION__ }; node::Assert(args); } while (0); } }
while (0)
;
185 CHECK(addr1 <= addr5)do { if (__builtin_expect(!!(!(addr1 <= addr5)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "185", "addr1 <= addr5", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
186 CHECK(addr1 <= addr6)do { if (__builtin_expect(!!(!(addr1 <= addr6)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "186", "addr1 <= addr6", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
187 CHECK(addr1 < addr6)do { if (__builtin_expect(!!(!(addr1 < addr6)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "187", "addr1 < addr6", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
188 CHECK(addr6 > addr1)do { if (__builtin_expect(!!(!(addr6 > addr1)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "188", "addr6 > addr1", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
189 CHECK(addr6 >= addr1)do { if (__builtin_expect(!!(!(addr6 >= addr1)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "189", "addr6 >= addr1", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
190 CHECK(addr2 >= addr6)do { if (__builtin_expect(!!(!(addr2 >= addr6)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "190", "addr2 >= addr6", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
191 CHECK(addr2 >= addr5)do { if (__builtin_expect(!!(!(addr2 >= addr5)), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "191", "addr2 >= addr5", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
192}
193
194TEST(SocketAddressBlockList, Simple)static_assert(sizeof("SocketAddressBlockList") > 1, "test_suite_name must not be empty"
); static_assert(sizeof("Simple") > 1, "test_name must not be empty"
); class SocketAddressBlockList_Simple_Test : public ::testing
::Test { public: SocketAddressBlockList_Simple_Test() = default
; ~SocketAddressBlockList_Simple_Test() override = default; SocketAddressBlockList_Simple_Test
(SocketAddressBlockList_Simple_Test const&) = delete; SocketAddressBlockList_Simple_Test
& operator=(SocketAddressBlockList_Simple_Test const&
) = delete; SocketAddressBlockList_Simple_Test(SocketAddressBlockList_Simple_Test
&&) noexcept = delete; SocketAddressBlockList_Simple_Test
& operator=(SocketAddressBlockList_Simple_Test&&)
noexcept = delete; private: void TestBody() override; static
::testing::TestInfo* const test_info_ __attribute__ ((unused
)); }; ::testing::TestInfo* const SocketAddressBlockList_Simple_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo( "SocketAddressBlockList"
, "Simple", nullptr, nullptr, ::testing::internal::CodeLocation
("../test/cctest/test_sockaddr.cc", 194), (::testing::internal
::GetTestTypeId()), ::testing::internal::SuiteApiResolver<
::testing::Test>::GetSetUpCaseOrSuite("../test/cctest/test_sockaddr.cc"
, 194), ::testing::internal::SuiteApiResolver< ::testing::
Test>::GetTearDownCaseOrSuite("../test/cctest/test_sockaddr.cc"
, 194), new ::testing::internal::TestFactoryImpl<SocketAddressBlockList_Simple_Test
>); void SocketAddressBlockList_Simple_Test::TestBody()
{
195 SocketAddressBlockList bl;
196
197 sockaddr_storage storage[2];
198 SocketAddress::ToSockAddr(AF_INET2, "10.0.0.1", 0, &storage[0]);
199 SocketAddress::ToSockAddr(AF_INET2, "10.0.0.2", 0, &storage[1]);
200 std::shared_ptr<SocketAddress> addr1 =
201 std::make_shared<SocketAddress>(
202 reinterpret_cast<const sockaddr*>(&storage[0]));
203 std::shared_ptr<SocketAddress> addr2 =
204 std::make_shared<SocketAddress>(
205 reinterpret_cast<const sockaddr*>(&storage[1]));
206
207 bl.AddSocketAddress(addr1);
208 bl.AddSocketAddress(addr2);
209
210 CHECK(bl.Apply(addr1))do { if (__builtin_expect(!!(!(bl.Apply(addr1))), 0)) { do { static
const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "210", "bl.Apply(addr1)", __PRETTY_FUNCTION__ }; node::Assert
(args); } while (0); } } while (0)
;
211 CHECK(bl.Apply(addr2))do { if (__builtin_expect(!!(!(bl.Apply(addr2))), 0)) { do { static
const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "211", "bl.Apply(addr2)", __PRETTY_FUNCTION__ }; node::Assert
(args); } while (0); } } while (0)
;
212
213 bl.RemoveSocketAddress(addr1);
214
215 CHECK(!bl.Apply(addr1))do { if (__builtin_expect(!!(!(!bl.Apply(addr1))), 0)) { do {
static const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "215", "!bl.Apply(addr1)", __PRETTY_FUNCTION__ }; node::
Assert(args); } while (0); } } while (0)
;
216 CHECK(bl.Apply(addr2))do { if (__builtin_expect(!!(!(bl.Apply(addr2))), 0)) { do { static
const node::AssertionInfo args = { "../test/cctest/test_sockaddr.cc"
":" "216", "bl.Apply(addr2)", __PRETTY_FUNCTION__ }; node::Assert
(args); } while (0); } } while (0)
;
217}