From: Bruno Haible Date: Sun, 27 Oct 2019 15:40:39 +0000 (+0100) Subject: Add ASSERT_n macros for n up to 8. X-Git-Tag: cln_1-3-5~26 X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=commitdiff_plain;h=3bf48d85cf98452b090ae3649513d9384d5a7c8f;p=cln.git Add ASSERT_n macros for n up to 8. --- diff --git a/tests/test.h b/tests/test.h index 3df9f9a..0c6a46c 100644 --- a/tests/test.h +++ b/tests/test.h @@ -11,33 +11,83 @@ using namespace cln; #define ASSERT1(expr,a) \ if (!(expr)) { \ std::cerr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl; \ - std::cerr << #a" = " << a << endl; \ + std::cerr << #a" = " << a << endl; \ error = 1; \ } #define ASSERT2(expr,a,b) \ if (!(expr)) { \ std::cerr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl; \ - std::cerr << #a" = " << a << endl; \ - std::cerr << #b" = " << b << endl; \ + std::cerr << #a" = " << a << endl; \ + std::cerr << #b" = " << b << endl; \ error = 1; \ } #define ASSERT3(expr,a,b,c) \ if (!(expr)) { \ std::cerr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl; \ - std::cerr << #a" = " << a << endl; \ - std::cerr << #b" = " << b << endl; \ - std::cerr << #c" = " << c << endl; \ + std::cerr << #a" = " << a << endl; \ + std::cerr << #b" = " << b << endl; \ + std::cerr << #c" = " << c << endl; \ error = 1; \ } #define ASSERT4(expr,a,b,c,d) \ if (!(expr)) { \ std::cerr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl; \ - std::cerr << #a" = " << a << endl; \ - std::cerr << #b" = " << b << endl; \ - std::cerr << #c" = " << c << endl; \ - std::cerr << #d" = " << d << endl; \ + std::cerr << #a" = " << a << endl; \ + std::cerr << #b" = " << b << endl; \ + std::cerr << #c" = " << c << endl; \ + std::cerr << #d" = " << d << endl; \ + error = 1; \ + } + +#define ASSERT5(expr,a,b,c,d,e) \ + if (!(expr)) { \ + std::cerr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl; \ + std::cerr << #a" = " << a << endl; \ + std::cerr << #b" = " << b << endl; \ + std::cerr << #c" = " << c << endl; \ + std::cerr << #d" = " << d << endl; \ + std::cerr << #e" = " << e << endl; \ + error = 1; \ + } + +#define ASSERT6(expr,a,b,c,d,e,f) \ + if (!(expr)) { \ + std::cerr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl; \ + std::cerr << #a" = " << a << endl; \ + std::cerr << #b" = " << b << endl; \ + std::cerr << #c" = " << c << endl; \ + std::cerr << #d" = " << d << endl; \ + std::cerr << #e" = " << e << endl; \ + std::cerr << #f" = " << f << endl; \ + error = 1; \ + } + +#define ASSERT7(expr,a,b,c,d,e,f,g) \ + if (!(expr)) { \ + std::cerr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl; \ + std::cerr << #a" = " << a << endl; \ + std::cerr << #b" = " << b << endl; \ + std::cerr << #c" = " << c << endl; \ + std::cerr << #d" = " << d << endl; \ + std::cerr << #e" = " << e << endl; \ + std::cerr << #f" = " << f << endl; \ + std::cerr << #g" = " << g << endl; \ + error = 1; \ + } + +#define ASSERT8(expr,a,b,c,d,e,f,g,h) \ + if (!(expr)) { \ + std::cerr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl; \ + std::cerr << #a" = " << a << endl; \ + std::cerr << #b" = " << b << endl; \ + std::cerr << #c" = " << c << endl; \ + std::cerr << #d" = " << d << endl; \ + std::cerr << #e" = " << e << endl; \ + std::cerr << #f" = " << f << endl; \ + std::cerr << #g" = " << g << endl; \ + std::cerr << #h" = " << h << endl; \ error = 1; \ }