summaryrefslogtreecommitdiff
path: root/Tests/AK
diff options
context:
space:
mode:
authorMax Wipfli <mail@maxwipfli.ch>2021-06-24 09:00:52 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-24 09:16:28 +0200
commitb3c3b78b01ef58c83a2b6316f240a4bce7e28473 (patch)
treeba21ac314c7435350496b4c640aeaa0aaec9a7a9 /Tests/AK
parentac650d2362488029258f92d9c773d51a115695d6 (diff)
downloadserenity-b3c3b78b01ef58c83a2b6316f240a4bce7e28473.zip
Tests: Reduce runtime of TestCharacterTypes
This declares all test cases which compare function outputs over the entire Unicode range as `BENCHMARK_CASE`, to avoid them being run by CI. This reduces runtime of TestCharacterTypes (without benchmarks) by about one third.
Diffstat (limited to 'Tests/AK')
-rw-r--r--Tests/AK/TestCharacterTypes.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/Tests/AK/TestCharacterTypes.cpp b/Tests/AK/TestCharacterTypes.cpp
index 0c21eb75d7..0f5e5f492a 100644
--- a/Tests/AK/TestCharacterTypes.cpp
+++ b/Tests/AK/TestCharacterTypes.cpp
@@ -34,10 +34,7 @@ void compare_value_output_over(u32 range, auto& old_function, auto& new_function
}
}
-TEST_CASE(is_ascii)
-{
- compare_bool_output_over(UNICODE, isascii, is_ascii);
-}
+// NOTE: Avoid comparing over UNICODE in "TEST_CASE" due to test runtime becoming too long.
TEST_CASE(is_ascii_alphanumeric)
{
@@ -101,12 +98,12 @@ TEST_CASE(is_ascii_upper_alpha)
TEST_CASE(to_ascii_lowercase)
{
- compare_value_output_over(UNICODE, tolower, to_ascii_lowercase);
+ compare_value_output_over(ASCII, tolower, to_ascii_lowercase);
}
TEST_CASE(to_ascii_uppercase)
{
- compare_value_output_over(UNICODE, toupper, to_ascii_uppercase);
+ compare_value_output_over(ASCII, toupper, to_ascii_uppercase);
}
TEST_CASE(parse_ascii_digit)
@@ -133,3 +130,18 @@ TEST_CASE(parse_ascii_hex_digit)
return Test::Crash::Failure::DidNotCrash;
});
}
+
+BENCHMARK_CASE(is_ascii)
+{
+ compare_bool_output_over(UNICODE, isascii, is_ascii);
+}
+
+BENCHMARK_CASE(to_ascii_lowercase_unicode)
+{
+ compare_value_output_over(UNICODE, tolower, to_ascii_lowercase);
+}
+
+BENCHMARK_CASE(to_ascii_uppercase_unicode)
+{
+ compare_value_output_over(UNICODE, toupper, to_ascii_uppercase);
+}