2012-05-08 19:29:51 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								/*
 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-08 08:58:28 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 *   Created  by  Phil  on  8 / 8 / 2012. 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 19:29:51 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								 *   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)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-16 08:27:21 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# ifndef TWOBLUECUBES_CATCH_ASSERTIONRESULT_BUILDER_HPP_INCLUDED 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define TWOBLUECUBES_CATCH_ASSERTIONRESULT_BUILDER_HPP_INCLUDED 
 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 19:29:51 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-10-16 08:31:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "catch_assertionresult_builder.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 19:29:51 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-10-19 08:01:34 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  <assert.h> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-15 07:42:26 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								namespace  Catch  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 19:29:51 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-10-19 08:01:34 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    AssertionResultBuilder : : AssertionResultBuilder (  ResultWas : : OfType  resultType  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        m_data . resultType  =  resultType ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-18 08:39:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    AssertionResultBuilder : : AssertionResultBuilder (  const  AssertionResultBuilder &  other  ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    :    m_data (  other . m_data  ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        m_exprComponents (  other . m_exprComponents  ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        m_stream  < <  other . m_stream . str ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    AssertionResultBuilder &  AssertionResultBuilder : : operator = ( const  AssertionResultBuilder &  other  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        m_data  =  other . m_data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        m_exprComponents  =  other . m_exprComponents ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        m_stream . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        m_stream  < <  other . m_stream . str ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  * this ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-16 08:27:21 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    AssertionResultBuilder &  AssertionResultBuilder : : setResultType (  ResultWas : : OfType  result  )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-19 08:01:34 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        m_data . resultType  =  result ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-05 18:35:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  * this ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-16 08:27:21 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    AssertionResultBuilder &  AssertionResultBuilder : : setCapturedExpression (  const  std : : string &  capturedExpression  )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-05 18:35:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        m_data . capturedExpression  =  capturedExpression ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  * this ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-16 08:27:21 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    AssertionResultBuilder &  AssertionResultBuilder : : setIsFalse (  bool  isFalse  )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-18 08:39:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        m_exprComponents . isFalse  =  isFalse ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-04 08:09:09 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  * this ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 19:29:51 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-16 08:27:21 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    AssertionResultBuilder &  AssertionResultBuilder : : setLineInfo (  const  SourceLineInfo &  lineInfo  )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-05 18:35:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        m_data . lineInfo  =  lineInfo ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        return  * this ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-16 08:27:21 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    AssertionResultBuilder &  AssertionResultBuilder : : setMacroName (  const  std : : string &  macroName  )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-05 18:35:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        m_data . macroName  =  macroName ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-04 08:09:09 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  * this ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 19:29:51 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-16 08:27:21 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    AssertionResultBuilder &  AssertionResultBuilder : : setLhs (  const  std : : string &  lhs  )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-18 08:39:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        m_exprComponents . lhs  =  lhs ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-04 08:09:09 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  * this ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 19:29:51 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-16 08:27:21 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    AssertionResultBuilder &  AssertionResultBuilder : : setRhs (  const  std : : string &  rhs  )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-18 08:39:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        m_exprComponents . rhs  =  rhs ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-04 08:09:09 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  * this ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 19:29:51 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-16 08:27:21 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    AssertionResultBuilder &  AssertionResultBuilder : : setOp (  const  std : : string &  op  )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-18 08:39:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        m_exprComponents . op  =  op ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-04 08:09:09 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  * this ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-16 08:27:21 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    AssertionResult  AssertionResultBuilder : : build ( )  const 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-05 18:35:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-19 08:01:34 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        assert (  m_data . resultType  ! =  ResultWas : : Unknown  ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-10-16 08:33:13 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        AssertionResultData  data  =  m_data ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-19 08:01:34 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        // Flip bool results if isFalse is set
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if (  m_exprComponents . isFalse  & &  data . resultType  = =  ResultWas : : Ok  ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            data . resultType  =  ResultWas : : ExpressionFailed ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        else  if (  m_exprComponents . isFalse  & &  data . resultType  = =  ResultWas : : ExpressionFailed  ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            data . resultType  =  ResultWas : : Ok ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-10-18 08:39:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        data . message  =  m_stream . str ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-05 18:35:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        data . reconstructedExpression  =  reconstructExpression ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-18 08:39:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if (  m_exprComponents . isFalse  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if (  m_exprComponents . op  = =  " "  )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-09 11:48:55 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                data . capturedExpression  =  " ! "  +  data . capturedExpression ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                data . reconstructedExpression  =  " ! "  +  data . reconstructedExpression ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                data . capturedExpression  =  " !( "  +  data . capturedExpression  +  " ) " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                data . reconstructedExpression  =  " !( "  +  data . reconstructedExpression  +  " ) " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-16 08:27:21 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        return  AssertionResult (  data  ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 19:29:51 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-16 08:27:21 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    std : : string  AssertionResultBuilder : : reconstructExpression ( )  const  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-18 08:39:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if (  m_exprComponents . op  = =  " "  ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            return  m_exprComponents . lhs . empty ( )  ?  m_data . capturedExpression  :  m_exprComponents . op  +  m_exprComponents . lhs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        else  if (  m_exprComponents . op  = =  " matches "  ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            return  m_exprComponents . lhs  +  "   "  +  m_exprComponents . rhs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        else  if (  m_exprComponents . op  ! =  " ! "  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if (  m_exprComponents . lhs . size ( )  +  m_exprComponents . rhs . size ( )  <  30  ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                return  m_exprComponents . lhs  +  "   "  +  m_exprComponents . op  +  "   "  +  m_exprComponents . rhs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            else  if (  m_exprComponents . lhs . size ( )  <  70  & &  m_exprComponents . rhs . size ( )  <  70  ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                return  " \n \t "  +  m_exprComponents . lhs  +  " \n \t "  +  m_exprComponents . op  +  " \n \t "  +  m_exprComponents . rhs ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-05 18:35:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            else 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-18 08:39:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                return  " \n "  +  m_exprComponents . lhs  +  " \n "  +  m_exprComponents . op  +  " \n "  +  m_exprComponents . rhs  +  " \n \n " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-05 18:35:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        else 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-09 11:48:55 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            return  " {can't expand - use  "  +  m_data . macroName  +  " _FALSE(  "  +  m_data . capturedExpression . substr ( 1 )  +  "  ) instead of  "  +  m_data . macroName  +  " (  "  +  m_data . capturedExpression  +  "  ) for better diagnostics} " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-05 18:35:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-08 19:29:51 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								}  // end namespace Catch
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-10-16 08:27:21 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# endif  // TWOBLUECUBES_CATCH_ASSERTIONRESULT_BUILDER_HPP_INCLUDED