Skip to content

File assert.hpp

FileList > assert > assert.hpp

Go to the source code of this file

  • #include <iostream>
  • #include <optional>
  • #include <experimental/source_location>
  • #include <sstream>
  • #include <string>
  • #include "printing/to_string.hpp"

Namespaces

Type Name
namespace std

Public Functions

Type Name
void _Assert (bool condition, const std::string & condition_str, const std::optional< std::string > & message, const std::source_location & loc=std::source_location::current())
void _AssertBinOp (const A & a, const B & b, const std::string & a_str, const std::string & b_str, bool result, const std::string & op, const std::string & nop, const std::source_location & loc=std::source_location::current())
void unreachable ()

Macros

Type Name
define Assert (condition, ...) [**if**](classCoordinate2D.md) (!([**condition**](classCoordinate2D.md))) \_Assert([**condition**](classCoordinate2D.md), #[**condition**](classCoordinate2D.md), std::optional&lt;std::string&gt;([**\_\_VA\_ARGS\_\_**](classCoordinate2D.md)));
define AssertBinOp (a, b, op, nop) [**if**](classCoordinate2D.md) (!(([**a**](classCoordinate2D.md))[**op**](classCoordinate2D.md)([**b**](classCoordinate2D.md)))) \_AssertBinOp([**a**](classCoordinate2D.md), [**b**](classCoordinate2D.md), #[**a**](classCoordinate2D.md), #[**b**](classCoordinate2D.md), [**a**](classCoordinate2D.md) [**op**](classCoordinate2D.md) [**b**](classCoordinate2D.md), #[**op**](classCoordinate2D.md), #[**nop**](classCoordinate2D.md))
define AssertEQ (expr, val) AssertBinOp([**expr**](classCoordinate2D.md), [**val**](classCoordinate2D.md), ==, !=)
define AssertGE (expr, val) AssertBinOp([**expr**](classCoordinate2D.md), [**val**](classCoordinate2D.md), &gt;=, &lt;)
define AssertGT (expr, val) AssertBinOp([**expr**](classCoordinate2D.md), [**val**](classCoordinate2D.md), &gt;, &lt;=)
define AssertLE (expr, val) AssertBinOp([**expr**](classCoordinate2D.md), [**val**](classCoordinate2D.md), &lt;=, &gt;)
define AssertNE (expr, val) AssertBinOp([**expr**](classCoordinate2D.md), [**val**](classCoordinate2D.md), !=, ==)
define Fail (...) /* multi line expression */
define HAS_BUILTIN (x) [**\_\_has\_builtin**](classCoordinate2D.md)(x)
define Unimplemented (...) Assert([**false**](classCoordinate2D.md), "Unimplemented");

Public Functions Documentation

function _Assert

inline void _Assert (
    bool condition,
    const std::string & condition_str,
    const std::optional< std::string > & message,
    const std::source_location & loc=std::source_location::current()
) 

function _AssertBinOp

template<typename  A, typename  B>
inline void _AssertBinOp (
    const  A & a,
    const  B & b,
    const std::string & a_str,
    const std::string & b_str,
    bool result,
    const std::string & op,
    const std::string & nop,
    const std::source_location & loc=std::source_location::current()
) 

function unreachable

inline void unreachable () 

Macro Definition Documentation

define Assert

#define Assert (
    condition,
    ...
) `if (!( condition )) _Assert( condition , # condition , std::optional<std::string>( __VA_ARGS__ ));`

define AssertBinOp

#define AssertBinOp (
    a,
    b,
    op,
    nop
) `if (!(( a ) op ( b ))) _AssertBinOp( a , b , # a , # b , a  op  b , # op , # nop )`

define AssertEQ

#define AssertEQ (
    expr,
    val
) `AssertBinOp( expr , val , ==, !=)`

define AssertGE

#define AssertGE (
    expr,
    val
) `AssertBinOp( expr , val , >=, <)`

define AssertGT

#define AssertGT (
    expr,
    val
) `AssertBinOp( expr , val , >, <=)`

define AssertLE

#define AssertLE (
    expr,
    val
) `AssertBinOp( expr , val , <=, >)`

define AssertNE

#define AssertNE (
    expr,
    val
) `AssertBinOp( expr , val , !=, ==)`

define Fail

#define Fail (
    ...
) `/* multi line expression */`

define HAS_BUILTIN

#define HAS_BUILTIN (
    x
) `__has_builtin (x)`

define Unimplemented

#define Unimplemented (
    ...
) `Assert( false , "Unimplemented");`


The documentation for this class was generated from the following file /home/runner/work/Blaze/Blaze/src/lib/assert/assert.hpp