2020-08-30 15:43:45 +02:00
|
|
|
|
|
|
|
|
// Copyright Catch2 Authors
|
|
|
|
|
// Distributed under the Boost Software License, Version 1.0.
|
|
|
|
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
|
|
|
|
// https://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
|
|
|
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
2020-08-29 20:48:32 +02:00
|
|
|
#ifndef CATCH_ASSERTION_RESULT_HPP_INCLUDED
|
|
|
|
|
#define CATCH_ASSERTION_RESULT_HPP_INCLUDED
|
2012-08-08 08:50:38 +01:00
|
|
|
|
|
|
|
|
#include <string>
|
2020-03-30 10:34:21 +02:00
|
|
|
#include <catch2/catch_assertion_info.hpp>
|
|
|
|
|
#include <catch2/internal/catch_result_type.hpp>
|
|
|
|
|
#include <catch2/internal/catch_common.hpp>
|
2020-05-10 10:09:01 +02:00
|
|
|
#include <catch2/internal/catch_stringref.hpp>
|
2020-05-10 19:19:42 +02:00
|
|
|
#include <catch2/internal/catch_lazy_expr.hpp>
|
2012-08-08 08:50:38 +01:00
|
|
|
|
2017-08-08 17:53:01 +01:00
|
|
|
namespace Catch {
|
2012-10-17 08:14:22 +01:00
|
|
|
|
2012-10-16 08:33:13 +01:00
|
|
|
struct AssertionResultData
|
2012-10-05 18:35:01 +01:00
|
|
|
{
|
2017-08-08 17:53:01 +01:00
|
|
|
AssertionResultData() = delete;
|
|
|
|
|
|
2017-08-29 14:02:14 +02:00
|
|
|
AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression );
|
2017-01-09 13:23:10 +01:00
|
|
|
|
2017-08-08 17:53:01 +01:00
|
|
|
std::string message;
|
2017-09-07 16:51:33 +02:00
|
|
|
mutable std::string reconstructedExpression;
|
2017-08-08 17:53:01 +01:00
|
|
|
LazyExpression lazyExpression;
|
2017-09-07 16:51:33 +02:00
|
|
|
ResultWas::OfType resultType;
|
2017-08-08 17:53:01 +01:00
|
|
|
|
|
|
|
|
std::string reconstructExpression() const;
|
2012-10-05 18:35:01 +01:00
|
|
|
};
|
|
|
|
|
|
2012-10-16 08:27:21 +01:00
|
|
|
class AssertionResult {
|
2012-08-08 08:50:38 +01:00
|
|
|
public:
|
2017-08-08 01:08:07 +01:00
|
|
|
AssertionResult() = delete;
|
2013-04-23 18:58:56 +01:00
|
|
|
AssertionResult( AssertionInfo const& info, AssertionResultData const& data );
|
2013-07-03 19:14:59 +01:00
|
|
|
|
2012-11-13 09:44:52 +00:00
|
|
|
bool isOk() const;
|
|
|
|
|
bool succeeded() const;
|
2012-08-08 08:50:38 +01:00
|
|
|
ResultWas::OfType getResultType() const;
|
|
|
|
|
bool hasExpression() const;
|
|
|
|
|
bool hasMessage() const;
|
|
|
|
|
std::string getExpression() const;
|
2013-05-17 19:35:33 +01:00
|
|
|
std::string getExpressionInMacro() const;
|
2012-08-08 08:50:38 +01:00
|
|
|
bool hasExpandedExpression() const;
|
|
|
|
|
std::string getExpandedExpression() const;
|
|
|
|
|
std::string getMessage() const;
|
2012-10-24 21:59:47 +01:00
|
|
|
SourceLineInfo getSourceInfo() const;
|
2017-11-13 12:49:13 +01:00
|
|
|
StringRef getTestMacroName() const;
|
2012-08-08 08:50:38 +01:00
|
|
|
|
2017-08-08 17:53:01 +01:00
|
|
|
//protected:
|
2012-10-24 21:59:47 +01:00
|
|
|
AssertionInfo m_info;
|
|
|
|
|
AssertionResultData m_resultData;
|
2012-08-08 08:50:38 +01:00
|
|
|
};
|
2013-07-03 19:14:59 +01:00
|
|
|
|
2012-08-08 08:50:38 +01:00
|
|
|
} // end namespace Catch
|
|
|
|
|
|
2020-08-29 20:48:32 +02:00
|
|
|
#endif // CATCH_ASSERTION_RESULT_HPP_INCLUDED
|