mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-25 14:56:10 +01:00
9aa96712ae
Swept: `-Wpadded` in some places (where it caused extra size, instead of just saying "hey, we padded struct at the end to align, just as standard says") `-Wweak-vtables` everywhere (Clang) `-Wexit-time-destructors` everywhere (Clang) `-Wmissing-noreturn` everywhere (Clang) The last three are enabled for Clang compilation going forward. Also enabled `-Wunreachable-code` for Clang and GCC
81 lines
2.2 KiB
C++
81 lines
2.2 KiB
C++
/*
|
|
* Created by Phil on 14/8/2012.
|
|
* 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_TEST_SPEC_HPP_INCLUDED
|
|
#define TWOBLUECUBES_CATCH_TEST_SPEC_HPP_INCLUDED
|
|
|
|
#ifdef __clang__
|
|
#pragma clang diagnostic push
|
|
#pragma clang diagnostic ignored "-Wpadded"
|
|
#endif
|
|
|
|
#include "catch_wildcard_pattern.h"
|
|
#include "catch_test_case_info.h"
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <memory>
|
|
|
|
namespace Catch {
|
|
|
|
class TestSpec {
|
|
struct Pattern {
|
|
virtual ~Pattern();
|
|
virtual bool matches( TestCaseInfo const& testCase ) const = 0;
|
|
};
|
|
using PatternPtr = std::shared_ptr<Pattern>;
|
|
|
|
class NamePattern : public Pattern {
|
|
public:
|
|
NamePattern( std::string const& name );
|
|
virtual ~NamePattern();
|
|
virtual bool matches( TestCaseInfo const& testCase ) const override;
|
|
private:
|
|
WildcardPattern m_wildcardPattern;
|
|
};
|
|
|
|
class TagPattern : public Pattern {
|
|
public:
|
|
TagPattern( std::string const& tag );
|
|
virtual ~TagPattern();
|
|
virtual bool matches( TestCaseInfo const& testCase ) const override;
|
|
private:
|
|
std::string m_tag;
|
|
};
|
|
|
|
class ExcludedPattern : public Pattern {
|
|
public:
|
|
ExcludedPattern( PatternPtr const& underlyingPattern );
|
|
virtual ~ExcludedPattern();
|
|
virtual bool matches( TestCaseInfo const& testCase ) const override;
|
|
private:
|
|
PatternPtr m_underlyingPattern;
|
|
};
|
|
|
|
struct Filter {
|
|
std::vector<PatternPtr> m_patterns;
|
|
|
|
bool matches( TestCaseInfo const& testCase ) const;
|
|
};
|
|
|
|
public:
|
|
bool hasFilters() const;
|
|
bool matches( TestCaseInfo const& testCase ) const;
|
|
|
|
private:
|
|
std::vector<Filter> m_filters;
|
|
|
|
friend class TestSpecParser;
|
|
};
|
|
}
|
|
|
|
#ifdef __clang__
|
|
#pragma clang diagnostic pop
|
|
#endif
|
|
|
|
#endif // TWOBLUECUBES_CATCH_TEST_SPEC_HPP_INCLUDED
|