Ticket #7296: utils.5.hpp

File utils.5.hpp, 17.7 KB (added by Marco Guazzone <marco.guazzone@…>, 10 years ago)

The new patched utils.hpp (i.e., the one resulting after applying patch utils-201208301042.patch)

Line 
1/**
2 * \file util.hpp
3 *
4 * \brief Utility macros/functions for testing and debugging purpose.
5 *
6 * Basic usage:
7 * <pre>
8 * BOOST_UBLAS_TEST_DEF( test_case_1 )
9 * {
10 * // do your test stuff
11 * }
12 *
13 * BOOST_UBLAS_TEST_DEF( test_case_2 )
14 * {
15 * // do your test stuff
16 * }
17 *
18 * // ...
19 *
20 * BOOST_UBLAS_TEST_DEF( test_case_n )
21 * {
22 * // do your test stuff
23 * }
24 *
25 * int main()
26 * {
27 * BOOST_UBLAS_TEST_SUITE( "My Test Suite" ); // optional
28 *
29 * BOOST_UBLAS_TEST_BEGIN();
30 * BOOST_UBLAS_TEST_DO( test_case_1 );
31 * BOOST_UBLAS_TEST_DO( test_case_2 );
32 * // ...
33 * BOOST_UBLAS_TEST_DO( test_case_n );
34 * BOOST_UBLAS_TEST_END();
35 * }
36 * </pre>
37 * Inside each <em>test_case_<code>k</code></em> you can use the various
38 * \c BOOST_UBLAS_TEST_CHECK* macros.
39 *
40 * <hr/>
41 *
42 * Copyright (c) 2009-2012, Marco Guazzone
43 *
44 * Distributed under the Boost Software License, Version 1.0. (See
45 * accompanying file LICENSE_1_0.txt or copy at
46 * http://www.boost.org/LICENSE_1_0.txt)
47 *
48 * \author Marco Guazzone, marco.guazzone@gmail.com
49 */
50
51#ifndef BOOST_NUMERIC_UBLAS_TEST_UTILS_HPP
52#define BOOST_NUMERIC_UBLAS_TEST_UTILS_HPP
53
54
55#include <boost/numeric/ublas/detail/config.hpp>
56#include <boost/numeric/ublas/traits.hpp>
57#include <cmath>
58#include <complex>
59#include <cstddef>
60#include <iostream>
61#include <limits>
62#include <stdexcept>
63
64
65namespace boost { namespace numeric { namespace ublas { namespace test { namespace detail { namespace /*<unnamed>*/ {
66
67/// Check if the given complex number is a NaN.
68template <typename T>
69BOOST_UBLAS_INLINE
70bool isnan(::std::complex<T> const& z)
71{
72 // According to IEEE, NaN is different even by itself
73 return (z != z) || ::std::isnan(z.real()) || ::std::isnan(z.imag());
74}
75
76/// Check if two (real) numbers are close each other (wrt a given tolerance).
77template <typename T1, typename T2, typename T3>
78BOOST_UBLAS_INLINE
79bool close_to(T1 x, T2 y, T3 tol)
80{
81 typedef typename promote_traits<typename promote_traits<T1,T2>::promote_type,
82 T3>::promote_type real_type;
83
84 if (::std::isnan(x) || ::std::isnan(y))
85 {
86 // According to IEEE, NaN is different even by itself
87 return false;
88 }
89 return ::std::abs(x-y) <= (::std::max(static_cast<real_type>(::std::abs(x)), static_cast<real_type>(::std::abs(y)))*tol);
90}
91
92/// Check if two complex numbers are close each other (wrt a given tolerance).
93template <typename T1, typename T2, typename T3>
94BOOST_UBLAS_INLINE
95bool close_to(::std::complex<T1> const& x, ::std::complex<T2> const& y, T3 tol)
96{
97 typedef typename promote_traits<typename promote_traits<T1,T2>::promote_type,
98 T3>::promote_type real_type;
99
100 if (isnan(x) || isnan(y))
101 {
102 // According to IEEE, NaN is different even by itself
103 return false;
104 }
105 ::std::complex<real_type> xx(x);
106 ::std::complex<real_type> yy(y);
107 return ::std::abs(xx-yy) <= (::std::max(::std::abs(xx), ::std::abs(yy))*tol);
108}
109
110/// Check if two (real) numbers are close each other (wrt a given tolerance).
111template <typename T1, typename T2, typename T3>
112BOOST_UBLAS_INLINE
113bool rel_close_to(T1 x, T2 y, T3 tol)
114{
115 typedef typename promote_traits<typename promote_traits<T1,T2>::promote_type,
116 T3>::promote_type real_type;
117
118 if (::std::isnan(x) || ::std::isnan(y))
119 {
120 // According to IEEE, NaN is different even by itself
121 return false;
122 }
123 return ::std::abs(x-y)/::std::abs(y) <= tol;
124}
125
126/// Check if two complex numbers are close each other (wrt a given tolerance).
127template <typename T1, typename T2, typename T3>
128BOOST_UBLAS_INLINE
129bool rel_close_to(::std::complex<T1> const& x, ::std::complex<T2> const& y, T3 tol)
130{
131 typedef typename promote_traits<typename promote_traits<T1,T2>::promote_type,
132 T3>::promote_type real_type;
133
134 if (isnan(x) || isnan(y))
135 {
136 // According to IEEE, NaN is different even by itself
137 return false;
138 }
139 ::std::complex<real_type> xx(x);
140 ::std::complex<real_type> yy(y);
141 return ::std::abs(xx-yy)/::std::abs(yy) <= tol;
142}
143
144}}}}}} // Namespace boost::numeric::ublas::test::detail::<unnamed>
145
146
147/// Expand its argument \a x.
148#define BOOST_UBLAS_TEST_EXPAND_(x) x
149
150
151/// Expand its argument \a x inside parenthesis.
152#define BOOST_UBLAS_TEST_EXPANDP_(x) (x)
153
154
155/// Transform its argument \a x into a string.
156#define BOOST_UBLAS_TEST_STRINGIFY_(x) #x
157
158
159/// Concatenate its two \e string arguments \a x and \a y.
160#define BOOST_UBLAS_TEST_JOIN_(x,y) x ## y
161
162
163/// Output the message \a x if in debug-mode; otherwise output nothing.
164/// Note: we don't use macro expansion inside parenthesis to let \a m be an
165/// expression of the form <code>a &lt;&lt; b</code>.
166#ifndef NDEBUG
167# define BOOST_UBLAS_DEBUG_TRACE(x) ::std::cerr << "[Debug>> " << BOOST_UBLAS_TEST_EXPAND_(x) << ::std::endl
168#else
169# define BOOST_UBLAS_DEBUG_TRACE(x) /**/
170#endif // NDEBUG
171
172
173/// Define the name \a m of the entire test suite.
174#define BOOST_UBLAS_TEST_SUITE(m) ::std::cerr << "--- Test Suite: " << BOOST_UBLAS_TEST_EXPAND_(m) << " ---" << ::std::endl;
175
176
177/// Define the beginning of a test suite.
178#define BOOST_UBLAS_TEST_BEGIN() /* [BOOST_UBLAS_TEST_BEGIN] */ \
179 { \
180 /* Begin of Test Suite */ \
181 ::std::size_t test_fails__(0) \
182 /* [/BOOST_UBLAS_TEST_BEGIN] */
183
184
185/// Define a test case \a x inside the current test suite.
186#define BOOST_UBLAS_TEST_DEF(x) static void BOOST_UBLAS_TEST_EXPAND_(x)(::std::size_t& test_fails__)
187
188
189/// Call the test case \a x.
190#define BOOST_UBLAS_TEST_DO(x) /* [BOOST_UBLAS_TEST_DO] */ \
191 try \
192 { \
193 BOOST_UBLAS_TEST_EXPAND_(x)(test_fails__); \
194 } \
195 catch (::std::exception& e) \
196 { \
197 ++test_fails__; \
198 BOOST_UBLAS_TEST_ERROR( e.what() ); \
199 } \
200 catch (...) \
201 { \
202 ++test_fails__; \
203 } \
204 /* [/BOOST_UBLAS_TEST_DO] */
205
206
207/// Define the end of a test suite.
208#define BOOST_UBLAS_TEST_END() /* [BOOST_UBLAS_TEST_END] */ \
209 if (test_fails__ > 0) \
210 { \
211 ::std::cerr << "Number of failed tests: " << test_fails__ << ::std::endl; \
212 } \
213 else \
214 { \
215 ::std::cerr << "No failed test" << ::std::endl; \
216 } \
217 } /* End of test suite */ \
218 /* [/BOOST_UBLAS_TEST_END] */
219
220
221/// Output the message \a m.
222/// Note: we don't use macro expansion inside parenthesis to let \a m be an
223/// expression of the form <code>a &lt;&lt; b</code>.
224#define BOOST_UBLAS_TEST_TRACE(m) ::std::cerr << "[Info>> " << BOOST_UBLAS_TEST_EXPAND_(m) << ::std::endl
225
226
227/// Check the truth of assertion \a x.
228#define BOOST_UBLAS_TEST_CHECK(x) /* [BOOST_UBLAS_TEST_CHECK] */ \
229 if (!BOOST_UBLAS_TEST_EXPANDP_(x)) \
230 { \
231 BOOST_UBLAS_TEST_ERROR( "Failed assertion: " << BOOST_UBLAS_TEST_STRINGIFY_(x) ); \
232 ++test_fails__; \
233 } \
234 /* [/BOOST_UBLAS_TEST_CHECK] */
235
236
237/// Check for the equality of \a x against \a y.
238#define BOOST_UBLAS_TEST_CHECK_EQ(x,y) /* [BOOST_UBLAS_TEST_CHECK_EQUAL] */ \
239 if (!(BOOST_UBLAS_TEST_EXPANDP_(x) == BOOST_UBLAS_TEST_EXPANDP_(y))) \
240 { \
241 BOOST_UBLAS_TEST_ERROR( "Failed assertion: (" << BOOST_UBLAS_TEST_STRINGIFY_(x) << " == " << BOOST_UBLAS_TEST_STRINGIFY_(y) << ")" ); \
242 ++test_fails__; \
243 } \
244 /* [/BOOST_UBLAS_TEST_CHECK_EQUAL] */
245
246
247/// Alias for macro \c BOOST_UBLAS_TEST_CHECK_EQ (for backward compatibility).
248#define BOOST_UBLAS_TEST_CHECK_EQUAL(x,y) BOOST_UBLAS_TEST_CHECK_EQ(x,y)
249
250
251/// Check that \a x and \a y are close with respect to a given precision \a e.
252#define BOOST_UBLAS_TEST_CHECK_CLOSE(x,y,e) /* [BOOST_UBLAS_TEST_CHECK_CLOSE] */ \
253 if (!::boost::numeric::ublas::test::detail::close_to(BOOST_UBLAS_TEST_EXPAND_(x), BOOST_UBLAS_TEST_EXPAND_(y), BOOST_UBLAS_TEST_EXPAND_(e))) \
254 { \
255 BOOST_UBLAS_TEST_ERROR( "Failed assertion: abs(" << BOOST_UBLAS_TEST_STRINGIFY_(x) << "-" << BOOST_UBLAS_TEST_STRINGIFY_(y) << ") <= " << BOOST_UBLAS_TEST_STRINGIFY_(e) << " [with " << BOOST_UBLAS_TEST_STRINGIFY_(x) << " == " << BOOST_UBLAS_TEST_EXPANDP_(x) << ", " << BOOST_UBLAS_TEST_STRINGIFY_(y) << " == " << BOOST_UBLAS_TEST_EXPANDP_(y) << " and " << BOOST_UBLAS_TEST_STRINGIFY_(e) << " == " << BOOST_UBLAS_TEST_EXPANDP_(e) << "]" ); \
256 ++test_fails__; \
257 } \
258 /* [/BOOST_UBLAS_TEST_CHECK_CLOSE] */
259
260
261/// Alias for macro \c BOOST_UBLAS_TEST_CHECK_CLOSE (for backward compatibility),
262#define BOOST_UBLAS_TEST_CHECK_PRECISION(x,y,e) BOOST_UBLAS_TEST_CHECK_CLOSE(x,y,e)
263
264
265/// Check that \a x is close to \a y with respect to a given relative precision \a e.
266#define BOOST_UBLAS_TEST_CHECK_REL_CLOSE(x,y,e) /* [BOOST_UBLAS_TEST_CHECK_REL_CLOSE] */ \
267 if (!::boost::numeric::ublas::test::detail::rel_close_to(BOOST_UBLAS_TEST_EXPAND_(x), BOOST_UBLAS_TEST_EXPAND_(y), BOOST_UBLAS_TEST_EXPAND_(e))) \
268 { \
269 BOOST_UBLAS_TEST_ERROR( "Failed assertion: abs((" << BOOST_UBLAS_TEST_STRINGIFY_(x) << "-" << BOOST_UBLAS_TEST_STRINGIFY_(y) << ")/" << BOOST_UBLAS_TEST_STRINGIFY_(y) << ") <= " << BOOST_UBLAS_TEST_STRINGIFY_(e) << " [with " << BOOST_UBLAS_TEST_STRINGIFY_(x) << " == " << BOOST_UBLAS_TEST_EXPANDP_(x) << ", " << BOOST_UBLAS_TEST_STRINGIFY_(y) << " == " << BOOST_UBLAS_TEST_EXPANDP_(y) << " and " << BOOST_UBLAS_TEST_STRINGIFY_(e) << " == " << BOOST_UBLAS_TEST_EXPANDP_(e) << "]" ); \
270 ++test_fails__; \
271 } \
272 /* [/BOOST_UBLAS_TEST_CHECK_REL_CLOSE] */
273
274
275/// Alias for macro \c BOOST_UBLAS_TEST_CHECK_REL_CLOSE (for backward compatibility),
276#define BOOST_UBLAS_TEST_CHECK_REL_PRECISION(x,y,e) BOOST_UBLAS_TEST_CHECK_REL_CLOSE(x,y,e)
277
278
279/// Check that elements of \a x and \a y are equal.
280#define BOOST_UBLAS_TEST_CHECK_VECTOR_EQ(x,y,n) /* [BOOST_UBLAS_TEST_CHECK_VECTOR_EQ] */ \
281 if (BOOST_UBLAS_TEST_EXPANDP_(n) > 0) \
282 { \
283 ::std::size_t n__ = BOOST_UBLAS_TEST_EXPAND_(n); \
284 for (::std::size_t i__ = n__; i__ > 0; --i__) \
285 { \
286 if (!(BOOST_UBLAS_TEST_EXPANDP_(x)[n__-i__]==BOOST_UBLAS_TEST_EXPANDP_(y)[n__-i__])) \
287 { \
288 BOOST_UBLAS_TEST_ERROR( "Failed assertion: (" << BOOST_UBLAS_TEST_STRINGIFY_(x[i__]) << "==" << BOOST_UBLAS_TEST_STRINGIFY_(y[i__]) << ")" << " [with " << BOOST_UBLAS_TEST_STRINGIFY_(x[i__]) << " == " << BOOST_UBLAS_TEST_EXPANDP_(x)[n__-i__] << ", " << BOOST_UBLAS_TEST_STRINGIFY_(y[i__]) << " == " << BOOST_UBLAS_TEST_EXPANDP_(y)[n__-i__] << ", " << BOOST_UBLAS_TEST_STRINGIFY_(i__) << " == " << i__ << " and " << BOOST_UBLAS_TEST_STRINGIFY_(n) << " == " << n__ << "]" ); \
289 ++test_fails__; \
290 } \
291 } \
292 } \
293 /* [/BOOST_UBLAS_TEST_CHECK_VECTOR_EQ] */
294
295
296/// Check that elements of \a x and \a y are close with respect to a given precision \a e.
297#define BOOST_UBLAS_TEST_CHECK_VECTOR_CLOSE(x,y,n,e) /* [BOOST_UBLAS_TEST_CHECK_VECTOR_CLOSE] */ \
298 if (BOOST_UBLAS_TEST_EXPANDP_(n) > 0) \
299 { \
300 ::std::size_t n__ = BOOST_UBLAS_TEST_EXPAND_(n); \
301 for (::std::size_t i__ = n__; i__ > 0; --i__) \
302 { \
303 if (!::boost::numeric::ublas::test::detail::close_to(BOOST_UBLAS_TEST_EXPANDP_(x)[n__-i__], BOOST_UBLAS_TEST_EXPANDP_(y)[n__-i__], BOOST_UBLAS_TEST_EXPANDP_(e))) \
304 { \
305 BOOST_UBLAS_TEST_ERROR( "Failed assertion: abs((" << BOOST_UBLAS_TEST_STRINGIFY_(x[i__]) << "-" << BOOST_UBLAS_TEST_STRINGIFY_(y[i__]) << ") <= " << BOOST_UBLAS_TEST_STRINGIFY_(e) << " [with " << BOOST_UBLAS_TEST_STRINGIFY_(x[i__]) << " == " << BOOST_UBLAS_TEST_EXPANDP_(x)[n__-i__] << ", " << BOOST_UBLAS_TEST_STRINGIFY_(y[i__]) << " == " << BOOST_UBLAS_TEST_EXPANDP_(y)[n__-i__] << ", " << BOOST_UBLAS_TEST_STRINGIFY_(i__) << " == " << i__ << " and " << BOOST_UBLAS_TEST_STRINGIFY_(n) << " == " << n__ << "]" ); \
306 ++test_fails__; \
307 } \
308 } \
309 } \
310 /* [/BOOST_UBLAS_TEST_CHECK_VECTOR_CLOSE] */
311
312
313/// Check that elements of \a x and \a y are close with respect to a given relative precision \a e.
314#define BOOST_UBLAS_TEST_CHECK_VECTOR_REL_CLOSE(x,y,n,e) /* [BOOST_UBLAS_TEST_CHECK_VECTOR_REL_CLOSE] */ \
315 if (BOOST_UBLAS_TEST_EXPANDP_(n) > 0) \
316 { \
317 ::std::size_t n__ = BOOST_UBLAS_TEST_EXPAND_(n); \
318 for (::std::size_t i__ = n__; i__ > 0; --i__) \
319 { \
320 if (!::boost::numeric::ublas::test::detail::rel_close_to(BOOST_UBLAS_TEST_EXPANDP_(x)[n__-i__], BOOST_UBLAS_TEST_EXPANDP_(y)[n__-i__], BOOST_UBLAS_TEST_EXPANDP_(e))) \
321 { \
322 BOOST_UBLAS_TEST_ERROR( "Failed assertion: abs((" << BOOST_UBLAS_TEST_STRINGIFY_(x[i__]) << "-" << BOOST_UBLAS_TEST_STRINGIFY_(y[i__]) << ") <= " << BOOST_UBLAS_TEST_STRINGIFY_(e) << " [with " << BOOST_UBLAS_TEST_STRINGIFY_(x[i__]) << " == " << BOOST_UBLAS_TEST_EXPANDP_(x)[n__-i__] << ", " << BOOST_UBLAS_TEST_STRINGIFY_(y[i__]) << " == " << BOOST_UBLAS_TEST_EXPANDP_(y)[n__-i__] << ", " << BOOST_UBLAS_TEST_STRINGIFY_(i__) << " == " << i__ << " and " << BOOST_UBLAS_TEST_STRINGIFY_(n) << " == " << n__ << "]" ); \
323 ++test_fails__; \
324 } \
325 } \
326 } \
327 /* [/BOOST_UBLAS_TEST_CHECK_VECTOR_REL_CLOSE] */
328
329
330/// Check that elements of matrices \a x and \a y are equal.
331#define BOOST_UBLAS_TEST_CHECK_MATRIX_EQ(x,y,nr,nc) /* [BOOST_UBLAS_TEST_CHECK_MATRIX_EQ] */ \
332 for (::std::size_t i__ = 0; i__ < BOOST_UBLAS_TEST_EXPANDP_(nr); ++i__) \
333 { \
334 for (::std::size_t j__ = 0; j__ < BOOST_UBLAS_TEST_EXPANDP_(nc); ++j__) \
335 { \
336 if (!(BOOST_UBLAS_TEST_EXPANDP_(x)(i__,j__)==BOOST_UBLAS_TEST_EXPANDP_(y)(i__,j__))) \
337 { \
338 BOOST_UBLAS_TEST_ERROR( "Failed assertion: (" << BOOST_UBLAS_TEST_STRINGIFY_(x(i__,j__)) << " == " << BOOST_UBLAS_TEST_STRINGIFY_(y(i__,j__)) << ") [with " << BOOST_UBLAS_TEST_STRINGIFY_(x(i__,j__)) << " == " << BOOST_UBLAS_TEST_EXPANDP_(x)(i__,j__) << ", " << BOOST_UBLAS_TEST_STRINGIFY_(y(i__,j__)) << " == " << BOOST_UBLAS_TEST_EXPANDP_(y)(i__,j__) << ", " << BOOST_UBLAS_TEST_STRINGIFY_(i__) << " == " << i__ << ", " << BOOST_UBLAS_TEST_STRINGIFY_(j__) << " == " << BOOST_UBLAS_TEST_EXPANDP_(j__) << ", " << BOOST_UBLAS_TEST_STRINGIFY_(nr) << " == " << BOOST_UBLAS_TEST_EXPANDP_(nr) << " and " << BOOST_UBLAS_TEST_STRINGIFY_(nc) << " == " << BOOST_UBLAS_TEST_EXPANDP_(nc) << "]" ); \
339 ++test_fails__; \
340 } \
341 } \
342 } \
343 /* [/BOOST_UBLAS_TEST_CHECK_MATRIX_EQ] */
344
345
346/// Check that elements of matrices \a x and \a y are close with respect to a given precision \a e.
347#define BOOST_UBLAS_TEST_CHECK_MATRIX_CLOSE(x,y,nr,nc,e) /* [BOOST_UBLAS_TEST_CHECK_MATRIX_CLOSE] */ \
348 for (::std::size_t i__ = 0; i__ < BOOST_UBLAS_TEST_EXPANDP_(nr); ++i__) \
349 { \
350 for (::std::size_t j__ = 0; j__ < BOOST_UBLAS_TEST_EXPANDP_(nc); ++j__) \
351 { \
352 if (!::boost::numeric::ublas::test::detail::close_to(BOOST_UBLAS_TEST_EXPANDP_(x)(i__,j__), BOOST_UBLAS_TEST_EXPANDP_(y)(i__,j__), BOOST_UBLAS_TEST_EXPANDP_(e))) \
353 { \
354 BOOST_UBLAS_TEST_ERROR( "Failed assertion: abs((" << BOOST_UBLAS_TEST_STRINGIFY_(x(i__,j__)) << "-" << BOOST_UBLAS_TEST_STRINGIFY_(y(i__,j__)) << ") <= " << BOOST_UBLAS_TEST_STRINGIFY_(e) << " [with " << BOOST_UBLAS_TEST_STRINGIFY_(x(i__,j__)) << " == " << BOOST_UBLAS_TEST_EXPANDP_(x)(i__,j__) << ", " << BOOST_UBLAS_TEST_STRINGIFY_(y(i__,j__)) << " == " << BOOST_UBLAS_TEST_EXPANDP_(y)(i__,j__) << ", " << BOOST_UBLAS_TEST_STRINGIFY_(i__) << " == " << i__ << ", " << BOOST_UBLAS_TEST_STRINGIFY_(j__) << " == " << BOOST_UBLAS_TEST_EXPANDP_(j__) << ", " << BOOST_UBLAS_TEST_STRINGIFY_(nr) << " == " << BOOST_UBLAS_TEST_EXPANDP_(nr) << " and " << BOOST_UBLAS_TEST_STRINGIFY_(nc) << " == " << BOOST_UBLAS_TEST_EXPANDP_(nc) << "]" ); \
355 ++test_fails__; \
356 } \
357 } \
358 } \
359 /* [/BOOST_UBLAS_TEST_CHECK_MATRIX_CLOSE] */
360
361
362/// Check that elements of matrices \a x and \a y are close with respect to a given relative precision \a e.
363#define BOOST_UBLAS_TEST_CHECK_MATRIX_REL_CLOSE(x,y,nr,nc,e) /* [BOOST_UBLAS_TEST_CHECK_MATRIX_REL_CLOSE] */ \
364 for (::std::size_t i__ = 0; i__ < BOOST_UBLAS_TEST_EXPANDP_(nr); ++i__) \
365 { \
366 for (::std::size_t j__ = 0; j__ < BOOST_UBLAS_TEST_EXPANDP_(nc); ++j__) \
367 { \
368 if (!::boost::numeric::ublas::test::detail::rel_close_to(BOOST_UBLAS_TEST_EXPANDP_(x)(i__,j__), BOOST_UBLAS_TEST_EXPANDP_(y)(i__,j__), BOOST_UBLAS_TEST_EXPANDP_(e))) \
369 { \
370 BOOST_UBLAS_TEST_ERROR( "Failed assertion: abs((" << BOOST_UBLAS_TEST_STRINGIFY_(x(i__,j__)) << "-" << BOOST_UBLAS_TEST_STRINGIFY_(y(i__,j__)) << ") <= " << BOOST_UBLAS_TEST_STRINGIFY_(e) << " [with " << BOOST_UBLAS_TEST_STRINGIFY_(x(i__,j__)) << " == " << BOOST_UBLAS_TEST_EXPANDP_(x)(i__,j__) << ", " << BOOST_UBLAS_TEST_STRINGIFY_(y(i__,j__)) << " == " << BOOST_UBLAS_TEST_EXPANDP_(y)(i__,j__) << ", " << BOOST_UBLAS_TEST_STRINGIFY_(i__) << " == " << i__ << ", " << BOOST_UBLAS_TEST_STRINGIFY_(j__) << " == " << BOOST_UBLAS_TEST_EXPANDP_(j__) << ", " << BOOST_UBLAS_TEST_STRINGIFY_(nr) << " == " << BOOST_UBLAS_TEST_EXPANDP_(nr) << " and " << BOOST_UBLAS_TEST_STRINGIFY_(nc) << " == " << BOOST_UBLAS_TEST_EXPANDP_(nc) << "]" ); \
371 ++test_fails__; \
372 } \
373 } \
374 } \
375 /* [/BOOST_UBLAS_TEST_CHECK_MATRIX_REL_CLOSE] */
376
377
378///< Output the error message \a x.
379#define BOOST_UBLAS_TEST_ERROR(x) ::std::cerr << "[Error (" << __FILE__ << ":" << __func__ << ":" << __LINE__ << ")>> " << BOOST_UBLAS_TEST_EXPAND_(x) << ::std::endl
380
381#endif // BOOST_NUMERIC_UBLAS_TEST_UTILS_HPP