X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=check%2Fexam_misc.cpp;h=3b2ff8eac6679bb9b3271b5ae1b3d599f55655bc;hp=f8a52578c1005b59c758b9ea438a131014dcb872;hb=fcc1f605535081bfcee74dc1a154839e10b807ef;hpb=5fd76b00944f1dbb239b3c1baf69b016b46c1888;ds=inline diff --git a/check/exam_misc.cpp b/check/exam_misc.cpp index f8a52578..3b2ff8ea 100644 --- a/check/exam_misc.cpp +++ b/check/exam_misc.cpp @@ -72,6 +72,23 @@ static unsigned exam_expand_subs2(void) return result; } +static unsigned exam_expand_power(void) +{ + unsigned result = 0; + symbol x("x"), a("a"), b("b"); + ex e; + + e = pow(x,pow(a+b,2)-pow(a,2)-pow(b,2)-a*b*2).expand(); + + if (e != 1) { + clog << "e = pow(x,pow(a+b,2)-pow(a,2)-pow(b,2)-a*b*2).expand(); erroneously returned " + << e << " instead of simplifying to 1." << endl; + ++result; + } + + return result; +} + unsigned exam_misc(void) { unsigned result = 0; @@ -81,6 +98,7 @@ unsigned exam_misc(void) result += exam_expand_subs(); cout << '.' << flush; result += exam_expand_subs2(); cout << '.' << flush; + result += exam_expand_power(); cout << '.' << flush; if (!result) { cout << " passed " << endl;