From b3c3b78b01ef58c83a2b6316f240a4bce7e28473 Mon Sep 17 00:00:00 2001 From: Max Wipfli Date: Thu, 24 Jun 2021 09:00:52 +0200 Subject: 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. --- Tests/AK/TestCharacterTypes.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'Tests/AK') 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); +} -- cgit v1.2.3