0.95.0-final
Finite Element Embedded Library and Language in C++
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
feelassert.hpp
Go to the documentation of this file.
1
/* -*- mode: c++; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; show-trailing-whitespace: t -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2
3
This file is part of the Feel library
4
5
Author(s): Christophe Prud'homme <christophe.prudhomme@feelpp.org>
6
Date: 2005-02-19
7
8
Copyright (C) 2009 Université de Grenoble 1
9
Copyright (C) 2005,2006 EPFL
10
11
This library is free software; you can redistribute it and/or
12
modify it under the terms of the GNU Lesser General Public
13
License as published by the Free Software Foundation; either
14
version 3.0 of the License, or (at your option) any later version.
15
16
This library is distributed in the hope that it will be useful,
17
but WITHOUT ANY WARRANTY; without even the implied warranty of
18
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
Lesser General Public License for more details.
20
21
You should have received a copy of the GNU Lesser General Public
22
License along with this library; if not, write to the Free Software
23
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24
*/
30
#ifndef FEELASSERT_HPP
31
#define FEELASSERT_HPP 1
32
59
// access to smart assertion from feel.hpp
60
#include <feel/feelcore/smartassert.hpp>
61
62
#if FEELPP_IS_VERSION(0,9,0)
63
64
#define ERROR_MSG(A) FEELPP_ASSERT( 0 ).error( A );
65
#define ASSERT0(X,A) FEELPP_ASSERT( X ).error( A );
66
#define ASSERT_PRE0(X,A) FEELPP_ASSERT( X ).error( "Precondition Error" );
67
#define ASSERT_POS0(X,A) FEELPP_ASSERT( X ).error( "Postcondition Error" );
68
#define ASSERT_INV0(X,A) FEELPP_ASSERT( X ).error( "Invariant Error : " );
69
#define ASSERT_BD0(X) FEELPP_ASSERT( X ).error( "Array bounds error" );
70
71
#else
72
73
# define ERROR_MSG(A) \
74
do { std::cerr << std::endl << std::endl << A << std::endl << std::endl ; ABORT() ; } while (0)
75
76
77
78
# define ASSERT0(X,A) if ( !(X) ) \
79
ERROR_MSG(A << std::endl << "Error in file" << __FILE__ << " line " << __LINE__) ;
80
81
82
# define ASSERT_PRE0(X,A) if ( !(X) ) \
83
ERROR_MSG(A << std::endl << "Precondition Error " << "in file " << __FILE__ \
84
<< " line " << __LINE__) ;
85
86
87
# define ASSERT_POS0(X,A) if ( !(X) ) \
88
ERROR_MSG(A << std::endl <<"Postcondition Error " << "in file " << __FILE__ \
89
<< " line " << __LINE__) ;
90
91
92
# define ASSERT_INV0(X,A) if ( !(X) ) \
93
ERROR_MSG(A <<std::endl << "Invariant Error " << "in file " << __FILE__ \
94
<< " line " << __LINE__) ;
95
96
# define ASSERT_BD0(X) if ( !(X) ) \
97
ERROR_MSG("Array bound error " << "in file " << __FILE__ \
98
<< " line " << __LINE__) ;
99
100
#endif
/* 0 */
101
102
#if 0
103
#ifdef FEELPP_CHECK_ALL
104
#define CHECK_KN
105
#define TEST_PRE
106
#define TEST_POS
107
#define TEST_INV
108
#define TEST_BOUNDS
109
#define NOINLINE
110
#undef NDEBUG
111
#endif
/* FEELPP_CHECK_ALL */
112
113
#ifdef NDEBUG
114
#define ASSERT(X,A)
115
#else
116
#define ASSERT(X,A) ASSERT0(X,A)
117
#endif
118
119
#ifdef TEST_PRE
120
#define ASSERT_PRE(X,A) ASSERT_PRE0(X,A)
121
#else
122
#define ASSERT_PRE(X,A)
123
#endif
124
125
#ifdef TEST_POS
126
#define ASSERT_POS(X,A) ASSERT_POS0(X,A)
127
#else
128
#define ASSERT_POS(X,A)
129
#endif
130
131
#ifdef TEST_INV
132
#define ASSERT_INV(X,A) ASSERT_INV0(X,A)
133
#else
134
#define ASSERT_INV(X,A)
135
#endif
136
137
#ifdef TEST_BOUNDS
138
#define ASSERT_BD(X) ASSERT_BD0(X)
139
#else
140
#define ASSERT_BD(X)
141
#endif
142
143
#endif
144
145
#endif
/* FEELASSERT_HPP */
146
Generated on Sun Dec 22 2013 13:11:00 for Feel++ by
1.8.5