]> www.ginac.de Git - ginac.git/blobdiff - check/paranoia_check.cpp
- introduced checks that test the new logic of sin, cos and tan to control
[ginac.git] / check / paranoia_check.cpp
index bc66deaf63db4736a8f4f64156c41d3a45efde50..f337060233d711414165700a63c3fbf49035b227 100644 (file)
@@ -1,11 +1,33 @@
-// check/paranoia_check.cpp
-
-/* This set of tests checks for some of GiNaC's oopses which showed up during
- * development.  Things were evaluated wrongly and so.  It should not find such
- * a sick behaviour again.  But since we are paranoic and we want to exclude
- * that behaviour for good... */
-
-#include "ginac.h"
+/** @file paranoia_check.cpp
+ *
+ *  This set of tests checks for some of GiNaC's oopses which showed up during
+ *  development.  Things were evaluated wrongly and so.  Such a sick behaviour
+ *  shouldn't occur any more.  But we are paranoic and we want to exclude these
+ *  these oopses for good, so we run those stupid tests... */
+
+/*
+ *  GiNaC Copyright (C) 1999 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
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <ginac/ginac.h>
+
+#ifndef NO_GINAC_NAMESPACE
+using namespace GiNaC;
+#endif // ndef NO_GINAC_NAMESPACE
 
 // The very first pair of historic problems had its roots in power.cpp and was
 // finally resolved on April 27th. (Fixing the first on April 23rd actually
@@ -21,7 +43,7 @@ static unsigned paranoia_check1(void)
     g = e / f;
 
     // In the first one expand did not do any job at all:
-    if ( !g.expand().is_equal(x) ) {
+    if (!g.expand().is_equal(x)) {
         clog << "e = x*y*z; f = y*z; expand(e/f) erroneously returned "
              << g.expand() << endl;
         ++result;
@@ -52,19 +74,19 @@ static unsigned paranoia_check2(void)
     g = f - e*y;
 
     // After .expand(), g should be zero:
-    if (!g.expand().is_equal(exZERO())) {
+    if (!g.expand().is_zero()) {
         clog << "e = (x + z*x); f = e*y; expand(f - e*y) erroneously returned "
              << g.expand() << endl;
         ++result;
     }
     // After .eval(), g should be zero:
-    if (!g.eval().is_equal(exZERO())) {
+    if (!g.eval().is_zero()) {
         clog << "e = (x + z*x); f = e*y; eval(f - e*y) erroneously returned "
              << g.eval() << endl;
         ++result;
     }
-    // This actually worked already back in April.  But we are very paranoic!
-    if (!g.expand().eval().is_equal(exZERO())) {
+    // This actually worked already back in April 1999.  But we are very paranoic!
+    if (!g.expand().eval().is_zero()) {
         clog << "e = (x + z*x); f = e*y; eval(expand(f - e*y)) erroneously returned "
              << g.expand().eval() << endl;
         ++result;
@@ -114,12 +136,12 @@ static unsigned paranoia_check4(void)
     f = pow(x, 2) + x + 1;
     g = e - f;
 
-    if (!g.is_equal(exZERO())) {
+    if (!g.is_zero()) {
         clog << "e = pow(x,2) + x + 1; f = pow(x,2) + x + 1; g = e-f; g erroneously returned "
              << g << endl;
         ++result;
     }
-    if (!g.is_equal(exZERO())) {
+    if (!g.is_zero()) {
         clog << "e = pow(x,2) + x + 1; f = pow(x,2) + x + 1; g = e-f; g.eval() erroneously returned "
              << g.eval() << endl;
         ++result;
@@ -138,7 +160,7 @@ static unsigned paranoia_check5(void)
     e = pow(x*y + 1, 2);
     f = pow(x, 2) * pow(y, 2) + 2*x*y + 1;
 
-    if (!(e-f).expand().is_equal(exZERO())) {
+    if (!(e-f).expand().is_zero()) {
         clog << "e = pow(x*y+1,2); f = pow(x,2)*pow(y,2) + 2*x*y + 1; (e-f).expand() erroneously returned "
              << (e-f).expand() << endl;
         ++result;
@@ -219,7 +241,7 @@ unsigned paranoia_check(void)
     result += paranoia_check7();
     result += paranoia_check8();
 
-    if (! result) {
+    if (!result) {
         cout << " passed ";
         clog << "(no output)" << endl;
     } else {