forked from catchorg/Catch2
This is both a really big and a really small commit. It is small in
that it only contains renaming, moving and modification of include
directives caused by this.
It is really big in the obvious way of touching something like 200
files.
The new rules for naming files is simple: headers use the `.hpp`
extension. The rules for physical file layout is still kinda in
progress, but the basics are also simple:
* Significant parts of functionality get their own subfolder
* Benchmarking is in `catch2/benchmark`
* Matchers are in `catch2/matchers`
* Generators are in `catch2/generators`
* Reporters are in `catch2/reporters`
* Baseline testing facilities are in `catch2/`
* Various top level folders also contain `internal` subfolder,
with files that users probably do not want to include directly,
at least not until they have to write something like their own
reporter.
* The exact files in these subfolders is likely to change later
on
Note that while some includes were cleaned up in this commit, it
is only the low hanging fruit and further cleanup using automatic
tooling will happen later.
Also note that various include guards, copyright notices and file
headers will also be standardized later, rather than in this commit.
91 lines
4.1 KiB
C++
91 lines
4.1 KiB
C++
/*
|
|
* Created by Martin on 19/07/2017.
|
|
*
|
|
* 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)
|
|
*/
|
|
|
|
#include <catch2/catch_config.hpp>
|
|
#include <catch2/internal/catch_enforce.hpp>
|
|
#include <catch2/internal/catch_stream.hpp>
|
|
#include <catch2/catch_stringref.hpp>
|
|
#include <catch2/internal/catch_string_manip.hpp>
|
|
#include <catch2/internal/catch_test_spec_parser.hpp>
|
|
|
|
namespace Catch {
|
|
|
|
Config::Config( ConfigData const& data )
|
|
: m_data( data ),
|
|
m_stream( openStream() )
|
|
{
|
|
// We need to trim filter specs to avoid trouble with superfluous
|
|
// whitespace (esp. important for bdd macros, as those are manually
|
|
// aligned with whitespace).
|
|
|
|
for (auto& elem : m_data.testsOrTags) {
|
|
elem = trim(elem);
|
|
}
|
|
for (auto& elem : m_data.sectionsToRun) {
|
|
elem = trim(elem);
|
|
}
|
|
|
|
TestSpecParser parser(ITagAliasRegistry::get());
|
|
if (!m_data.testsOrTags.empty()) {
|
|
m_hasTestFilters = true;
|
|
for (auto const& testOrTags : m_data.testsOrTags) {
|
|
parser.parse(testOrTags);
|
|
}
|
|
}
|
|
m_testSpec = parser.testSpec();
|
|
}
|
|
|
|
Config::~Config() = default;
|
|
|
|
|
|
std::string const& Config::getFilename() const {
|
|
return m_data.outputFilename ;
|
|
}
|
|
|
|
bool Config::listTests() const { return m_data.listTests; }
|
|
bool Config::listTags() const { return m_data.listTags; }
|
|
bool Config::listReporters() const { return m_data.listReporters; }
|
|
|
|
std::string Config::getProcessName() const { return m_data.processName; }
|
|
std::string const& Config::getReporterName() const { return m_data.reporterName; }
|
|
|
|
std::vector<std::string> const& Config::getTestsOrTags() const { return m_data.testsOrTags; }
|
|
std::vector<std::string> const& Config::getSectionsToRun() const { return m_data.sectionsToRun; }
|
|
|
|
TestSpec const& Config::testSpec() const { return m_testSpec; }
|
|
bool Config::hasTestFilters() const { return m_hasTestFilters; }
|
|
|
|
bool Config::showHelp() const { return m_data.showHelp; }
|
|
|
|
// IConfig interface
|
|
bool Config::allowThrows() const { return !m_data.noThrow; }
|
|
std::ostream& Config::stream() const { return m_stream->stream(); }
|
|
std::string Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; }
|
|
bool Config::includeSuccessfulResults() const { return m_data.showSuccessfulTests; }
|
|
bool Config::warnAboutMissingAssertions() const { return !!(m_data.warnings & WarnAbout::NoAssertions); }
|
|
bool Config::warnAboutNoTests() const { return !!(m_data.warnings & WarnAbout::NoTests); }
|
|
ShowDurations::OrNot Config::showDurations() const { return m_data.showDurations; }
|
|
RunTests::InWhatOrder Config::runOrder() const { return m_data.runOrder; }
|
|
unsigned int Config::rngSeed() const { return m_data.rngSeed; }
|
|
UseColour::YesOrNo Config::useColour() const { return m_data.useColour; }
|
|
bool Config::shouldDebugBreak() const { return m_data.shouldDebugBreak; }
|
|
int Config::abortAfter() const { return m_data.abortAfter; }
|
|
bool Config::showInvisibles() const { return m_data.showInvisibles; }
|
|
Verbosity Config::verbosity() const { return m_data.verbosity; }
|
|
|
|
bool Config::benchmarkNoAnalysis() const { return m_data.benchmarkNoAnalysis; }
|
|
int Config::benchmarkSamples() const { return m_data.benchmarkSamples; }
|
|
double Config::benchmarkConfidenceInterval() const { return m_data.benchmarkConfidenceInterval; }
|
|
unsigned int Config::benchmarkResamples() const { return m_data.benchmarkResamples; }
|
|
std::chrono::milliseconds Config::benchmarkWarmupTime() const { return std::chrono::milliseconds(m_data.benchmarkWarmupTime); }
|
|
|
|
IStream const* Config::openStream() {
|
|
return Catch::makeStream(m_data.outputFilename);
|
|
}
|
|
|
|
} // end namespace Catch
|