2021-02-28 13:09:13 -08:00
|
|
|
/*
|
2021-04-22 16:53:07 -07:00
|
|
|
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
|
2021-04-22 22:51:19 +02:00
|
|
|
* Copyright (c) 2020-2021, Linus Groh <linusg@serenityos.org>
|
2021-04-22 12:11:04 -07:00
|
|
|
* Copyright (c) 2021, Brian Gianforcaro <bgianf@serenityos.org>
|
2023-07-22 19:39:31 +12:00
|
|
|
* Copyright (c) 2023, Shannon Booth <shannon@serenityos.org>
|
2021-02-28 13:09:13 -08:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-02-28 13:09:13 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2023-12-16 17:49:34 +03:30
|
|
|
#include <AK/ByteString.h>
|
2025-02-17 12:18:27 -05:00
|
|
|
#include <AK/String.h>
|
2021-02-28 13:09:13 -08:00
|
|
|
#include <AK/Vector.h>
|
|
|
|
|
|
|
|
|
|
namespace Test {
|
|
|
|
|
|
|
|
|
|
enum class Result {
|
|
|
|
|
Pass,
|
|
|
|
|
Fail,
|
|
|
|
|
Skip,
|
2023-07-22 19:39:31 +12:00
|
|
|
ExpectedFail,
|
2021-06-27 14:22:25 -06:00
|
|
|
Crashed,
|
2021-02-28 13:09:13 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Case {
|
2025-02-17 12:18:27 -05:00
|
|
|
String name;
|
2021-02-28 13:09:13 -08:00
|
|
|
Result result;
|
2025-02-17 15:04:56 -05:00
|
|
|
String details;
|
2022-03-08 07:09:41 +03:30
|
|
|
u64 duration_us;
|
2021-02-28 13:09:13 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Suite {
|
2023-12-16 17:49:34 +03:30
|
|
|
ByteString path;
|
2025-02-17 12:18:27 -05:00
|
|
|
String name;
|
2021-02-28 13:09:13 -08:00
|
|
|
// A failed test takes precedence over a skipped test, which both have
|
|
|
|
|
// precedence over a passed test
|
|
|
|
|
Result most_severe_test_result { Result::Pass };
|
|
|
|
|
Vector<Case> tests {};
|
|
|
|
|
};
|
|
|
|
|
|
2021-03-23 23:19:31 +01:00
|
|
|
struct Counts {
|
|
|
|
|
// Not all of these might be used by a certain test runner, e.g. some
|
|
|
|
|
// do not have a concept of suites, or might not load tests from files.
|
|
|
|
|
unsigned tests_failed { 0 };
|
|
|
|
|
unsigned tests_passed { 0 };
|
|
|
|
|
unsigned tests_skipped { 0 };
|
2023-07-22 19:39:31 +12:00
|
|
|
unsigned tests_expected_failed { 0 };
|
2021-03-23 23:19:31 +01:00
|
|
|
unsigned suites_failed { 0 };
|
|
|
|
|
unsigned suites_passed { 0 };
|
|
|
|
|
unsigned files_total { 0 };
|
|
|
|
|
};
|
|
|
|
|
|
2021-02-28 13:09:13 -08:00
|
|
|
}
|