diff options
author | dobrokot <dobrokot@yandex-team.ru> | 2022-02-10 16:49:07 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:07 +0300 |
commit | 25d83bf841d8b3ce3886525078f1964ac3c293c5 (patch) | |
tree | bd52fa16c8dd727890b2ef9d87d1a402bd0d3a9a /util/string/ascii_ut.cpp | |
parent | 1d2e8a8e9976488ea69a7e4763aa749244f82612 (diff) | |
download | ydb-25d83bf841d8b3ce3886525078f1964ac3c293c5.tar.gz |
Restoring authorship annotation for <dobrokot@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/string/ascii_ut.cpp')
-rw-r--r-- | util/string/ascii_ut.cpp | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/util/string/ascii_ut.cpp b/util/string/ascii_ut.cpp index 89069fee50..4108302622 100644 --- a/util/string/ascii_ut.cpp +++ b/util/string/ascii_ut.cpp @@ -1,42 +1,42 @@ -#include "ascii.h" -#include <ctype.h> - +#include "ascii.h" +#include <ctype.h> + #include <library/cpp/testing/unittest/registar.h> - + Y_UNIT_TEST_SUITE(TAsciiTest) { Y_UNIT_TEST(TestAscii) { - UNIT_ASSERT(IsAsciiDigit('3')); - UNIT_ASSERT(!IsAsciiDigit('x')); - - UNIT_ASSERT(IsAsciiAlpha('r')); - UNIT_ASSERT(IsAsciiAlpha('R')); - UNIT_ASSERT(!IsAsciiAlpha('3')); - - UNIT_ASSERT_EQUAL(AsciiToLower('3'), '3'); - UNIT_ASSERT_EQUAL(AsciiToLower('A'), 'a'); - UNIT_ASSERT_EQUAL(AsciiToLower('a'), 'a'); - - UNIT_ASSERT_EQUAL(AsciiToUpper('3'), '3'); - UNIT_ASSERT_EQUAL(AsciiToUpper('A'), 'A'); - UNIT_ASSERT_EQUAL(AsciiToUpper('a'), 'A'); - - UNIT_ASSERT(IsAscii('a')); - UNIT_ASSERT(!IsAscii(-100)); - UNIT_ASSERT(!IsAscii(+200)); - UNIT_ASSERT(!IsAscii(int('a') + 256)); - - for (int i = 0; i < 128; ++i) { - UNIT_ASSERT_VALUES_EQUAL((bool)isxdigit(i), IsAsciiHex(i)); - UNIT_ASSERT_VALUES_EQUAL((bool)isspace(i), IsAsciiSpace((char)i)); - UNIT_ASSERT_VALUES_EQUAL((bool)isspace(i), IsAsciiSpace((char)i)); - UNIT_ASSERT_VALUES_EQUAL((bool)isalnum(i), IsAsciiAlnum((char)i)); - UNIT_ASSERT_VALUES_EQUAL((bool)isalpha(i), IsAsciiAlpha((char)i)); - UNIT_ASSERT_VALUES_EQUAL((bool)isupper(i), IsAsciiUpper((char)i)); - UNIT_ASSERT_VALUES_EQUAL((bool)islower(i), IsAsciiLower((char)i)); - UNIT_ASSERT_VALUES_EQUAL((bool)isdigit(i), IsAsciiDigit((char)i)); + UNIT_ASSERT(IsAsciiDigit('3')); + UNIT_ASSERT(!IsAsciiDigit('x')); + + UNIT_ASSERT(IsAsciiAlpha('r')); + UNIT_ASSERT(IsAsciiAlpha('R')); + UNIT_ASSERT(!IsAsciiAlpha('3')); + + UNIT_ASSERT_EQUAL(AsciiToLower('3'), '3'); + UNIT_ASSERT_EQUAL(AsciiToLower('A'), 'a'); + UNIT_ASSERT_EQUAL(AsciiToLower('a'), 'a'); + + UNIT_ASSERT_EQUAL(AsciiToUpper('3'), '3'); + UNIT_ASSERT_EQUAL(AsciiToUpper('A'), 'A'); + UNIT_ASSERT_EQUAL(AsciiToUpper('a'), 'A'); + + UNIT_ASSERT(IsAscii('a')); + UNIT_ASSERT(!IsAscii(-100)); + UNIT_ASSERT(!IsAscii(+200)); + UNIT_ASSERT(!IsAscii(int('a') + 256)); + + for (int i = 0; i < 128; ++i) { + UNIT_ASSERT_VALUES_EQUAL((bool)isxdigit(i), IsAsciiHex(i)); + UNIT_ASSERT_VALUES_EQUAL((bool)isspace(i), IsAsciiSpace((char)i)); + UNIT_ASSERT_VALUES_EQUAL((bool)isspace(i), IsAsciiSpace((char)i)); + UNIT_ASSERT_VALUES_EQUAL((bool)isalnum(i), IsAsciiAlnum((char)i)); + UNIT_ASSERT_VALUES_EQUAL((bool)isalpha(i), IsAsciiAlpha((char)i)); + UNIT_ASSERT_VALUES_EQUAL((bool)isupper(i), IsAsciiUpper((char)i)); + UNIT_ASSERT_VALUES_EQUAL((bool)islower(i), IsAsciiLower((char)i)); + UNIT_ASSERT_VALUES_EQUAL((bool)isdigit(i), IsAsciiDigit((char)i)); UNIT_ASSERT_VALUES_EQUAL((bool)ispunct(i), IsAsciiPunct((char)i)); - } - } + } + } Y_UNIT_TEST(Test1) { for (int i = 128; i < 1000; ++i) { @@ -95,4 +95,4 @@ Y_UNIT_TEST_SUITE(TAsciiTest) { UNIT_ASSERT_EQUAL(AsciiHasSuffixIgnoreCase("qweasd", "asD"), true); UNIT_ASSERT_EQUAL(AsciiHasSuffixIgnoreCase("qweasd", "ast"), false); } -} +} |