diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /util/network/ip_ut.cpp | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/network/ip_ut.cpp')
-rw-r--r-- | util/network/ip_ut.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/util/network/ip_ut.cpp b/util/network/ip_ut.cpp index 6716c6a699..67c19aa968 100644 --- a/util/network/ip_ut.cpp +++ b/util/network/ip_ut.cpp @@ -1,55 +1,55 @@ -#include "ip.h" - +#include "ip.h" + #include <library/cpp/testing/unittest/registar.h> #include <util/generic/yexception.h> class TSysIpTest: public TTestBase { - UNIT_TEST_SUITE(TSysIpTest); - UNIT_TEST(TestIpFromString); - UNIT_TEST_EXCEPTION(TestIpFromString2, yexception); - UNIT_TEST_EXCEPTION(TestIpFromString3, yexception); - UNIT_TEST_EXCEPTION(TestIpFromString4, yexception); - UNIT_TEST_EXCEPTION(TestIpFromString5, yexception); - UNIT_TEST(TestIpToString); - UNIT_TEST_SUITE_END(); - -private: - void TestIpFromString(); - void TestIpFromString2(); - void TestIpFromString3(); - void TestIpFromString4(); - void TestIpFromString5(); - void TestIpToString(); + UNIT_TEST_SUITE(TSysIpTest); + UNIT_TEST(TestIpFromString); + UNIT_TEST_EXCEPTION(TestIpFromString2, yexception); + UNIT_TEST_EXCEPTION(TestIpFromString3, yexception); + UNIT_TEST_EXCEPTION(TestIpFromString4, yexception); + UNIT_TEST_EXCEPTION(TestIpFromString5, yexception); + UNIT_TEST(TestIpToString); + UNIT_TEST_SUITE_END(); + +private: + void TestIpFromString(); + void TestIpFromString2(); + void TestIpFromString3(); + void TestIpFromString4(); + void TestIpFromString5(); + void TestIpToString(); }; UNIT_TEST_SUITE_REGISTRATION(TSysIpTest); -void TSysIpTest::TestIpFromString() { +void TSysIpTest::TestIpFromString() { const char* ipStr[] = {"192.168.0.1", "87.255.18.167", "255.255.0.31", "188.225.124.255"}; ui8 ipArr[][4] = {{192, 168, 0, 1}, {87, 255, 18, 167}, {255, 255, 0, 31}, {188, 225, 124, 255}}; for (size_t i = 0; i < Y_ARRAY_SIZE(ipStr); ++i) { - const ui32 ip = IpFromString(ipStr[i]); - + const ui32 ip = IpFromString(ipStr[i]); + UNIT_ASSERT(memcmp(&ip, ipArr[i], sizeof(ui32)) == 0); } } -void TSysIpTest::TestIpFromString2() { - IpFromString("XXXXXXWXW"); +void TSysIpTest::TestIpFromString2() { + IpFromString("XXXXXXWXW"); } -void TSysIpTest::TestIpFromString3() { - IpFromString("986.0.37.255"); +void TSysIpTest::TestIpFromString3() { + IpFromString("986.0.37.255"); } -void TSysIpTest::TestIpFromString4() { - IpFromString("256.0.22.365"); +void TSysIpTest::TestIpFromString4() { + IpFromString("256.0.22.365"); } -void TSysIpTest::TestIpFromString5() { - IpFromString("245.12..0"); +void TSysIpTest::TestIpFromString5() { + IpFromString("245.12..0"); } void TSysIpTest::TestIpToString() { |