]> www.ginac.de Git - ginac.git/blobdiff - check/poly_gcd.cpp
- Made configure warn a lot when readline-stuff couldn't be found.
[ginac.git] / check / poly_gcd.cpp
index 484eb2d27c93aebfd8e7224e14693ee8fe1f4aab..0e6780c81f65b49362666ce194f5f392f3f9c200 100644 (file)
@@ -4,7 +4,7 @@
  *  rational function normalization in normalization.cpp. */
 
 /*
- *  GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include <ginac/ginac.h>
+#include "ginac.h"
+
+#ifndef NO_NAMESPACE_GINAC
 using namespace GiNaC;
+#endif // ndef NO_NAMESPACE_GINAC
 
 const int MAX_VARIABLES = 5;
 
@@ -43,7 +46,7 @@ static unsigned poly_gcd1(void)
                ex f = (e1 + 1) * (e1 + 2);
                ex g = e2 * (-pow(x, 2) * y[0] * 3 + pow(y[0], 2) - 1);
                ex r = gcd(f, g);
-               if (r != exONE()) {
+               if (r != 1) {
                        clog << "case 1, gcd(" << f << "," << g << ") = " << r << " (should be 1)" << endl;
                        return 1;
                }
@@ -65,11 +68,8 @@ static unsigned poly_gcd2(void)
                ex d = pow(e1 + 1, 2);
                ex f = d * pow(e2 - 2, 2);
                ex g = d * pow(e1 + 2, 2);
-               ex r = gcd(f, g);
-        ex re=r.expand();
-        ex df1=r-d;
-        ex df=(r-d).expand();
-               if ((r - d).expand().compare(exZERO()) != 0) {
+               ex r = gcd(f.expand(), g.expand());
+               if (!(r - d).expand().is_zero()) {
                        clog << "case 2, gcd(" << f << "," << g << ") = " << r << " (should be " << d << ")" << endl;
                        return 1;
                }
@@ -88,8 +88,8 @@ static unsigned poly_gcd3(void)
                ex d = e1 + 1;
                ex f = d * (e1 - 2);
                ex g = d * (e1 + 2);
-               ex r = gcd(f, g);
-               if ((r - d).expand().compare(exZERO()) != 0) {
+               ex r = gcd(f.expand(), g.expand());
+               if (!(r - d).expand().is_zero()) {
                        clog << "case 3, gcd(" << f << "," << g << ") = " << r << " (should be " << d << ")" << endl;
                        return 1;
                }
@@ -111,8 +111,8 @@ static unsigned poly_gcd3p(void)
                ex d = e1 + 1;
                ex f = d * (e1 - 2);
                ex g = d * (e2 + 2);
-               ex r = gcd(f, g);
-               if ((r - d).expand().compare(exZERO()) != 0) {
+               ex r = gcd(f.expand(), g.expand());
+               if (!(r - d).expand().is_zero()) {
                        clog << "case 3p, gcd(" << f << "," << g << ") = " << r << " (should be " << d << ")" << endl;
                        return 1;
                }
@@ -136,8 +136,8 @@ static unsigned poly_gcd4(void)
                ex d = e1 + 1;
                ex f = d * (e2 - 1);
                ex g = d * pow(e3 + 2, 2);
-               ex r = gcd(f, g);
-               if ((r - d).expand().compare(exZERO()) != 0) {
+               ex r = gcd(f.expand(), g.expand());
+               if (!(r - d).expand().is_zero()) {
                        clog << "case 4, gcd(" << f << "," << g << ") = " << r << " (should be " << d << ")" << endl;
                        return 1;
                }
@@ -161,8 +161,8 @@ static unsigned poly_gcd5(void)
                ex d = e1 - 3;
                ex f = d * (e2 + 3);
                ex g = d * (e3 - 3);
-               ex r = gcd(f, g);
-               if ((r - d).expand().compare(exZERO()) != 0) {
+               ex r = gcd(f.expand(), g.expand());
+               if (!(r - d).expand().is_zero()) {
                        clog << "case 5, gcd(" << f << "," << g << ") = " << r << " (should be " << d << ")" << endl;
                        return 1;
                }
@@ -181,8 +181,8 @@ static unsigned poly_gcd5p(void)
                ex d = e1 - 1;
                ex f = d * (e1 + 3);
                ex g = d * (e1 - 3);
-               ex r = gcd(f, g);
-               if ((r - d).expand().compare(exZERO()) != 0) {
+               ex r = gcd(f.expand(), g.expand());
+               if (!(r - d).expand().is_zero()) {
                        clog << "case 5p, gcd(" << f << "," << g << ") = " << r << " (should be " << d << ")" << endl;
                        return 1;
                }
@@ -199,8 +199,8 @@ static unsigned poly_gcd6(void)
                ex d = pow(x, j) * y * (z - 1);
                ex f = d * (pow(x, j) + pow(y, j + 1) * pow(z, j) + 1);
                ex g = d * (pow(x, j + 1) + pow(y, j) * pow(z, j + 1) - 7);
-               ex r = gcd(f, g);
-               if ((r - d).expand().compare(exZERO()) != 0) {
+               ex r = gcd(f.expand(), g.expand());
+               if (!(r - d).expand().is_zero()) {
                        clog << "case 6, gcd(" << f << "," << g << ") = " << r << " (should be " << d << ")" << endl;
                        return 1;
                }
@@ -221,7 +221,7 @@ static unsigned poly_gcd7(void)
                        ex f = pow(p, j) * pow(q, k);
                        ex g = pow(p, k) * pow(q, j); 
                        ex r = gcd(f, g);
-                       if ((r - d).expand().compare(exZERO()) != 0 && (r + d).expand().compare(exZERO()) != 0) {
+                       if (!(r - d).expand().is_zero() && !(r + d).expand().is_zero()) {
                                clog << "case 7, gcd(" << f << "," << g << ") = " << r << " (should be " << d << ")" << endl;
                                return 1;
                        }