From: Richard Kreckel Date: Sun, 18 Sep 2022 21:04:26 +0000 (+0200) Subject: Fix checks for sqrfree_parfrac(). X-Git-Tag: release_1-8-4~3 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=commitdiff_plain;h=79383e999a49c7fc001e10d70c8175cb1931d0a6;p=ginac.git Fix checks for sqrfree_parfrac(). --- diff --git a/check/exam_sqrfree.cpp b/check/exam_sqrfree.cpp index 3e94ed67..b9fc82a9 100644 --- a/check/exam_sqrfree.cpp +++ b/check/exam_sqrfree.cpp @@ -202,15 +202,15 @@ unsigned exam_sqrfree_parfrac() symbol x("x"); // (expression, number of terms after partial fraction decomposition) vector> exams = { - {ex("(x - 1) / (x*(x^2 + 2))", lst{x}), 2}, + {ex("(x - 1) / (x^2*(x^2 + 2))", lst{x}), 3}, {ex("(1 - x^10) / x", lst{x}), 2}, {ex("(2*x^3 + x + 3) / ((x^2 + 1)^2)", lst{x}), 2}, - {ex("1 / (x * (x+1) * (x+2))", lst{x}), 3}, - {ex("(x*x + 3*x - 1) / (x^2*(x^2 + 2)^2)", lst{x}), 4}, + {ex("1 / (x * (x+1)^2 * (x+2)^3)", lst{x}), 6}, + {ex("(x*x + 3*x - 1) / (x^2*(x^2 + 2)^3)", lst{x}), 5}, {ex("(1 - x^10) / (x + 2)", lst{x}), 11}, {ex("(1 - x + 3*x^2) / (x^3 * (2+x)^2)", lst{x}), 5}, {ex("(1 - x) / (x^4 * (x - 2)^3)", lst{x}), 6}, - {ex("(1 - 2*x + x^9) / (x^5 * (1 - x + x^2)^5)", lst{x}), 12} + {ex("(1 - 2*x + x^9) / (x^5 * (1 - x + x^2)^6)", lst{x}), 11} }; unsigned result = 0; @@ -219,7 +219,8 @@ unsigned exam_sqrfree_parfrac() for (auto e: exams) { ex e1 = e.first; ex e2 = sqrfree_parfrac(e1, x); - if (e2.nops() != e.second && + if (e2.nops() != e.second || + !is_a(e2) || !normal(e1-e2).is_zero()) { clog << "sqrfree_parfrac(" << e1 << ", " << x << ") erroneously returned " << e2 << endl;