File indexing completed on 2025-01-18 09:54:08
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef CATCH_ASSERTION_RESULT_HPP_INCLUDED
0009 #define CATCH_ASSERTION_RESULT_HPP_INCLUDED
0010
0011 #include <catch2/catch_assertion_info.hpp>
0012 #include <catch2/internal/catch_result_type.hpp>
0013 #include <catch2/internal/catch_source_line_info.hpp>
0014 #include <catch2/internal/catch_stringref.hpp>
0015 #include <catch2/internal/catch_lazy_expr.hpp>
0016
0017 #include <string>
0018
0019 namespace Catch {
0020
0021 struct AssertionResultData
0022 {
0023 AssertionResultData() = delete;
0024
0025 AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression );
0026
0027 std::string message;
0028 mutable std::string reconstructedExpression;
0029 LazyExpression lazyExpression;
0030 ResultWas::OfType resultType;
0031
0032 std::string reconstructExpression() const;
0033 };
0034
0035 class AssertionResult {
0036 public:
0037 AssertionResult() = delete;
0038 AssertionResult( AssertionInfo const& info, AssertionResultData&& data );
0039
0040 bool isOk() const;
0041 bool succeeded() const;
0042 ResultWas::OfType getResultType() const;
0043 bool hasExpression() const;
0044 bool hasMessage() const;
0045 std::string getExpression() const;
0046 std::string getExpressionInMacro() const;
0047 bool hasExpandedExpression() const;
0048 std::string getExpandedExpression() const;
0049 StringRef getMessage() const;
0050 SourceLineInfo getSourceInfo() const;
0051 StringRef getTestMacroName() const;
0052
0053
0054 AssertionInfo m_info;
0055 AssertionResultData m_resultData;
0056 };
0057
0058 }
0059
0060 #endif