1 /**
2 Copyright: Copyright (c) 2020, Joakim Brännström. All rights reserved.
3 License: MPL-2
4 Author: Joakim Brännström (joakim.brannstrom@gmx.com)
5 
6 This Source Code Form is subject to the terms of the Mozilla Public License,
7 v.2.0. If a copy of the MPL was not distributed with this file, You can obtain
8 one at http://mozilla.org/MPL/2.0/.
9 */
10 module dextool.plugin.mutate.backend.test_mutant.test_case_analyze;
11 
12 import dextool.plugin.mutate.backend.type : TestCase;
13 
14 /// A simple class to gather reported test cases.
15 struct GatherTestCase {
16     import std.algorithm : map;
17     import std.array : array;
18     import my.set;
19 
20     /// Test cases reported as failed.
21     Set!TestCase failed;
22 
23     /// The unstable test cases.
24     Set!TestCase unstable;
25 
26     /// Found test cases.
27     Set!TestCase found;
28 
29     Set!TestCase testCmd;
30 
31     void merge(GatherTestCase o) @safe nothrow {
32         failed.add(o.failed);
33         found.add(o.found);
34         unstable.add(o.unstable);
35     }
36 
37     void reportFailed(TestCase tc) @safe nothrow {
38         found.add(tc);
39         failed.add(tc);
40     }
41 
42     /// A test case that is found
43     void reportFound(TestCase tc) @safe nothrow {
44         found.add(tc);
45     }
46 
47     void reportUnstable(TestCase tc) @safe nothrow {
48         found.add(tc);
49         unstable.add(tc);
50     }
51 
52     void reportTestCmd(TestCase tc) @safe nothrow {
53         testCmd.add(tc);
54         found.add(tc);
55     }
56 }