aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/regex/pire/ut/regexp_ut.cpp
diff options
context:
space:
mode:
authorAlexander Gololobov <davenger@yandex-team.com>2022-02-10 16:47:38 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:38 +0300
commitfccc62e9bfdce9be2fe7e0f23479da3a5512211a (patch)
treec0748b5dcbade83af788c0abfa89c0383d6b779c /library/cpp/regex/pire/ut/regexp_ut.cpp
parent39608cdb86363c75ce55b2b9a69841c3b71f22cf (diff)
downloadydb-fccc62e9bfdce9be2fe7e0f23479da3a5512211a.tar.gz
Restoring authorship annotation for Alexander Gololobov <davenger@yandex-team.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.cpp50
1 files changed, 25 insertions, 25 deletions
diff --git a/library/cpp/regex/pire/ut/regexp_ut.cpp b/library/cpp/regex/pire/ut/regexp_ut.cpp
index 7c517bc583..e7206de9ad 100644
--- a/library/cpp/regex/pire/ut/regexp_ut.cpp
+++ b/library/cpp/regex/pire/ut/regexp_ut.cpp
@@ -17,41 +17,41 @@ Y_UNIT_TEST_SUITE(TRegExp) {
}
Y_UNIT_TEST(Boundaries) {
- UNIT_ASSERT(!TMatcher(TFsm("qwb$", TFsm::TOptions().SetSurround(true))).Match("aqwb").Final());
- UNIT_ASSERT(!TMatcher(TFsm("^aqw", TFsm::TOptions().SetSurround(true))).Match("aqwb").Final());
+ UNIT_ASSERT(!TMatcher(TFsm("qwb$", TFsm::TOptions().SetSurround(true))).Match("aqwb").Final());
+ UNIT_ASSERT(!TMatcher(TFsm("^aqw", TFsm::TOptions().SetSurround(true))).Match("aqwb").Final());
UNIT_ASSERT(TMatcher(TFsm("qwb$", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final());
UNIT_ASSERT(TMatcher(TFsm("^aqw", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final());
UNIT_ASSERT(!TMatcher(TFsm("qw$", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final());
UNIT_ASSERT(!TMatcher(TFsm("^qw", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final());
-
- UNIT_ASSERT(TMatcher(TFsm("^aqwb$", TFsm::TOptions().SetSurround(true)))
+
+ UNIT_ASSERT(TMatcher(TFsm("^aqwb$", TFsm::TOptions().SetSurround(true)))
.Match(TStringBuf("a"), true, false)
.Match(TStringBuf("q"), false, false)
.Match(TStringBuf("w"), false, false)
.Match(TStringBuf("b"), false, true)
.Final());
- }
-
+ }
+
Y_UNIT_TEST(Case) {
UNIT_ASSERT(TMatcher(TFsm("qw", TFsm::TOptions().SetCaseInsensitive(true))).Match("Qw").Final());
UNIT_ASSERT(!TMatcher(TFsm("qw", TFsm::TOptions().SetCaseInsensitive(false))).Match("Qw").Final());
}
-
+
Y_UNIT_TEST(UnicodeCase) {
UNIT_ASSERT(TMatcher(TFsm("\\x{61}\\x{62}", TFsm::TOptions().SetCaseInsensitive(true))).Match("Ab").Final());
UNIT_ASSERT(!TMatcher(TFsm("\\x{61}\\x{62}", TFsm::TOptions().SetCaseInsensitive(false))).Match("Ab").Final());
}
Y_UNIT_TEST(Utf) {
- NRegExp::TFsmBase::TOptions opts;
- opts.Charset = CODES_UTF8;
- opts.Surround = true;
- UNIT_ASSERT(TMatcher(TFsm(".*", opts)).Match("wtf").Final());
- UNIT_ASSERT(TMatcher(TFsm(".*", opts)).Match("чзн").Final());
- UNIT_ASSERT(TMatcher(TFsm("ч.*", opts)).Match("чзн").Final());
- UNIT_ASSERT(!TMatcher(TFsm("чзн", opts)).Match("чзх").Final());
- }
-
+ NRegExp::TFsmBase::TOptions opts;
+ opts.Charset = CODES_UTF8;
+ opts.Surround = true;
+ UNIT_ASSERT(TMatcher(TFsm(".*", opts)).Match("wtf").Final());
+ UNIT_ASSERT(TMatcher(TFsm(".*", opts)).Match("чзн").Final());
+ UNIT_ASSERT(TMatcher(TFsm("ч.*", opts)).Match("чзн").Final());
+ UNIT_ASSERT(!TMatcher(TFsm("чзн", opts)).Match("чзх").Final());
+ }
+
Y_UNIT_TEST(AndNot) {
NRegExp::TFsmBase::TOptions opts;
opts.AndNotSupport = true;
@@ -84,15 +84,15 @@ Y_UNIT_TEST_SUITE(TRegExp) {
}
Y_UNIT_TEST(Glue) {
- TFsm glued =
- TFsm("qw", TFsm::TOptions().SetCaseInsensitive(true)) |
- TFsm("qw", TFsm::TOptions().SetCaseInsensitive(false)) |
- TFsm("abc", TFsm::TOptions().SetCaseInsensitive(false));
- UNIT_ASSERT(TMatcher(glued).Match("Qw").Final());
- UNIT_ASSERT(TMatcher(glued).Match("Qw").Final());
- UNIT_ASSERT(TMatcher(glued).Match("abc").Final());
- UNIT_ASSERT(!TMatcher(glued).Match("Abc").Final());
- }
+ TFsm glued =
+ TFsm("qw", TFsm::TOptions().SetCaseInsensitive(true)) |
+ TFsm("qw", TFsm::TOptions().SetCaseInsensitive(false)) |
+ TFsm("abc", TFsm::TOptions().SetCaseInsensitive(false));
+ UNIT_ASSERT(TMatcher(glued).Match("Qw").Final());
+ UNIT_ASSERT(TMatcher(glued).Match("Qw").Final());
+ 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]+);");