| 
									
										
										
										
											2013-12-03 18:52:41 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2014-05-16 18:28:58 +01:00
										 |  |  |  *  Created by Phil on 14/8/2012. | 
					
						
							|  |  |  |  *  Copyright 2010 Two Blue Cubes Ltd. All rights reserved. | 
					
						
							| 
									
										
										
										
											2013-12-03 18:52:41 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  *  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
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-16 18:28:58 +01:00
										 |  |  | #ifdef __clang__
 | 
					
						
							|  |  |  | #pragma clang diagnostic push
 | 
					
						
							|  |  |  | #pragma clang diagnostic ignored "-Wpadded"
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2013-12-03 18:52:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-07 11:24:33 +01:00
										 |  |  | #include "catch_wildcard_pattern.h"
 | 
					
						
							| 
									
										
										
										
											2014-05-16 18:28:58 +01:00
										 |  |  | #include "catch_test_case_info.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <string>
 | 
					
						
							|  |  |  | #include <vector>
 | 
					
						
							| 
									
										
										
										
											2017-04-26 17:04:00 +01:00
										 |  |  | #include <memory>
 | 
					
						
							| 
									
										
										
										
											2014-05-16 18:28:58 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace Catch { | 
					
						
							| 
									
										
										
										
											2015-11-04 18:01:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-16 18:28:58 +01:00
										 |  |  |     class TestSpec { | 
					
						
							| 
									
										
										
										
											2017-04-25 21:01:40 +01:00
										 |  |  |         struct Pattern { | 
					
						
							| 
									
										
										
										
											2017-09-07 16:51:33 +02:00
										 |  |  |             virtual ~Pattern(); | 
					
						
							| 
									
										
										
										
											2014-05-16 18:28:58 +01:00
										 |  |  |             virtual bool matches( TestCaseInfo const& testCase ) const = 0; | 
					
						
							|  |  |  |         }; | 
					
						
							| 
									
										
										
										
											2017-04-25 21:01:40 +01:00
										 |  |  |         using PatternPtr = std::shared_ptr<Pattern>; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-16 18:28:58 +01:00
										 |  |  |         class NamePattern : public Pattern { | 
					
						
							|  |  |  |         public: | 
					
						
							| 
									
										
										
										
											2017-07-19 10:13:47 +02:00
										 |  |  |             NamePattern( std::string const& name ); | 
					
						
							| 
									
										
										
										
											2017-09-07 16:51:33 +02:00
										 |  |  |             virtual ~NamePattern(); | 
					
						
							| 
									
										
										
										
											2017-07-25 17:16:28 +02:00
										 |  |  |             virtual bool matches( TestCaseInfo const& testCase ) const override; | 
					
						
							| 
									
										
										
										
											2014-05-16 18:28:58 +01:00
										 |  |  |         private: | 
					
						
							| 
									
										
										
										
											2015-07-13 15:03:04 +01:00
										 |  |  |             WildcardPattern m_wildcardPattern; | 
					
						
							| 
									
										
										
										
											2014-05-16 18:28:58 +01:00
										 |  |  |         }; | 
					
						
							| 
									
										
										
										
											2015-11-04 18:01:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-16 18:28:58 +01:00
										 |  |  |         class TagPattern : public Pattern { | 
					
						
							|  |  |  |         public: | 
					
						
							| 
									
										
										
										
											2017-07-19 10:13:47 +02:00
										 |  |  |             TagPattern( std::string const& tag ); | 
					
						
							| 
									
										
										
										
											2017-09-07 16:51:33 +02:00
										 |  |  |             virtual ~TagPattern(); | 
					
						
							| 
									
										
										
										
											2017-07-25 17:16:28 +02:00
										 |  |  |             virtual bool matches( TestCaseInfo const& testCase ) const override; | 
					
						
							| 
									
										
										
										
											2014-05-16 18:28:58 +01:00
										 |  |  |         private: | 
					
						
							|  |  |  |             std::string m_tag; | 
					
						
							|  |  |  |         }; | 
					
						
							| 
									
										
										
										
											2015-11-04 18:01:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-16 18:28:58 +01:00
										 |  |  |         class ExcludedPattern : public Pattern { | 
					
						
							|  |  |  |         public: | 
					
						
							| 
									
										
										
										
											2017-07-19 10:13:47 +02:00
										 |  |  |             ExcludedPattern( PatternPtr const& underlyingPattern ); | 
					
						
							| 
									
										
										
										
											2017-09-07 16:51:33 +02:00
										 |  |  |             virtual ~ExcludedPattern(); | 
					
						
							| 
									
										
										
										
											2017-07-25 17:16:28 +02:00
										 |  |  |             virtual bool matches( TestCaseInfo const& testCase ) const override; | 
					
						
							| 
									
										
										
										
											2014-05-16 18:28:58 +01:00
										 |  |  |         private: | 
					
						
							| 
									
										
										
										
											2017-04-25 21:01:40 +01:00
										 |  |  |             PatternPtr m_underlyingPattern; | 
					
						
							| 
									
										
										
										
											2014-05-16 18:28:58 +01:00
										 |  |  |         }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         struct Filter { | 
					
						
							| 
									
										
										
										
											2017-04-25 21:01:40 +01:00
										 |  |  |             std::vector<PatternPtr> m_patterns; | 
					
						
							| 
									
										
										
										
											2014-05-16 18:28:58 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-19 10:13:47 +02:00
										 |  |  |             bool matches( TestCaseInfo const& testCase ) const; | 
					
						
							| 
									
										
										
										
											2014-05-16 18:28:58 +01:00
										 |  |  |         }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public: | 
					
						
							| 
									
										
										
										
											2017-07-19 10:13:47 +02:00
										 |  |  |         bool hasFilters() const; | 
					
						
							|  |  |  |         bool matches( TestCaseInfo const& testCase ) const; | 
					
						
							| 
									
										
										
										
											2014-05-16 18:28:58 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     private: | 
					
						
							|  |  |  |         std::vector<Filter> m_filters; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         friend class TestSpecParser; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef __clang__
 | 
					
						
							|  |  |  | #pragma clang diagnostic pop
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2013-12-03 18:52:41 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #endif // TWOBLUECUBES_CATCH_TEST_SPEC_HPP_INCLUDED
 |