]> www.ginac.de Git - ginac.git/blobdiff - check/pgcd_infinite_loop.cpp
pgcd(), chinrem_gcd(): use appropriate definition of the degree.
[ginac.git] / check / pgcd_infinite_loop.cpp
index 013b746afd39d23525ec0900a0f81efb7a7e5bb6..ae39f1d79a4e6d84e7c942b2f1611e1d87f68f8d 100644 (file)
@@ -26,12 +26,16 @@ static const string srep("\
 
 int main(int argc, char** argv)
 {
 
 int main(int argc, char** argv)
 {
-       cout << "Checking for more pgcd() bugs (infinite loop) ... " << flush;
+       cout << "Checking for more pgcd() bugs (infinite loop, miscalculation) ... " << flush;
        parser the_parser;
        ex e = the_parser(srep);
        const symbol x = ex_to<symbol>(the_parser.get_syms()["x"]);
        ex g = gcd(e, e.diff(x));
        parser the_parser;
        ex e = the_parser(srep);
        const symbol x = ex_to<symbol>(the_parser.get_syms()["x"]);
        ex g = gcd(e, e.diff(x));
+       ex should_be = the_parser(string("u^4*z^2"));
+       if (!(g-should_be).expand().is_zero()) {
+               cout << "GCD was miscomputed. " << flush;
+               return 1;
+       }
        cout << "not found. " << flush;
        cout << "not found. " << flush;
-       cout << g << endl << flush;
        return 0;
 }
        return 0;
 }