mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 20:27:11 +01:00 
			
		
		
		
	ExpressionBuilder ->ExpressionDecomposer
Expression -> ExpressionLhs
This commit is contained in:
		| @@ -8,7 +8,7 @@ | ||||
| #ifndef TWOBLUECUBES_CATCH_CAPTURE_HPP_INCLUDED | ||||
| #define TWOBLUECUBES_CATCH_CAPTURE_HPP_INCLUDED | ||||
|  | ||||
| #include "catch_expression_builder.hpp" | ||||
| #include "catch_expression_decomposer.hpp" | ||||
| #include "catch_assertionresult_builder.h" | ||||
| #include "catch_interfaces_capture.h" | ||||
| #include "catch_debugger.hpp" | ||||
| @@ -97,7 +97,7 @@ inline bool isTrue( bool value ){ return value; } | ||||
| #define INTERNAL_CATCH_TEST( expr, shouldNegate, stopOnFailure, macroName ) \ | ||||
|     do { try { \ | ||||
|         INTERNAL_CATCH_ACCEPT_INFO( #expr, macroName, shouldNegate ); \ | ||||
|         INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionBuilder()->*expr ).negate( shouldNegate ), stopOnFailure, expr ); \ | ||||
|         INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionDecomposer()->*expr ).negate( shouldNegate ), stopOnFailure, expr ); \ | ||||
|     } catch( Catch::TestFailureException& ) { \ | ||||
|         throw; \ | ||||
|     } catch( ... ) { \ | ||||
|   | ||||
| @@ -1,31 +0,0 @@ | ||||
| /* | ||||
|  *  Created by Phil on 11/5/2012. | ||||
|  *  Copyright 2012 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_EXPRESSION_BUILDER_HPP_INCLUDED | ||||
| #define TWOBLUECUBES_CATCH_EXPRESSION_BUILDER_HPP_INCLUDED | ||||
|  | ||||
| #include "catch_expression.hpp" | ||||
| #include "catch_assertionresult_builder.h" | ||||
|  | ||||
| namespace Catch { | ||||
|      | ||||
| class ExpressionBuilder { | ||||
| public: | ||||
|  | ||||
|     template<typename T> | ||||
|     Expression<const T&> operator->* ( const T & operand ) { | ||||
|         return Expression<const T&>( operand ); | ||||
|     } | ||||
|  | ||||
|     Expression<bool> operator->* ( bool value ) { | ||||
|         return Expression<bool>( value ); | ||||
|     } | ||||
| }; | ||||
|  | ||||
| } // end namespace Catch | ||||
|  | ||||
| #endif // TWOBLUECUBES_CATCH_EXPRESSION_BUILDER_HPP_INCLUDED | ||||
							
								
								
									
										31
									
								
								include/internal/catch_expression_decomposer.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								include/internal/catch_expression_decomposer.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| /* | ||||
|  *  Created by Phil on 11/5/2012. | ||||
|  *  Copyright 2012 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_EXPRESSION_DECOMPOSER_HPP_INCLUDED | ||||
| #define TWOBLUECUBES_CATCH_EXPRESSION_DECOMPOSER_HPP_INCLUDED | ||||
|  | ||||
| #include "catch_expression_lhs.hpp" | ||||
| #include "catch_assertionresult_builder.h" | ||||
|  | ||||
| namespace Catch { | ||||
|      | ||||
| class ExpressionDecomposer { | ||||
| public: | ||||
|  | ||||
|     template<typename T> | ||||
|     ExpressionLhs<const T&> operator->* ( const T & operand ) { | ||||
|         return ExpressionLhs<const T&>( operand ); | ||||
|     } | ||||
|  | ||||
|     ExpressionLhs<bool> operator->* ( bool value ) { | ||||
|         return ExpressionLhs<bool>( value ); | ||||
|     } | ||||
| }; | ||||
|  | ||||
| } // end namespace Catch | ||||
|  | ||||
| #endif // TWOBLUECUBES_CATCH_EXPRESSION_DECOMPOSER_HPP_INCLUDED | ||||
| @@ -19,11 +19,11 @@ namespace Catch { | ||||
|         result.setResultType( value ); | ||||
|     } | ||||
| template<typename T> | ||||
| class Expression { | ||||
| 	void operator = ( const Expression& ); | ||||
| class ExpressionLhs { | ||||
| 	void operator = ( const ExpressionLhs& ); | ||||
| 
 | ||||
| public: | ||||
|     Expression( T lhs ) : m_lhs( lhs ) { | ||||
|     ExpressionLhs( T lhs ) : m_lhs( lhs ) { | ||||
|         setResultIfBoolean( m_result.setLhs( Catch::toString( lhs ) ), lhs ); | ||||
|     } | ||||
| 
 | ||||
		Reference in New Issue
	
	Block a user
	 Phil Nash
					Phil Nash