1 /*
2  *  Created by Phil on 05/06/2012.
3  *  Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
4  *
5  *  Distributed under the Boost Software License, Version 1.0. (See accompanying
6  *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7  */
8 #ifndef TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED
9 #define TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED
10 
11 #include "catch_common.h"
12 
13 #include <iosfwd>
14 #include <string>
15 #include <vector>
16 #include <memory>
17 
18 namespace Catch {
19 
20     enum class Verbosity {
21         Quiet = 0,
22         Normal,
23         High
24     };
25 
26     struct WarnAbout { enum What {
27         Nothing = 0x00,
28         NoAssertions = 0x01,
29         NoTests = 0x02
30     }; };
31 
32     struct ShowDurations { enum OrNot {
33         DefaultForReporter,
34         Always,
35         Never
36     }; };
37     struct RunTests { enum InWhatOrder {
38         InDeclarationOrder,
39         InLexicographicalOrder,
40         InRandomOrder
41     }; };
42     struct UseColour { enum YesOrNo {
43         Auto,
44         Yes,
45         No
46     }; };
47     struct WaitForKeypress { enum When {
48         Never,
49         BeforeStart = 1,
50         BeforeExit = 2,
51         BeforeStartAndExit = BeforeStart | BeforeExit
52     }; };
53 
54     class TestSpec;
55 
56     struct IConfig : NonCopyable {
57 
58         virtual ~IConfig();
59 
60         virtual bool allowThrows() const = 0;
61         virtual std::ostream& stream() const = 0;
62         virtual std::string name() const = 0;
63         virtual bool includeSuccessfulResults() const = 0;
64         virtual bool shouldDebugBreak() const = 0;
65         virtual bool warnAboutMissingAssertions() const = 0;
66         virtual bool warnAboutNoTests() const = 0;
67         virtual int abortAfter() const = 0;
68         virtual bool showInvisibles() const = 0;
69         virtual ShowDurations::OrNot showDurations() const = 0;
70         virtual TestSpec const& testSpec() const = 0;
71         virtual bool hasTestFilters() const = 0;
72         virtual RunTests::InWhatOrder runOrder() const = 0;
73         virtual unsigned int rngSeed() const = 0;
74         virtual int benchmarkResolutionMultiple() const = 0;
75         virtual UseColour::YesOrNo useColour() const = 0;
76         virtual std::vector<std::string> const& getSectionsToRun() const = 0;
77         virtual Verbosity verbosity() const = 0;
78     };
79 
80     using IConfigPtr = std::shared_ptr<IConfig const>;
81 }
82 
83 #endif // TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED
84