1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:17:35 +00:00

Everywhere: Run clang-format

This commit is contained in:
Idan Horowitz 2022-04-01 20:58:27 +03:00 committed by Linus Groh
parent 0376c127f6
commit 086969277e
1665 changed files with 8479 additions and 8479 deletions

View file

@ -45,7 +45,7 @@ void current_test_case_did_fail()
}
// Declared in TestCase.h
void add_test_case_to_suite(const NonnullRefPtr<TestCase>& test_case)
void add_test_case_to_suite(NonnullRefPtr<TestCase> const& test_case)
{
TestSuite::the().add_case(test_case);
}
@ -56,7 +56,7 @@ void set_suite_setup_function(Function<void()> setup)
TestSuite::the().set_suite_setup(move(setup));
}
int TestSuite::main(const String& suite_name, int argc, char** argv)
int TestSuite::main(String const& suite_name, int argc, char** argv)
{
m_suite_name = suite_name;
@ -65,7 +65,7 @@ int TestSuite::main(const String& suite_name, int argc, char** argv)
bool do_tests_only = getenv("TESTS_ONLY") != nullptr;
bool do_benchmarks_only = false;
bool do_list_cases = false;
const char* search_string = "*";
char const* search_string = "*";
args_parser.add_option(do_tests_only, "Only run tests.", "tests", 0);
args_parser.add_option(do_benchmarks_only, "Only run benchmarks.", "bench", 0);
@ -76,11 +76,11 @@ int TestSuite::main(const String& suite_name, int argc, char** argv)
if (m_setup)
m_setup();
const auto& matching_tests = find_cases(search_string, !do_benchmarks_only, !do_tests_only);
auto const& matching_tests = find_cases(search_string, !do_benchmarks_only, !do_tests_only);
if (do_list_cases) {
outln("Available cases for {}:", suite_name);
for (const auto& test : matching_tests) {
for (auto const& test : matching_tests) {
outln(" {}", test.name());
}
return 0;
@ -91,10 +91,10 @@ int TestSuite::main(const String& suite_name, int argc, char** argv)
return run(matching_tests);
}
NonnullRefPtrVector<TestCase> TestSuite::find_cases(const String& search, bool find_tests, bool find_benchmarks)
NonnullRefPtrVector<TestCase> TestSuite::find_cases(String const& search, bool find_tests, bool find_benchmarks)
{
NonnullRefPtrVector<TestCase> matches;
for (const auto& t : m_cases) {
for (auto const& t : m_cases) {
if (!search.is_empty() && !t.name().matches(search, CaseSensitivity::CaseInsensitive)) {
continue;
}
@ -111,22 +111,22 @@ NonnullRefPtrVector<TestCase> TestSuite::find_cases(const String& search, bool f
return matches;
}
int TestSuite::run(const NonnullRefPtrVector<TestCase>& tests)
int TestSuite::run(NonnullRefPtrVector<TestCase> const& tests)
{
size_t test_count = 0;
size_t test_failed_count = 0;
size_t benchmark_count = 0;
TestElapsedTimer global_timer;
for (const auto& t : tests) {
const auto test_type = t.is_benchmark() ? "benchmark" : "test";
for (auto const& t : tests) {
auto const test_type = t.is_benchmark() ? "benchmark" : "test";
warnln("Running {} '{}'.", test_type, t.name());
m_current_test_case_passed = true;
TestElapsedTimer timer;
t.func()();
const auto time = timer.elapsed_milliseconds();
auto const time = timer.elapsed_milliseconds();
dbgln("{} {} '{}' in {}ms", m_current_test_case_passed ? "Completed" : "Failed", test_type, t.name(), time);