Flow123d  JS_before_hm-937-g93502c2
Classes | Namespaces | Macros
asserts.hh File Reference

Definitions of ASSERTS. More...

#include <iostream>
#include <string>
#include <vector>
#include "system/exceptions.hh"
#include "system/fmt/posix.h"

Go to the source code of this file.

Classes

class  feal::Exc_assert
 Helper class. More...
 
class  feal::Assert
 Class defining debugging messages. More...
 
class  feal::AssertNull
 

Namespaces

 feal
 

Macros

#define _FEAL_ASSERT_A(x)   _FEAL_ASSERT_OP(x, B)
 Internal clever macro A. More...
 
#define _FEAL_ASSERT_B(x)   _FEAL_ASSERT_OP(x, A)
 Internal clever macro B. More...
 
#define _FEAL_ASSERT_OP(x, next)   _FEAL_ASSERT_A.add_value((x), #x)._FEAL_ASSERT_ ## next
 Internal clever macro recursion. More...
 
#define FEAL_ASSERT(expr)
 Definition of assert for debug and release mode. More...
 
#define FEAL_ASSERT_DBG(expr)
 Definition of assert for debug mode only. More...
 
#define ASSERT_LT(a, b)   FEAL_ASSERT(a < b)(a)(b)
 Definition of comparative assert macro (Less Than) More...
 
#define ASSERT_LT_DBG(a, b)   FEAL_ASSERT_DBG(a < b)(a)(b)
 Definition of comparative assert macro (Less Than) only for debug mode. More...
 
#define ASSERT_LE(a, b)   FEAL_ASSERT(a <= b)(a)(b)
 Definition of comparative assert macro (Less or Equal) More...
 
#define ASSERT_LE_DBG(a, b)   FEAL_ASSERT_DBG(a <= b)(a)(b)
 Definition of comparative assert macro (Less or Equal) only for debug mode. More...
 
#define ASSERT_GT(a, b)   FEAL_ASSERT(a > b)(a)(b)
 Definition of comparative assert macro (Greater Than) More...
 
#define ASSERT_GT_DBG(a, b)   FEAL_ASSERT_DBG(a > b)(a)(b)
 Definition of comparative assert macro (Greater Than) only for debug mode. More...
 
#define ASSERT_GE(a, b)   FEAL_ASSERT(a >= b)(a)(b)
 Definition of comparative assert macro (Greater or Equal) More...
 
#define ASSERT_GE_DBG(a, b)   FEAL_ASSERT_DBG(a >= b)(a)(b)
 Definition of comparative assert macro (Greater or Equal) only for debug mode. More...
 
#define ASSERT_EQ(a, b)   FEAL_ASSERT(a == b)(a)(b)
 Definition of comparative assert macro (EQual) More...
 
#define ASSERT_EQ_DBG(a, b)   FEAL_ASSERT_DBG(a == b)(a)(b)
 Definition of comparative assert macro (EQual) only for debug mode. More...
 
#define ASSERT_PTR(ptr)   FEAL_ASSERT( (ptr) != nullptr )
 Definition of assert macro checking non-null pointer (PTR) More...
 
#define ASSERT_PTR_DBG(ptr)   FEAL_ASSERT_DBG( (ptr) != nullptr )
 Definition of assert macro checking non-null pointer (PTR) only for debug mode. More...
 
#define ASSERT(expr)   FEAL_ASSERT( expr)
 Allow use shorter versions of macro names if these names is not used with external library. More...
 
#define ASSERT_DBG(expr)   FEAL_ASSERT_DBG( expr)
 

Detailed Description

Definitions of ASSERTS.

 * Copyright (C) 2015 Technical University of Liberec. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Definition in file asserts.hh.

Macro Definition Documentation

#define _FEAL_ASSERT_A (   x)    _FEAL_ASSERT_OP(x, B)

Internal clever macro A.

Definitions of internal macros

Definition at line 222 of file asserts.hh.

#define _FEAL_ASSERT_B (   x)    _FEAL_ASSERT_OP(x, A)

Internal clever macro B.

Definition at line 224 of file asserts.hh.

#define _FEAL_ASSERT_OP (   x,
  next 
)    _FEAL_ASSERT_A.add_value((x), #x)._FEAL_ASSERT_ ## next

Internal clever macro recursion.

Definition at line 226 of file asserts.hh.

#define ASSERT (   expr)    FEAL_ASSERT( expr)

Allow use shorter versions of macro names if these names is not used with external library.

Definition at line 347 of file asserts.hh.

#define ASSERT_DBG (   expr)    FEAL_ASSERT_DBG( expr)

Definition at line 28 of file include_fadbad.hh.

#define ASSERT_EQ (   a,
 
)    FEAL_ASSERT(a == b)(a)(b)

Definition of comparative assert macro (EQual)

Definition at line 328 of file asserts.hh.

#define ASSERT_EQ_DBG (   a,
 
)    FEAL_ASSERT_DBG(a == b)(a)(b)

Definition of comparative assert macro (EQual) only for debug mode.

Definition at line 332 of file asserts.hh.

#define ASSERT_GE (   a,
 
)    FEAL_ASSERT(a >= b)(a)(b)

Definition of comparative assert macro (Greater or Equal)

Definition at line 320 of file asserts.hh.

#define ASSERT_GE_DBG (   a,
 
)    FEAL_ASSERT_DBG(a >= b)(a)(b)

Definition of comparative assert macro (Greater or Equal) only for debug mode.

Definition at line 324 of file asserts.hh.

#define ASSERT_GT (   a,
 
)    FEAL_ASSERT(a > b)(a)(b)

Definition of comparative assert macro (Greater Than)

Definition at line 312 of file asserts.hh.

#define ASSERT_GT_DBG (   a,
 
)    FEAL_ASSERT_DBG(a > b)(a)(b)

Definition of comparative assert macro (Greater Than) only for debug mode.

Definition at line 316 of file asserts.hh.

#define ASSERT_LE (   a,
 
)    FEAL_ASSERT(a <= b)(a)(b)

Definition of comparative assert macro (Less or Equal)

Definition at line 304 of file asserts.hh.

#define ASSERT_LE_DBG (   a,
 
)    FEAL_ASSERT_DBG(a <= b)(a)(b)

Definition of comparative assert macro (Less or Equal) only for debug mode.

Definition at line 308 of file asserts.hh.

#define ASSERT_LT (   a,
 
)    FEAL_ASSERT(a < b)(a)(b)

Definition of comparative assert macro (Less Than)

Definition at line 296 of file asserts.hh.

#define ASSERT_LT_DBG (   a,
 
)    FEAL_ASSERT_DBG(a < b)(a)(b)

Definition of comparative assert macro (Less Than) only for debug mode.

Definition at line 300 of file asserts.hh.

#define ASSERT_PTR (   ptr)    FEAL_ASSERT( (ptr) != nullptr )

Definition of assert macro checking non-null pointer (PTR)

Definition at line 336 of file asserts.hh.

#define ASSERT_PTR_DBG (   ptr)    FEAL_ASSERT_DBG( (ptr) != nullptr )

Definition of assert macro checking non-null pointer (PTR) only for debug mode.

Definition at line 340 of file asserts.hh.

#define FEAL_ASSERT (   expr)
Value:
if ( !(expr) ) \
feal::Assert( #expr).set_context( __FILE__, __func__, __LINE__)._FEAL_ASSERT_A

Definition of assert for debug and release mode.

Undefining redefinitions of comparsion macros.

You can define FEAL_OVERRIDE_ASSERTS (e.g. in unit tests) and undefine macros with same name in external libraries. Definitions of assert macros

Definition at line 280 of file asserts.hh.

#define FEAL_ASSERT_DBG (   expr)
Value:
if ( !(expr) ) \
feal::AssertNull()._FEAL_ASSERT_A

Definition of assert for debug mode only.

Definition at line 290 of file asserts.hh.