summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibTest/Results.h
blob: 69f8622dd45ee76c35a807fa4e016aa2f9b5807f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
 * Copyright (c) 2020-2021, Linus Groh <linusg@serenityos.org>
 * Copyright (c) 2021, Brian Gianforcaro <bgianf@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/String.h>
#include <AK/Vector.h>

namespace Test {

enum class Result {
    Pass,
    Fail,
    Skip,
    Crashed,
};

struct Case {
    String name;
    Result result;
    String details;
};

struct Suite {
    String name;
    // 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 {};
};

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 };
    unsigned suites_failed { 0 };
    unsigned suites_passed { 0 };
    unsigned files_total { 0 };
};

}