diff options
author | galtsev <galtsev@yandex-team.ru> | 2022-02-10 16:49:32 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:32 +0300 |
commit | 1503061b80644305b2e6dd1327b57118e35ebd31 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/regex | |
parent | b3770c4662dc5be7135e21630d44f69d0787c167 (diff) | |
download | ydb-1503061b80644305b2e6dd1327b57118e35ebd31.tar.gz |
Restoring authorship annotation for <galtsev@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/regex')
-rw-r--r-- | library/cpp/regex/hyperscan/hyperscan.h | 4 | ||||
-rw-r--r-- | library/cpp/regex/pire/ut/regexp_ut.cpp | 110 | ||||
-rw-r--r-- | library/cpp/regex/pire/ut/ya.make | 2 | ||||
-rw-r--r-- | library/cpp/regex/pire/ya.make | 4 |
4 files changed, 60 insertions, 60 deletions
diff --git a/library/cpp/regex/hyperscan/hyperscan.h b/library/cpp/regex/hyperscan/hyperscan.h index f116d683d8..1c8f404389 100644 --- a/library/cpp/regex/hyperscan/hyperscan.h +++ b/library/cpp/regex/hyperscan/hyperscan.h @@ -123,8 +123,8 @@ namespace NHyperscan { TDatabase CompileMulti( const TVector<const char*>& regexs, const TVector<unsigned int>& flags, - const TVector<unsigned int>& ids, - const TVector<const hs_expr_ext_t*>* extendedParameters = nullptr); + const TVector<unsigned int>& ids, + const TVector<const hs_expr_ext_t*>* extendedParameters = nullptr); TDatabase CompileMulti( const TVector<const char*>& regexs, diff --git a/library/cpp/regex/pire/ut/regexp_ut.cpp b/library/cpp/regex/pire/ut/regexp_ut.cpp index 90fdcc4a2c..e7206de9ad 100644 --- a/library/cpp/regex/pire/ut/regexp_ut.cpp +++ b/library/cpp/regex/pire/ut/regexp_ut.cpp @@ -156,66 +156,66 @@ Y_UNIT_TEST_SUITE(TRegExp) { //UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("pref bla suff")); } - Y_UNIT_TEST(CaptureXA) { - TCapturingFsm fsm(".*(xa).*"); - - TSearcher searcher(fsm); - searcher.Search("xa"); - UNIT_ASSERT(searcher.Captured()); + Y_UNIT_TEST(CaptureXA) { + TCapturingFsm fsm(".*(xa).*"); + + TSearcher searcher(fsm); + searcher.Search("xa"); + UNIT_ASSERT(searcher.Captured()); UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xa")); - } - - Y_UNIT_TEST(CaptureWrongXX) { - TCapturingFsm fsm(".*(xx).*"); - - TSearcher searcher(fsm); - searcher.Search("xx"); - UNIT_ASSERT(searcher.Captured()); - // Surprise! - // TCapturingFsm uses a fast - O(|text|) - but incorrect algorithm. - // It works more or less for a particular class of regexps to which ".*(xx).*" does not belong. - // So it returns not the expected "xx" but just the second "x" instead. + } + + Y_UNIT_TEST(CaptureWrongXX) { + TCapturingFsm fsm(".*(xx).*"); + + TSearcher searcher(fsm); + searcher.Search("xx"); + UNIT_ASSERT(searcher.Captured()); + // Surprise! + // TCapturingFsm uses a fast - O(|text|) - but incorrect algorithm. + // It works more or less for a particular class of regexps to which ".*(xx).*" does not belong. + // So it returns not the expected "xx" but just the second "x" instead. UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("x")); - } - - Y_UNIT_TEST(CaptureRight1XX) { - TCapturingFsm fsm("[^x]+(xx).*"); - - TSearcher searcher(fsm); - - searcher.Search("xxx"); - UNIT_ASSERT(!searcher.Captured()); - } - - Y_UNIT_TEST(CaptureRight2XX) { - TCapturingFsm fsm("[^x]+(xx).*"); - - TSearcher searcher(fsm); - - searcher.Search("axx"); - UNIT_ASSERT(searcher.Captured()); + } + + Y_UNIT_TEST(CaptureRight1XX) { + TCapturingFsm fsm("[^x]+(xx).*"); + + TSearcher searcher(fsm); + + searcher.Search("xxx"); + UNIT_ASSERT(!searcher.Captured()); + } + + Y_UNIT_TEST(CaptureRight2XX) { + TCapturingFsm fsm("[^x]+(xx).*"); + + TSearcher searcher(fsm); + + searcher.Search("axx"); + UNIT_ASSERT(searcher.Captured()); UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xx")); - } - - Y_UNIT_TEST(CaptureRight3XX) { - TCapturingFsm fsm("[^x]+(xx).*"); - - TSearcher searcher(fsm); - - searcher.Search("axxb"); - UNIT_ASSERT(searcher.Captured()); + } + + Y_UNIT_TEST(CaptureRight3XX) { + TCapturingFsm fsm("[^x]+(xx).*"); + + TSearcher searcher(fsm); + + searcher.Search("axxb"); + UNIT_ASSERT(searcher.Captured()); UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xx")); - } - - Y_UNIT_TEST(SlowCaptureXX) { - TSlowCapturingFsm fsm(".*(xx).*"); - - TSlowSearcher searcher(fsm); - searcher.Search("xx"); - UNIT_ASSERT(searcher.Captured()); + } + + Y_UNIT_TEST(SlowCaptureXX) { + TSlowCapturingFsm fsm(".*(xx).*"); + + TSlowSearcher searcher(fsm); + searcher.Search("xx"); + UNIT_ASSERT(searcher.Captured()); UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xx")); - } - + } + Y_UNIT_TEST(SlowCapture) { TSlowCapturingFsm fsm("^http://vk(ontakte[.]ru|[.]com)/id(\\d+)([^0-9]|$)", TFsm::TOptions().SetCapture(2)); diff --git a/library/cpp/regex/pire/ut/ya.make b/library/cpp/regex/pire/ut/ya.make index 212901e911..8776695f40 100644 --- a/library/cpp/regex/pire/ut/ya.make +++ b/library/cpp/regex/pire/ut/ya.make @@ -28,7 +28,7 @@ SRCS( pire_ut.cpp capture_ut.cpp count_ut.cpp - glyph_ut.cpp + glyph_ut.cpp easy_ut.cpp read_unicode_ut.cpp regexp_ut.cpp diff --git a/library/cpp/regex/pire/ya.make b/library/cpp/regex/pire/ya.make index 50857fc11d..c857e6d18b 100644 --- a/library/cpp/regex/pire/ya.make +++ b/library/cpp/regex/pire/ya.make @@ -36,5 +36,5 @@ PEERDIR( ) END() - -RECURSE_FOR_TESTS(ut) + +RECURSE_FOR_TESTS(ut) |