]> www.ginac.de Git - cln.git/blobdiff - tests/test.h
Fix configury (intptr_t test) for cross-compilation.
[cln.git] / tests / test.h
index ae3c3c448604bcc03cf1c42ebd8d53b7e1262eba..0c6a46c5f2ccb2dd6d5dc5b2186c86839d62af8e 100644 (file)
@@ -1,76 +1,93 @@
-#include <cl_io.h>
+#include <cln/io.h>
+using namespace std;
+using namespace cln;
 
 #define ASSERT(expr)  \
   if (!(expr)) {                                       \
-       fprint(cl_stderr,"Assertion failed! File ");    \
-       fprint(cl_stderr,__FILE__);                     \
-       fprint(cl_stderr,", line ");                    \
-       fprintdecimal(cl_stderr,__LINE__);              \
-       fprint(cl_stderr,".\n");                        \
+       std::cerr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl;    \
        error = 1;                                      \
   }
 
 #define ASSERT1(expr,a)  \
   if (!(expr)) {                                       \
-       fprint(cl_stderr,"Assertion failed! File ");    \
-       fprint(cl_stderr,__FILE__);                     \
-       fprint(cl_stderr,", line ");                    \
-       fprintdecimal(cl_stderr,__LINE__);              \
-       fprint(cl_stderr,".\n");                        \
-       fprint(cl_stderr,#a" = ");                      \
-       fprint(cl_stderr,a);                            \
-       fprint(cl_stderr,"\n");                         \
+       std::cerr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl;    \
+       std::cerr << #a" = " << a << endl;              \
        error = 1;                                      \
   }
 
 #define ASSERT2(expr,a,b)  \
   if (!(expr)) {                                       \
-       fprint(cl_stderr,"Assertion failed! File ");    \
-       fprint(cl_stderr,__FILE__);                     \
-       fprint(cl_stderr,", line ");                    \
-       fprintdecimal(cl_stderr,__LINE__);              \
-       fprint(cl_stderr,".\n");                        \
-       fprint(cl_stderr,#a" = ");                      \
-       fprint(cl_stderr,a);                            \
-       fprint(cl_stderr,"\n"#b" = ");                  \
-       fprint(cl_stderr,b);                            \
-       fprint(cl_stderr,"\n");                         \
+       std::cerr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl;    \
+       std::cerr << #a" = " << a << endl;              \
+       std::cerr << #b" = " << b << endl;              \
        error = 1;                                      \
   }
 
 #define ASSERT3(expr,a,b,c)  \
   if (!(expr)) {                                       \
-       fprint(cl_stderr,"Assertion failed! File ");    \
-       fprint(cl_stderr,__FILE__);                     \
-       fprint(cl_stderr,", line ");                    \
-       fprintdecimal(cl_stderr,__LINE__);              \
-       fprint(cl_stderr,".\n");                        \
-       fprint(cl_stderr,#a" = ");                      \
-       fprint(cl_stderr,a);                            \
-       fprint(cl_stderr,"\n"#b" = ");                  \
-       fprint(cl_stderr,b);                            \
-       fprint(cl_stderr,"\n"#c" = ");                  \
-       fprint(cl_stderr,c);                            \
-       fprint(cl_stderr,"\n");                         \
+       std::cerr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << 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)) {                                       \
-       fprint(cl_stderr,"Assertion failed! File ");    \
-       fprint(cl_stderr,__FILE__);                     \
-       fprint(cl_stderr,", line ");                    \
-       fprintdecimal(cl_stderr,__LINE__);              \
-       fprint(cl_stderr,".\n");                        \
-       fprint(cl_stderr,#a" = ");                      \
-       fprint(cl_stderr,a);                            \
-       fprint(cl_stderr,"\n"#b" = ");                  \
-       fprint(cl_stderr,b);                            \
-       fprint(cl_stderr,"\n"#c" = ");                  \
-       fprint(cl_stderr,c);                            \
-       fprint(cl_stderr,"\n"#d" = ");                  \
-       fprint(cl_stderr,d);                            \
-       fprint(cl_stderr,"\n");                         \
+       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;              \
        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;                                      \
+  }