LibRegex: Add some tests for Fork{Stay,Jump} performance
Without the previous fixes, these will blow up the stack.
This commit is contained in:
parent
5f342e4fa9
commit
85d87cbcc8
Notes:
sideshowbarker
2024-07-18 07:35:13 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/85d87cbcc84 Pull-request: https://github.com/SerenityOS/serenity/pull/9127
1 changed files with 16 additions and 0 deletions
|
@ -726,3 +726,19 @@ TEST_CASE(case_insensitive_match)
|
|||
EXPECT_EQ(result.matches.at(0).column, 4ul);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE(extremely_long_fork_chain)
|
||||
{
|
||||
Regex<ECMA262> re("(?:aa)*");
|
||||
auto result = re.match(String::repeated('a', 100'000));
|
||||
EXPECT_EQ(result.success, true);
|
||||
}
|
||||
|
||||
static auto g_lots_of_a_s = String::repeated('a', 10'000'000);
|
||||
|
||||
BENCHMARK_CASE(fork_performance)
|
||||
{
|
||||
Regex<ECMA262> re("(?:aa)*");
|
||||
auto result = re.match(g_lots_of_a_s);
|
||||
EXPECT_EQ(result.success, true);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue