diff options
author | Dmitry Potapov <potapov.d@gmail.com> | 2022-02-10 16:46:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:39 +0300 |
commit | 7aa4cf700385ff96999c5cc301171ff157974773 (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/regex/pire/ut/regexp_ut.cpp | |
parent | 536101ea75c9ff5df10d01c2f460b1f6e12311b3 (diff) | |
download | ydb-7aa4cf700385ff96999c5cc301171ff157974773.tar.gz |
Restoring authorship annotation for Dmitry Potapov <potapov.d@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/regex/pire/ut/regexp_ut.cpp')
-rw-r--r-- | library/cpp/regex/pire/ut/regexp_ut.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/library/cpp/regex/pire/ut/regexp_ut.cpp b/library/cpp/regex/pire/ut/regexp_ut.cpp index c8db34d986..e7206de9ad 100644 --- a/library/cpp/regex/pire/ut/regexp_ut.cpp +++ b/library/cpp/regex/pire/ut/regexp_ut.cpp @@ -93,44 +93,44 @@ Y_UNIT_TEST_SUITE(TRegExp) { UNIT_ASSERT(TMatcher(glued).Match("abc").Final()); UNIT_ASSERT(!TMatcher(glued).Match("Abc").Final()); } - + Y_UNIT_TEST(Capture1) { - TCapturingFsm fsm("here we have user_id=([a-z0-9]+);"); - - TSearcher searcher(fsm); - searcher.Search("in db and here we have user_id=0x0d0a; same as CRLF"); - UNIT_ASSERT(searcher.Captured()); + TCapturingFsm fsm("here we have user_id=([a-z0-9]+);"); + + TSearcher searcher(fsm); + searcher.Search("in db and here we have user_id=0x0d0a; same as CRLF"); + UNIT_ASSERT(searcher.Captured()); UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("0x0d0a")); - } - + } + Y_UNIT_TEST(Capture2) { - TCapturingFsm fsm("w([abcdez]+)f"); - - TSearcher searcher(fsm); - searcher.Search("wabcdef"); - UNIT_ASSERT(searcher.Captured()); + TCapturingFsm fsm("w([abcdez]+)f"); + + TSearcher searcher(fsm); + searcher.Search("wabcdef"); + UNIT_ASSERT(searcher.Captured()); UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("abcde")); - } - + } + Y_UNIT_TEST(Capture3) { - TCapturingFsm fsm("http://vk(ontakte[.]ru|[.]com)/id(\\d+)([^0-9]|$)", + TCapturingFsm fsm("http://vk(ontakte[.]ru|[.]com)/id(\\d+)([^0-9]|$)", TFsm::TOptions().SetCapture(2)); - - TSearcher searcher(fsm); - searcher.Search("http://vkontakte.ru/id100500"); - UNIT_ASSERT(searcher.Captured()); + + TSearcher searcher(fsm); + searcher.Search("http://vkontakte.ru/id100500"); + UNIT_ASSERT(searcher.Captured()); UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("100500")); - } - + } + Y_UNIT_TEST(Capture4) { - TCapturingFsm fsm("Здравствуйте, ((\\s|\\w|[()]|-)+)!", + TCapturingFsm fsm("Здравствуйте, ((\\s|\\w|[()]|-)+)!", TFsm::TOptions().SetCharset(CODES_UTF8)); - - TSearcher searcher(fsm); - searcher.Search(" Здравствуйте, Уважаемый (-ая)! "); - UNIT_ASSERT(searcher.Captured()); + + TSearcher searcher(fsm); + searcher.Search(" Здравствуйте, Уважаемый (-ая)! "); + UNIT_ASSERT(searcher.Captured()); UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("Уважаемый (-ая)")); - } + } Y_UNIT_TEST(Capture5) { TCapturingFsm fsm("away\\.php\\?to=http:([^\"])+\""); |