SpinParser  1.0
Macros
Assert.hpp File Reference

Lightweight macro library for assertions. More...

#include "lib/Exception.hpp"
Include dependency graph for Assert.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define __RESOLVE_ASSERT_OVERLOAD(_1, _2, FUNCTIONNAME, ...)   FUNCTIONNAME
 Wrapper for macro overlading.
 
#define ASSERT(...)   __RESOLVE_ASSERT_OVERLOAD(__VA_ARGS__, __ASSERT_OVERLOAD2, __ASSERT_OVERLOAD1)(__VA_ARGS__)
 Ensure that the first argument is true. Optionally provide a message as the second argument, which is printed with an error message if the assertion fails.
 
#define __ASSERT_OVERLOAD1(x)
 Ensure that a statement is true. If statement is false, throw AssertionFail exception. More...
 
#define __ASSERT_OVERLOAD2(x, msg)
 Ensure that a statement is true. If statement is false, throw AssertionFail exception. More...
 

Detailed Description

Lightweight macro library for assertions.

Author
Finn Lasse Buessen

Macro Definition Documentation

◆ __ASSERT_OVERLOAD1

#define __ASSERT_OVERLOAD1 (   x)

Ensure that a statement is true. If statement is false, throw AssertionFail exception.

Parameters
xStatement to assess.

◆ __ASSERT_OVERLOAD2

#define __ASSERT_OVERLOAD2 (   x,
  msg 
)

Ensure that a statement is true. If statement is false, throw AssertionFail exception.

Parameters
xStatement to assess.
msgMessage to print with the exception.