/ externals / catch / src / catch2 / internal / catch_lazy_expr.cpp
catch_lazy_expr.cpp
 1  
 2  //              Copyright Catch2 Authors
 3  // Distributed under the Boost Software License, Version 1.0.
 4  //   (See accompanying file LICENSE.txt or copy at
 5  //        https://www.boost.org/LICENSE_1_0.txt)
 6  
 7  // SPDX-License-Identifier: BSL-1.0
 8  
 9  #include <catch2/internal/catch_lazy_expr.hpp>
10  #include <catch2/internal/catch_decomposer.hpp>
11  
12  namespace Catch {
13  
14      auto operator << (std::ostream& os, LazyExpression const& lazyExpr) -> std::ostream& {
15          if (lazyExpr.m_isNegated)
16              os << '!';
17  
18          if (lazyExpr) {
19              if (lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression())
20                  os << '(' << *lazyExpr.m_transientExpression << ')';
21              else
22                  os << *lazyExpr.m_transientExpression;
23          } else {
24              os << "{** error - unchecked empty expression requested **}";
25          }
26          return os;
27      }
28  
29  } // namespace Catch