aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/unicode/punycode
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/unicode/punycode
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/unicode/punycode')
-rw-r--r--library/cpp/unicode/punycode/punycode.h2
-rw-r--r--library/cpp/unicode/punycode/punycode_ut.cpp24
2 files changed, 13 insertions, 13 deletions
diff --git a/library/cpp/unicode/punycode/punycode.h b/library/cpp/unicode/punycode/punycode.h
index af4acc25c1..7d14d2a794 100644
--- a/library/cpp/unicode/punycode/punycode.h
+++ b/library/cpp/unicode/punycode/punycode.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include <util/generic/string.h>
#include <util/generic/strbuf.h>
#include <util/generic/yexception.h>
diff --git a/library/cpp/unicode/punycode/punycode_ut.cpp b/library/cpp/unicode/punycode/punycode_ut.cpp
index 97271cf0d8..b0208ad7bf 100644
--- a/library/cpp/unicode/punycode/punycode_ut.cpp
+++ b/library/cpp/unicode/punycode/punycode_ut.cpp
@@ -39,13 +39,13 @@ Y_UNIT_TEST_SUITE(TPunycodeTest) {
UNIT_ASSERT(TestRaw("пример", "e1afmkfd"));
{
- const wchar16 tmp[] = {0x82, 0x81, 0x80, 0};
- UNIT_ASSERT(PunycodeToWide("abc") == tmp); // "abc" is still valid punycode
+ const wchar16 tmp[] = {0x82, 0x81, 0x80, 0};
+ UNIT_ASSERT(PunycodeToWide("abc") == tmp); // "abc" is still valid punycode
}
UNIT_ASSERT_EXCEPTION(PunycodeToWide(" "), TPunycodeError);
UNIT_ASSERT_EXCEPTION(PunycodeToWide("абвгд"), TPunycodeError);
- UNIT_ASSERT_EXCEPTION(PunycodeToWide("-"), TPunycodeError);
+ UNIT_ASSERT_EXCEPTION(PunycodeToWide("-"), TPunycodeError);
{
TString longIn;
@@ -62,23 +62,23 @@ Y_UNIT_TEST_SUITE(TPunycodeTest) {
TString buf1;
TUtf16String buf2;
//Cerr << "Testing " << utf8 << Endl;
- return HostNameToPunycode(unicode) == punycode && HostNameToPunycode(UTF8ToWide(punycode)) == punycode // repeated encoding should give same result
- && PunycodeToHostName(punycode) == unicode && CanBePunycodeHostName(punycode) == canBePunycode;
+ return HostNameToPunycode(unicode) == punycode && HostNameToPunycode(UTF8ToWide(punycode)) == punycode // repeated encoding should give same result
+ && PunycodeToHostName(punycode) == unicode && CanBePunycodeHostName(punycode) == canBePunycode;
}
static bool TestForced(const TString& bad) {
- return ForceHostNameToPunycode(UTF8ToWide(bad)) == bad && ForcePunycodeToHostName(bad) == UTF8ToWide(bad);
+ return ForceHostNameToPunycode(UTF8ToWide(bad)) == bad && ForcePunycodeToHostName(bad) == UTF8ToWide(bad);
}
Y_UNIT_TEST(HostNameEncodeDecode) {
UNIT_ASSERT(TestHostName("президент.рф", "xn--d1abbgf6aiiy.xn--p1ai", true));
- UNIT_ASSERT(TestHostName("яндекс.ru", "xn--d1acpjx3f.ru", true));
- UNIT_ASSERT(TestHostName("пример", "xn--e1afmkfd", true));
- UNIT_ASSERT(TestHostName("ascii.test", "ascii.test"));
+ UNIT_ASSERT(TestHostName("яндекс.ru", "xn--d1acpjx3f.ru", true));
+ UNIT_ASSERT(TestHostName("пример", "xn--e1afmkfd", true));
+ UNIT_ASSERT(TestHostName("ascii.test", "ascii.test"));
UNIT_ASSERT(TestHostName("", ""));
UNIT_ASSERT(TestHostName(".", "."));
- UNIT_ASSERT(TestHostName("a.", "a.")); // empty root domain is ok
+ UNIT_ASSERT(TestHostName("a.", "a.")); // empty root domain is ok
UNIT_ASSERT(TestHostName("a.b.c.д.e.f", "a.b.c.xn--d1a.e.f", true));
UNIT_ASSERT(TestHostName("а.б.в.г.д", "xn--80a.xn--90a.xn--b1a.xn--c1a.xn--d1a", true));
@@ -97,7 +97,7 @@ Y_UNIT_TEST_SUITE(TPunycodeTest) {
// too long domain label
TString bad(500, 'a');
UNIT_ASSERT_EXCEPTION(HostNameToPunycode(UTF8ToWide(bad)), TPunycodeError);
- UNIT_ASSERT(TestForced(bad)); // but can decode it
+ UNIT_ASSERT(TestForced(bad)); // but can decode it
}
{
// already has ACE prefix
@@ -121,6 +121,6 @@ Y_UNIT_TEST_SUITE(TPunycodeTest) {
UNIT_ASSERT(!CanBePunycodeHostName("яндекс.рф")); // non-ascii
UNIT_ASSERT(!CanBePunycodeHostName("яндекс.xn--p1ai")); // non-ascii
UNIT_ASSERT(!CanBePunycodeHostName(""));
- UNIT_ASSERT(!CanBePunycodeHostName("http://xn--a.b")); // scheme prefix is not detected here
+ UNIT_ASSERT(!CanBePunycodeHostName("http://xn--a.b")); // scheme prefix is not detected here
}
}