catch2/include/internal/catch_resultinfo_builder.h

59 lines
1.9 KiB
C
Raw Normal View History

2012-08-08 09:58:28 +02:00
/*
* Created by Phil on 8/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_RESULTINFO_BUILDER_H_INCLUDED
#define TWOBLUECUBES_CATCH_RESULTINFO_BUILDER_H_INCLUDED
#include "catch_tostring.hpp"
#include "catch_resultinfo.h"
#include "catch_result_type.h"
#include "catch_evaluate.hpp"
#include "catch_common.h"
namespace Catch {
struct STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison;
class ResultInfoBuilder {
2012-08-08 09:58:28 +02:00
public:
ResultInfoBuilder();
2012-08-08 09:58:28 +02:00
2012-10-04 09:09:09 +02:00
ResultInfoBuilder& setResultType( ResultWas::OfType result );
ResultInfoBuilder& setCapturedExpression( const std::string& capturedExpression );
ResultInfoBuilder& setIsFalse( bool isFalse );
2012-10-04 09:09:09 +02:00
ResultInfoBuilder& setMessage( const std::string& message );
ResultInfoBuilder& setLineInfo( const SourceLineInfo& lineInfo );
ResultInfoBuilder& setLhs( const std::string& lhs );
ResultInfoBuilder& setRhs( const std::string& rhs );
ResultInfoBuilder& setOp( const std::string& op );
ResultInfoBuilder& setMacroName( const std::string& macroName );
std::string reconstructExpression() const;
ResultInfo build() const;
// Disable attempts to use || and && in expressions (without parantheses)
2012-08-08 09:58:28 +02:00
template<typename RhsT>
2012-10-03 19:12:57 +02:00
STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator || ( const RhsT& );
2012-08-08 09:58:28 +02:00
template<typename RhsT>
2012-10-03 19:12:57 +02:00
STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator && ( const RhsT& );
2012-10-04 09:09:09 +02:00
bool getIsFalse() const {
2012-10-09 12:59:11 +02:00
return m_isFalse;
}
2012-10-04 09:09:09 +02:00
private:
ResultData m_data;
std::string m_lhs, m_rhs, m_op;
2012-10-09 12:59:11 +02:00
bool m_isFalse;
};
2012-08-08 09:58:28 +02:00
} // end namespace Catch
#endif // TWOBLUECUBES_CATCH_RESULTINFO_BUILDER_H_INCLUDED