catch_assertionresult.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #include <string>
  11. #include "catch_assertioninfo.h"
  12. #include "catch_result_type.h"
  13. #include "catch_common.h"
  14. #include "catch_stringref.h"
  15. #include "catch_assertionhandler.h"
  16. namespace Catch {
  17. struct AssertionResultData
  18. {
  19. AssertionResultData() = delete;
  20. AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression );
  21. std::string message;
  22. mutable std::string reconstructedExpression;
  23. LazyExpression lazyExpression;
  24. ResultWas::OfType resultType;
  25. std::string reconstructExpression() const;
  26. };
  27. class AssertionResult {
  28. public:
  29. AssertionResult() = delete;
  30. AssertionResult( AssertionInfo const& info, AssertionResultData const& data );
  31. bool isOk() const;
  32. bool succeeded() const;
  33. ResultWas::OfType getResultType() const;
  34. bool hasExpression() const;
  35. bool hasMessage() const;
  36. std::string getExpression() const;
  37. std::string getExpressionInMacro() const;
  38. bool hasExpandedExpression() const;
  39. std::string getExpandedExpression() const;
  40. std::string getMessage() const;
  41. SourceLineInfo getSourceInfo() const;
  42. StringRef getTestMacroName() const;
  43. //protected:
  44. AssertionInfo m_info;
  45. AssertionResultData m_resultData;
  46. };
  47. } // end namespace Catch
  48. #endif // TWOBLUECUBES_CATCH_ASSERTIONRESULT_H_INCLUDED