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 #include "catch_option.hpp"
13 
14 #include <iosfwd>
15 #include <string>
16 #include <vector>
17 #include <memory>
18 
19 namespace Catch {
20 
21     enum class Verbosity {
22         Quiet = 0,
23         Normal,
24         High
25     };
26 
27     struct WarnAbout { enum What {
28         Nothing = 0x00,
29         NoAssertions = 0x01,
30         NoTests = 0x02
31     }; };
32 
33     struct ShowDurations { enum OrNot {
34         DefaultForReporter,
35         Always,
36         Never
37     }; };
38     struct RunTests { enum InWhatOrder {
39         InDeclarationOrder,
40         InLexicographicalOrder,
41         InRandomOrder
42     }; };
43     struct UseColour { enum YesOrNo {
44         Auto,
45         Yes,
46         No
47     }; };
48     struct WaitForKeypress { enum When {
49         Never,
50         BeforeStart = 1,
51         BeforeExit = 2,
52         BeforeStartAndExit = BeforeStart | BeforeExit
53     }; };
54 
55     class TestSpec;
56 
57     struct IConfig : NonCopyable {
58 
59         virtual ~IConfig();
60 
61         virtual bool allowThrows() const = 0;
62         virtual std::ostream& stream() const = 0;
63         virtual std::string name() const = 0;
64         virtual bool includeSuccessfulResults() const = 0;
65         virtual bool shouldDebugBreak() const = 0;
66         virtual bool warnAboutMissingAssertions() const = 0;
67         virtual bool warnAboutNoTests() const = 0;
68         virtual int abortAfter() const = 0;
69         virtual bool showInvisibles() const = 0;
70         virtual ShowDurations::OrNot showDurations() const = 0;
71         virtual TestSpec const& testSpec() const = 0;
72         virtual bool hasTestFilters() const = 0;
73         virtual std::vector<std::string> const& getTestsOrTags() const = 0;
74         virtual RunTests::InWhatOrder runOrder() const = 0;
75         virtual unsigned int rngSeed() const = 0;
76         virtual UseColour::YesOrNo useColour() const = 0;
77         virtual std::vector<std::string> const& getSectionsToRun() const = 0;
78         virtual Verbosity verbosity() const = 0;
79 
80         virtual bool benchmarkNoAnalysis() const = 0;
81         virtual int benchmarkSamples() const = 0;
82         virtual double benchmarkConfidenceInterval() const = 0;
83         virtual unsigned int benchmarkResamples() const = 0;
84     };
85 
86     using IConfigPtr = std::shared_ptr<IConfig const>;
87 }
88 
89 #endif // TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED
90