X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=check%2Fexam_paranoia.cpp;h=d5f65f8e5e644e94319f78349d512f01f5c74b33;hp=2817d18e6c14aa8ce6b3a803f2c92e0717088571;hb=708491c9e2df3690d58f1d93e4bd0506baeac103;hpb=d55314ec284f24063e949c5c3f3ee57011ddb283 diff --git a/check/exam_paranoia.cpp b/check/exam_paranoia.cpp index 2817d18e..d5f65f8e 100644 --- a/check/exam_paranoia.cpp +++ b/check/exam_paranoia.cpp @@ -522,6 +522,28 @@ static unsigned exam_paranoia20() return result; } +static unsigned is_polynomial_false_positive() +{ + unsigned result = 0; + symbol x("x"), n("n"); + exvector nonpoly_exprs; + nonpoly_exprs.push_back(1/(1-x)); + nonpoly_exprs.push_back(1/(x+1)); + nonpoly_exprs.push_back(-1/(x-1)); + nonpoly_exprs.push_back(1/(1-x*x)); + nonpoly_exprs.push_back(1/(1-pow(x,n))); + nonpoly_exprs.push_back(x-1/(x-1)); + for (exvector::const_iterator ep = nonpoly_exprs.begin(); + ep != nonpoly_exprs.end(); ++ep) { + if (ep->is_polynomial(x)) { + clog << "(" << *ep << ").is_polynomial(" << x << ") " + "erroneously returned true" << endl; + ++result; + } + } + return result; +} + unsigned exam_paranoia() { unsigned result = 0; @@ -548,6 +570,7 @@ unsigned exam_paranoia() result += exam_paranoia18(); cout << '.' << flush; result += exam_paranoia19(); cout << '.' << flush; result += exam_paranoia20(); cout << '.' << flush; + result += is_polynomial_false_positive(); cout << '.' << flush; return result; }