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