diff options
author | nga <nga@yandex-team.ru> | 2022-02-10 16:48:09 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:09 +0300 |
commit | c2a1af049e9deca890e9923abe64fe6c59060348 (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /util/network/address_ut.cpp | |
parent | 1f553f46fb4f3c5eec631352cdd900a0709016af (diff) | |
download | ydb-c2a1af049e9deca890e9923abe64fe6c59060348.tar.gz |
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/network/address_ut.cpp')
-rw-r--r-- | util/network/address_ut.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/util/network/address_ut.cpp b/util/network/address_ut.cpp index 2a18cad9df..28f45172ff 100644 --- a/util/network/address_ut.cpp +++ b/util/network/address_ut.cpp @@ -1,33 +1,33 @@ #include <library/cpp/testing/unittest/registar.h> - -#include "address.h" - -using namespace NAddr; - + +#include "address.h" + +using namespace NAddr; + Y_UNIT_TEST_SUITE(IRemoteAddr_ToString) { Y_UNIT_TEST(Raw) { - THolder<TOpaqueAddr> opaque(new TOpaqueAddr); - IRemoteAddr* addr = opaque.Get(); - + THolder<TOpaqueAddr> opaque(new TOpaqueAddr); + IRemoteAddr* addr = opaque.Get(); + TString s = ToString(*addr); - UNIT_ASSERT_VALUES_EQUAL("(raw all zeros)", s); - - opaque->MutableAddr()->sa_data[10] = 17; - + UNIT_ASSERT_VALUES_EQUAL("(raw all zeros)", s); + + opaque->MutableAddr()->sa_data[10] = 17; + TString t = ToString(*addr); - + UNIT_ASSERT_C(t.StartsWith("(raw 0 0"), t); UNIT_ASSERT_C(t.EndsWith(')'), t); - } - + } + Y_UNIT_TEST(Ipv6) { - TNetworkAddress address("::1", 22); - TNetworkAddress::TIterator it = address.Begin(); - UNIT_ASSERT(it != address.End()); - UNIT_ASSERT(it->ai_family == AF_INET6); + TNetworkAddress address("::1", 22); + TNetworkAddress::TIterator it = address.Begin(); + UNIT_ASSERT(it != address.End()); + UNIT_ASSERT(it->ai_family == AF_INET6); TString toString = ToString((const IRemoteAddr&)TAddrInfo(&*it)); UNIT_ASSERT_VALUES_EQUAL(TString("[::1]:22"), toString); - } + } Y_UNIT_TEST(Loopback) { TNetworkAddress localAddress("127.70.0.1", 22); @@ -36,4 +36,4 @@ Y_UNIT_TEST_SUITE(IRemoteAddr_ToString) { TNetworkAddress localAddress2("127.0.0.1", 22); UNIT_ASSERT_VALUES_EQUAL(NAddr::IsLoopback(TAddrInfo(&*localAddress2.Begin())), true); } -} +} |