1 /*
2  *  Created by Phil on 28/10/2010.
3  *  Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
4  *
5  *  Distributed under the Boost Software License, Version 1.0. (See accompanying
6  *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7  */
8 #ifndef TWOBLUECUBES_CATCH_ASSERTIONRESULT_H_INCLUDED
9 #define TWOBLUECUBES_CATCH_ASSERTIONRESULT_H_INCLUDED
10 
11 #include <string>
12 #include "catch_assertioninfo.h"
13 #include "catch_result_type.h"
14 #include "catch_common.h"
15 #include "catch_stringref.h"
16 #include "catch_assertionhandler.h"
17 
18 namespace Catch {
19 
20     struct AssertionResultData
21     {
22         AssertionResultData() = delete;
23 
24         AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression );
25 
26         std::string message;
27         mutable std::string reconstructedExpression;
28         LazyExpression lazyExpression;
29         ResultWas::OfType resultType;
30 
31         std::string reconstructExpression() const;
32     };
33 
34     class AssertionResult {
35     public:
36         AssertionResult() = delete;
37         AssertionResult( AssertionInfo const& info, AssertionResultData const& data );
38 
39         bool isOk() const;
40         bool succeeded() const;
41         ResultWas::OfType getResultType() const;
42         bool hasExpression() const;
43         bool hasMessage() const;
44         std::string getExpression() const;
45         std::string getExpressionInMacro() const;
46         bool hasExpandedExpression() const;
47         std::string getExpandedExpression() const;
48         std::string getMessage() const;
49         SourceLineInfo getSourceInfo() const;
50         StringRef getTestMacroName() const;
51 
52     //protected:
53         AssertionInfo m_info;
54         AssertionResultData m_resultData;
55     };
56 
57 } // end namespace Catch
58 
59 #endif // TWOBLUECUBES_CATCH_ASSERTIONRESULT_H_INCLUDED
60