mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-04 00:51:52 +01:00 
			
		
		
		
	* Units from <ratio> are no longer redeclared in our own namespace * The default clock is `steady_clock`, not `high_resolution_clock`, because, as HH says "high_resolution_clock is useless. If you want measure the passing of time, use steady_clock. If you want user friendly time, use system_clock". * Benchmarking support is opt-in, not opt-out, to avoid the large (~10%) compile time penalty. * Benchmarking-related options in CLI are always present, to decrease the amount of code that is only compiled conditionally and making the whole shebang more maintainble.
		
			
				
	
	
		
			130 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			130 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
/*
 | 
						|
 *  Created by Phil on 08/11/2010.
 | 
						|
 *  Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
 | 
						|
 *
 | 
						|
 *  Distributed under the Boost Software License, Version 1.0. (See accompanying
 | 
						|
 *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 | 
						|
 */
 | 
						|
#ifndef TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
 | 
						|
#define TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
 | 
						|
 | 
						|
#include "catch_test_spec_parser.h"
 | 
						|
#include "catch_interfaces_config.h"
 | 
						|
 | 
						|
// Libstdc++ doesn't like incomplete classes for unique_ptr
 | 
						|
#include "catch_stream.h"
 | 
						|
 | 
						|
#include <memory>
 | 
						|
#include <vector>
 | 
						|
#include <string>
 | 
						|
 | 
						|
#ifndef CATCH_CONFIG_CONSOLE_WIDTH
 | 
						|
#define CATCH_CONFIG_CONSOLE_WIDTH 80
 | 
						|
#endif
 | 
						|
 | 
						|
namespace Catch {
 | 
						|
 | 
						|
    struct IStream;
 | 
						|
 | 
						|
    struct ConfigData {
 | 
						|
        bool listTests = false;
 | 
						|
        bool listTags = false;
 | 
						|
        bool listReporters = false;
 | 
						|
        bool listTestNamesOnly = false;
 | 
						|
 | 
						|
        bool showSuccessfulTests = false;
 | 
						|
        bool shouldDebugBreak = false;
 | 
						|
        bool noThrow = false;
 | 
						|
        bool showHelp = false;
 | 
						|
        bool showInvisibles = false;
 | 
						|
        bool filenamesAsTags = false;
 | 
						|
        bool libIdentify = false;
 | 
						|
 | 
						|
        int abortAfter = -1;
 | 
						|
        unsigned int rngSeed = 0;
 | 
						|
 | 
						|
        bool benchmarkNoAnalysis = false;
 | 
						|
        unsigned int benchmarkSamples = 100;
 | 
						|
        double benchmarkConfidenceInterval = 0.95;
 | 
						|
        unsigned int benchmarkResamples = 100000;
 | 
						|
 | 
						|
        Verbosity verbosity = Verbosity::Normal;
 | 
						|
        WarnAbout::What warnings = WarnAbout::Nothing;
 | 
						|
        ShowDurations::OrNot showDurations = ShowDurations::DefaultForReporter;
 | 
						|
        RunTests::InWhatOrder runOrder = RunTests::InDeclarationOrder;
 | 
						|
        UseColour::YesOrNo useColour = UseColour::Auto;
 | 
						|
        WaitForKeypress::When waitForKeypress = WaitForKeypress::Never;
 | 
						|
 | 
						|
        std::string outputFilename;
 | 
						|
        std::string name;
 | 
						|
        std::string processName;
 | 
						|
#ifndef CATCH_CONFIG_DEFAULT_REPORTER
 | 
						|
#define CATCH_CONFIG_DEFAULT_REPORTER "console"
 | 
						|
#endif
 | 
						|
        std::string reporterName = CATCH_CONFIG_DEFAULT_REPORTER;
 | 
						|
#undef CATCH_CONFIG_DEFAULT_REPORTER
 | 
						|
 | 
						|
        std::vector<std::string> testsOrTags;
 | 
						|
        std::vector<std::string> sectionsToRun;
 | 
						|
    };
 | 
						|
 | 
						|
 | 
						|
    class Config : public IConfig {
 | 
						|
    public:
 | 
						|
 | 
						|
        Config() = default;
 | 
						|
        Config( ConfigData const& data );
 | 
						|
        virtual ~Config() = default;
 | 
						|
 | 
						|
        std::string const& getFilename() const;
 | 
						|
 | 
						|
        bool listTests() const;
 | 
						|
        bool listTestNamesOnly() const;
 | 
						|
        bool listTags() const;
 | 
						|
        bool listReporters() const;
 | 
						|
 | 
						|
        std::string getProcessName() const;
 | 
						|
        std::string const& getReporterName() const;
 | 
						|
 | 
						|
        std::vector<std::string> const& getTestsOrTags() const override;
 | 
						|
        std::vector<std::string> const& getSectionsToRun() const override;
 | 
						|
 | 
						|
        TestSpec const& testSpec() const override;
 | 
						|
        bool hasTestFilters() const override;
 | 
						|
 | 
						|
        bool showHelp() const;
 | 
						|
 | 
						|
        // IConfig interface
 | 
						|
        bool allowThrows() const override;
 | 
						|
        std::ostream& stream() const override;
 | 
						|
        std::string name() const override;
 | 
						|
        bool includeSuccessfulResults() const override;
 | 
						|
        bool warnAboutMissingAssertions() const override;
 | 
						|
        bool warnAboutNoTests() const override;
 | 
						|
        ShowDurations::OrNot showDurations() const override;
 | 
						|
        RunTests::InWhatOrder runOrder() const override;
 | 
						|
        unsigned int rngSeed() const override;
 | 
						|
        UseColour::YesOrNo useColour() const override;
 | 
						|
        bool shouldDebugBreak() const override;
 | 
						|
        int abortAfter() const override;
 | 
						|
        bool showInvisibles() const override;
 | 
						|
        Verbosity verbosity() const override;
 | 
						|
        bool benchmarkNoAnalysis() const override;
 | 
						|
        int benchmarkSamples() const override;
 | 
						|
        double benchmarkConfidenceInterval() const override;
 | 
						|
        unsigned int benchmarkResamples() const override;
 | 
						|
 | 
						|
    private:
 | 
						|
 | 
						|
        IStream const* openStream();
 | 
						|
        ConfigData m_data;
 | 
						|
 | 
						|
        std::unique_ptr<IStream const> m_stream;
 | 
						|
        TestSpec m_testSpec;
 | 
						|
        bool m_hasTestFilters = false;
 | 
						|
    };
 | 
						|
 | 
						|
} // end namespace Catch
 | 
						|
 | 
						|
#endif // TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
 |