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