]> www.ginac.de Git - cln.git/blobdiff - tests/exam_I_gcd.cc
Fetch imported m4 files during autogen.sh invocation.
[cln.git] / tests / exam_I_gcd.cc
index ead642acb4c69e5e87f86529f278e1319c1b3ca7..09589dd91daf4cdee3e58f81e08fb43d2319b542 100644 (file)
@@ -1,21 +1,20 @@
-#include <cl_integer.h>
-#include <cl_integer_io.h>
-#include <cl_io.h>
+#include <cln/integer.h>
+#include <cln/integer_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");                                        \
-       error = 1;                                                      \
+  if (!(expr)) {                                        \
+       std::cerr << "Assertion failed! File " << __FILE__ << ", line " << __LINE__ << endl;    \
+       error = 1;                                      \
   }
 
 struct gcd_test {
        const char * arg1;
-        const char * arg2;
-        const char * result;
+       const char * arg2;
+       const char * result;
 };
 
 #define num_elements(array)  (sizeof(array)/sizeof(array[0]))
@@ -32,16 +31,9 @@ static int test_##typename##_##opname (void)                         \
                rtype computed_result = opname(arg1,arg2);              \
                rtype result = rtype(test.result);                      \
                if (computed_result != result) {                        \
-                       fprint(cl_stderr, "Error in " #typename "_" #opname "_tests["); \
-                       fprintdecimal(cl_stderr, i);                    \
-                       fprint(cl_stderr, "] !\n");                     \
-                       fprint(cl_stderr, "Result should be: ");        \
-                       fprint(cl_stderr, result);                      \
-                       fprint(cl_stderr, "\n");                        \
-                       fprint(cl_stderr, "Result computed : ");        \
-                       fprint(cl_stderr, computed_result);             \
-                       fprint(cl_stderr, "\n");                        \
-                       fprint(cl_stderr, "\n");                        \
+                       std::cerr << "Error in " #typename "_" #opname "_tests[" << i << "] !" << endl; \
+                       std::cerr << "Result should be: " << result << endl;    \
+                       std::cerr << "Result computed : " << computed_result << endl << endl;   \
                        error = 1;                                      \
                }                                                       \
        }                                                               \
@@ -58,7 +50,8 @@ static gcd_test integer_gcd_tests[] = {
        { "101611479673163974026724715741235467160607959655653420075620", "533177863832047932237026621580126811198495699416238676294977", "1" },
        { "30729415811", "323233683197", "31071199" },
        { "77874422", "32223899", "1" },
-       { "974507656412513757857315037382926980395082974811562770185617915360", "-1539496810360685510909469177732386446833404488164283", "1" }
+       { "974507656412513757857315037382926980395082974811562770185617915360", "-1539496810360685510909469177732386446833404488164283", "1" },
+       { "2823618260546496405819033080103700734250203999069672146446", "18374686479688400895", "1" }
 };
 
 DO_BINOP_TEST(integer,cl_I,cl_I,gcd)