aboutsummaryrefslogtreecommitdiffstats
path: root/util/network/ip_ut.cpp
diff options
context:
space:
mode:
authorakhropov <akhropov@yandex-team.ru>2022-02-10 16:46:32 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:32 +0300
commit298c6da79f1d8f35089a67f463f0b541bec36d9b (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/network/ip_ut.cpp
parent00afc96e9c0298054b7386fa7fb9e3cc3d67b974 (diff)
downloadydb-298c6da79f1d8f35089a67f463f0b541bec36d9b.tar.gz
Restoring authorship annotation for <akhropov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/network/ip_ut.cpp')
-rw-r--r--util/network/ip_ut.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/util/network/ip_ut.cpp b/util/network/ip_ut.cpp
index 753d62cd0e..6716c6a699 100644
--- a/util/network/ip_ut.cpp
+++ b/util/network/ip_ut.cpp
@@ -1,10 +1,10 @@
#include "ip.h"
#include <library/cpp/testing/unittest/registar.h>
-
+
#include <util/generic/yexception.h>
-
-class TSysIpTest: public TTestBase {
+
+class TSysIpTest: public TTestBase {
UNIT_TEST_SUITE(TSysIpTest);
UNIT_TEST(TestIpFromString);
UNIT_TEST_EXCEPTION(TestIpFromString2, yexception);
@@ -21,43 +21,43 @@ private:
void TestIpFromString4();
void TestIpFromString5();
void TestIpToString();
-};
-
-UNIT_TEST_SUITE_REGISTRATION(TSysIpTest);
-
+};
+
+UNIT_TEST_SUITE_REGISTRATION(TSysIpTest);
+
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}};
-
+ 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]);
- UNIT_ASSERT(memcmp(&ip, ipArr[i], sizeof(ui32)) == 0);
- }
-}
-
+ UNIT_ASSERT(memcmp(&ip, ipArr[i], sizeof(ui32)) == 0);
+ }
+}
+
void TSysIpTest::TestIpFromString2() {
IpFromString("XXXXXXWXW");
-}
-
+}
+
void TSysIpTest::TestIpFromString3() {
IpFromString("986.0.37.255");
-}
-
+}
+
void TSysIpTest::TestIpFromString4() {
IpFromString("256.0.22.365");
-}
-
+}
+
void TSysIpTest::TestIpFromString5() {
IpFromString("245.12..0");
-}
-
-void TSysIpTest::TestIpToString() {
- ui8 ipArr[][4] = {{192, 168, 0, 1}, {87, 255, 18, 167}, {255, 255, 0, 31}, {188, 225, 124, 255}};
-
- const char* ipStr[] = {"192.168.0.1", "87.255.18.167", "255.255.0.31", "188.225.124.255"};
-
+}
+
+void TSysIpTest::TestIpToString() {
+ ui8 ipArr[][4] = {{192, 168, 0, 1}, {87, 255, 18, 167}, {255, 255, 0, 31}, {188, 225, 124, 255}};
+
+ const char* ipStr[] = {"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) {
UNIT_ASSERT(IpToString(*reinterpret_cast<TIpHost*>(&(ipArr[i]))) == ipStr[i]);
- }
-}
+ }
+}