mirror of
https://github.com/google/googletest.git
synced 2025-12-21 19:14:55 +08:00
Merge branch 'google:main' into master
This commit is contained in:
commit
782820fc60
@ -7820,3 +7820,35 @@ TEST(RegisterTest, WasRegistered) {
|
||||
|
||||
FAIL() << "Didn't find the test!";
|
||||
}
|
||||
|
||||
// Test that the pattern globbing algorithm is linear. If not, this test should
|
||||
// time out.
|
||||
TEST(PatternGlobbingTest, MatchesFilterLinearRuntime) {
|
||||
std::string name(100, 'a'); // Construct the string (a^100)b
|
||||
name.push_back('b');
|
||||
|
||||
std::string pattern; // Construct the string ((a*)^100)b
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
pattern.append("a*");
|
||||
}
|
||||
pattern.push_back('b');
|
||||
|
||||
EXPECT_TRUE(
|
||||
testing::internal::UnitTestOptions::MatchesFilter(name, pattern.c_str()));
|
||||
}
|
||||
|
||||
TEST(PatternGlobbingTest, MatchesFilterWithMultiplePatterns) {
|
||||
const std::string name = "aaaa";
|
||||
EXPECT_TRUE(testing::internal::UnitTestOptions::MatchesFilter(name, "a*"));
|
||||
EXPECT_TRUE(testing::internal::UnitTestOptions::MatchesFilter(name, "a*:"));
|
||||
EXPECT_FALSE(testing::internal::UnitTestOptions::MatchesFilter(name, "ab"));
|
||||
EXPECT_FALSE(testing::internal::UnitTestOptions::MatchesFilter(name, "ab:"));
|
||||
EXPECT_TRUE(testing::internal::UnitTestOptions::MatchesFilter(name, "ab:a*"));
|
||||
}
|
||||
|
||||
TEST(PatternGlobbingTest, MatchesFilterEdgeCases) {
|
||||
EXPECT_FALSE(testing::internal::UnitTestOptions::MatchesFilter("", "*a"));
|
||||
EXPECT_TRUE(testing::internal::UnitTestOptions::MatchesFilter("", "*"));
|
||||
EXPECT_FALSE(testing::internal::UnitTestOptions::MatchesFilter("a", ""));
|
||||
EXPECT_TRUE(testing::internal::UnitTestOptions::MatchesFilter("", ""));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user