ZeroErr
decomposition.h File Reference
#include "zeroerr/internal/config.h"
#include "zeroerr/dbg.h"
#include "zeroerr/print.h"
Include dependency graph for decomposition.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  zeroerr::deferred_false< T >
 
struct  zeroerr::ExprResult
 
struct  zeroerr::Expression< L >
 
struct  zeroerr::ExpressionDecomposer
 
class  zeroerr::IMatcher< T >
 
class  zeroerr::IMatcherRef< T >
 
class  zeroerr::CombinedMatcher< T >
 
class  zeroerr::NotMatcher< T >
 
struct  zeroerr::StartWithMatcher< T >
 

Namespaces

 zeroerr
 
 zeroerr::details
 

Macros

#define AND   &&zeroerr::ExpressionDecomposer() <<
 
#define OR   || zeroerr::ExpressionDecomposer() <<
 
#define ZEROERR_SFINAE_OP(ret, op)    typename std::decay<decltype(std::declval<L>() op std::declval<R>(), std::declval<ret>())>::type
 
#define ZEROERR_EXPRESSION_COMPARISON(op, op_name)
 
#define ZEROERR_EXPRESSION_ANDOR(op, op_name)
 
#define ZEROERR_FORBIT_EXPRESSION(rt, op)
 

Functions

template<typename T >
std::enable_if< std::is_convertible< T, bool >::value, bool >::type zeroerr::details::getBool (T &&lhs)
 
template<typename T >
std::enable_if<!std::is_convertible< T, bool >::value, bool >::type zeroerr::details::getBool (T &&)
 
template<typename T >
std::enable_if< std::is_constructible< std::string, T >::value, IMatcherRef< std::string > >::type zeroerr::start_with (T &&s)
 

Macro Definition Documentation

◆ AND

#define AND   &&zeroerr::ExpressionDecomposer() <<

AND and OR are used to combine expressions in a more readable way. For example: CHECK(1 == 1 AND 2 == 2);

In its implementation, the expression is decomposed to ExpressionDecomposer() << 1 == 1 && ExpressionDecomposer() << 2 == 2

◆ OR

#define OR   || zeroerr::ExpressionDecomposer() <<

◆ ZEROERR_EXPRESSION_ANDOR

#define ZEROERR_EXPRESSION_ANDOR (   op,
  op_name 
)
Value:
ExprResult operator op(ExprResult rhs) { \
std::stringstream ss; \
ss << decomp << " " #op " " << rhs.decomp; \
return ExprResult(res op rhs.res, ss.str()); \
}

◆ ZEROERR_EXPRESSION_COMPARISON

#define ZEROERR_EXPRESSION_COMPARISON (   op,
  op_name 
)

◆ ZEROERR_FORBIT_EXPRESSION

#define ZEROERR_FORBIT_EXPRESSION (   rt,
  op 
)
Value:
template <typename R> \
rt& operator op(const R&) { \
static_assert(deferred_false<R>::value, \
"Please Rewrite Expression As Binary Comparison!"); \
return *this; \
}

◆ ZEROERR_SFINAE_OP

#define ZEROERR_SFINAE_OP (   ret,
  op 
)     typename std::decay<decltype(std::declval<L>() op std::declval<R>(), std::declval<ret>())>::type