2010-11-12 20:55:53 +01:00
|
|
|
/*
|
|
|
|
* 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)
|
|
|
|
*/
|
2012-09-17 07:42:29 +02:00
|
|
|
#ifndef TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
|
|
|
|
#define TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
|
2010-11-12 20:55:53 +01:00
|
|
|
|
2014-05-16 19:24:07 +02:00
|
|
|
#include "catch_test_spec_parser.hpp"
|
2012-05-10 08:58:48 +02:00
|
|
|
#include "catch_context.h"
|
2012-08-28 09:20:18 +02:00
|
|
|
#include "catch_interfaces_config.h"
|
2013-12-03 19:52:41 +01:00
|
|
|
#include "catch_stream.h"
|
2010-11-12 20:55:53 +01:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
|
2013-01-26 21:06:55 +01:00
|
|
|
#ifndef CATCH_CONFIG_CONSOLE_WIDTH
|
|
|
|
#define CATCH_CONFIG_CONSOLE_WIDTH 80
|
|
|
|
#endif
|
|
|
|
|
2012-05-16 00:58:23 +02:00
|
|
|
namespace Catch {
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2012-06-08 09:22:56 +02:00
|
|
|
struct ConfigData {
|
2017-04-25 19:56:53 +02:00
|
|
|
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;
|
|
|
|
|
|
|
|
int abortAfter = -1;
|
|
|
|
unsigned int rngSeed = 0;
|
|
|
|
|
2017-06-20 21:14:38 +02:00
|
|
|
Verbosity verbosity = Verbosity::Normal;
|
2017-04-25 19:56:53 +02:00
|
|
|
WarnAbout::What warnings = WarnAbout::Nothing;
|
|
|
|
ShowDurations::OrNot showDurations = ShowDurations::DefaultForReporter;
|
|
|
|
RunTests::InWhatOrder runOrder = RunTests::InDeclarationOrder;
|
|
|
|
UseColour::YesOrNo useColour = UseColour::Auto;
|
2013-05-29 09:12:57 +02:00
|
|
|
|
|
|
|
std::string outputFilename;
|
|
|
|
std::string name;
|
2013-06-04 09:37:28 +02:00
|
|
|
std::string processName;
|
2013-05-29 09:12:57 +02:00
|
|
|
|
2015-08-05 20:02:17 +02:00
|
|
|
std::vector<std::string> reporterNames;
|
2013-05-29 19:56:29 +02:00
|
|
|
std::vector<std::string> testsOrTags;
|
2017-01-12 18:10:38 +01:00
|
|
|
std::vector<std::string> sectionsToRun;
|
2012-06-08 09:22:56 +02:00
|
|
|
};
|
2013-07-03 20:14:59 +02:00
|
|
|
|
|
|
|
|
2017-04-25 21:18:02 +02:00
|
|
|
class Config : public IConfig {
|
2012-08-13 08:46:10 +02:00
|
|
|
virtual void dummy();
|
2010-12-31 23:07:47 +01:00
|
|
|
public:
|
2012-08-13 08:46:10 +02:00
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
Config() = default;
|
|
|
|
Config( ConfigData const& data );
|
|
|
|
virtual ~Config() = default;
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
std::string const& getFilename() const;
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
bool listTests() const;
|
|
|
|
bool listTestNamesOnly() const;
|
|
|
|
bool listTags() const;
|
|
|
|
bool listReporters() const;
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
Verbosity verbosity() const;
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
std::string getProcessName() const;
|
2017-06-20 21:14:38 +02:00
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
std::vector<std::string> const& getReporterNames() const;
|
|
|
|
std::vector<std::string> const& getSectionsToRun() const override;
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
virtual TestSpec const& testSpec() const override;
|
2013-06-05 09:18:52 +02:00
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
bool showHelp() const;
|
2012-08-31 09:10:36 +02:00
|
|
|
|
2013-05-28 19:39:32 +02:00
|
|
|
// IConfig interface
|
2017-07-19 10:13:47 +02:00
|
|
|
virtual bool allowThrows() const override;
|
|
|
|
virtual std::ostream& stream() const override;
|
|
|
|
virtual std::string name() const override;
|
|
|
|
virtual bool includeSuccessfulResults() const override;
|
|
|
|
virtual bool warnAboutMissingAssertions() const override;
|
|
|
|
virtual ShowDurations::OrNot showDurations() const override;
|
|
|
|
virtual RunTests::InWhatOrder runOrder() const override;
|
|
|
|
virtual unsigned int rngSeed() const override;
|
|
|
|
virtual UseColour::YesOrNo useColour() const override;
|
|
|
|
virtual bool shouldDebugBreak() const override;
|
|
|
|
virtual int abortAfter() const override;
|
|
|
|
virtual bool showInvisibles() const override;
|
2013-05-28 19:39:32 +02:00
|
|
|
|
2011-01-18 20:49:00 +01:00
|
|
|
private:
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
IStream const* openStream();
|
2012-06-08 09:22:56 +02:00
|
|
|
ConfigData m_data;
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2017-04-25 12:41:30 +02:00
|
|
|
std::unique_ptr<IStream const> m_stream;
|
2014-05-16 19:24:07 +02:00
|
|
|
TestSpec m_testSpec;
|
2012-05-31 20:40:26 +02:00
|
|
|
};
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2010-11-12 20:55:53 +01:00
|
|
|
} // end namespace Catch
|
|
|
|
|
2012-09-17 07:42:29 +02:00
|
|
|
#endif // TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
|