forked from microsoft/onnxruntime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3078acf
commit 331ef01
Showing
5 changed files
with
36 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#include "gtest/gtest.h" | ||
#include "test/providers/provider_test_utils.h" | ||
|
||
namespace onnxruntime { | ||
namespace test { | ||
|
||
|
@@ -20,5 +19,26 @@ TEST(RegexFullMatch, EmailMatch) { | |
RunTest({2, 2}, {"[email protected]", "[email protected]", "not email", "[email protected]"}, R"((\W|^)[\w.\-]{0,25}@(yahoo|gmail)\.com(\W|$))", {true, false, false, true}); | ||
} | ||
|
||
TEST(RegexFullMatch, MultibyteMatch) { | ||
RunTest({1, 2}, {"ä", "a"}, "ä", {true, false}); | ||
RunTest({1,}, {"une cédille like in Besançon"}, R"(.*cédille.*)", {true,}); | ||
RunTest({1,}, {"une cédille like in Besançon"}, R"(.*cedille.*)", {false,}); | ||
RunTest({1,}, {"Mit freundlichen Grüßen"}, R"(.*Grüßen$)", {true,}); | ||
RunTest({1,}, {"Mit freundlichen Grüßen"}, R"(.*Grußen$)", {false,}); | ||
RunTest({3,}, {"HПонедельник", "Понедельник", "недельник"}, R"(^Понед.*)", {false, true, false,}); | ||
RunTest({3,}, {"thank you", "どうもありがとうございます", "こんにちは世界"}, R"(^こんにちは世界.*)", {false, false, true,}); | ||
RunTest({3,}, {"नमस्ते, आपसे मिलकर अच्छा लगा", "नमस्ते", "स्वागत एवं नमस्ते"}, R"(.+नमस्ते$)", {false, false, true,}); | ||
RunTest({3,}, {"你好,你好吗?", "你好呀", "你好呀!"}, R"(^你好.*\?$)", {true, false, false,}); | ||
} | ||
|
||
TEST(RegexFullMatch, InvalidPattern) { | ||
std::cout << "TRYING RUN\n"; | ||
OpTester test("RegexFullMatch", 20, kOnnxDomain); | ||
test.AddAttribute("pattern", R"([a-z)"); | ||
test.AddInput<std::string>("Input", {1,}, {"abcdef",}); | ||
test.AddOutput<bool>("Output", {1,}, {false,}); | ||
test.Run(BaseTester::ExpectResult::kExpectFailure, "Invalid regex pattern: [a-z"); | ||
} | ||
|
||
} // namespace test | ||
} // namespace onnxruntime |