X-Git-Url: https://ginac.de/ginac.git//ginac.git?a=blobdiff_plain;ds=inline;f=check%2Fexam_lsolve.cpp;h=2c1c063e2b9a0f517a93ab56f0a5208f27108291;hb=8bf0597dde55e4c94a2ff39f1d8130902e3d7a9b;hp=cafda13a8ecec1f7bac8b9ddf17909a721b0c186;hpb=af922d5eb36ed70e4a9e3ffaf4c24492cf89a1a6;p=ginac.git diff --git a/check/exam_lsolve.cpp b/check/exam_lsolve.cpp index cafda13a..2c1c063e 100644 --- a/check/exam_lsolve.cpp +++ b/check/exam_lsolve.cpp @@ -3,7 +3,7 @@ * These exams test solving small linear systems of symbolic equations. */ /* - * GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2009 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 @@ -17,12 +17,16 @@ * * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "exams.h" +#include "ginac.h" +using namespace GiNaC; -static unsigned exam_lsolve1(void) +#include +using namespace std; + +static unsigned exam_lsolve1() { // A trivial example. unsigned result = 0; @@ -34,13 +38,13 @@ static unsigned exam_lsolve1(void) if (aux != 1) { ++result; clog << "solution of 3*x+5==8 erroneously returned " - << aux << endl; + << aux << endl; } return result; } -static unsigned exam_lsolve2a(void) +static unsigned exam_lsolve2a() { // An example from the Maple online help. unsigned result = 0; @@ -62,13 +66,13 @@ static unsigned exam_lsolve2a(void) !normal(sol_y - (3-a*b)/(a+b)).is_zero()) { ++result; clog << "solution of the system " << eqns << " for " << vars - << " erroneously returned " << sol << endl; + << " erroneously returned " << sol << endl; } return result; } -static unsigned exam_lsolve2b(void) +static unsigned exam_lsolve2b() { // A boring example from Mathematica's online help. unsigned result = 0; @@ -90,13 +94,13 @@ static unsigned exam_lsolve2b(void) (sol_y != numeric(-10,17))) { ++result; clog << "solution of the system " << eqns << " for " << vars - << " erroneously returned " << sol << endl; + << " erroneously returned " << sol << endl; } return result; } -static unsigned exam_lsolve2c(void) +static unsigned exam_lsolve2c() { // A more interesting example from the Maple online help. unsigned result = 0; @@ -118,13 +122,13 @@ static unsigned exam_lsolve2c(void) (sol_y != numeric(-1,2))) { ++result; clog << "solution of the system " << eqns << " for " << vars - << " erroneously returned " << sol << endl; + << " erroneously returned " << sol << endl; } return result; } -static unsigned exam_lsolve2S(void) +static unsigned exam_lsolve2S() { // A degenerate example that went wrong in GiNaC 0.6.2. unsigned result = 0; @@ -146,13 +150,13 @@ static unsigned exam_lsolve2S(void) (sol_y != t)) { ++result; clog << "solution of the system " << eqns << " for " << vars - << " erroneously returned " << sol << endl; + << " erroneously returned " << sol << endl; } return result; } -static unsigned exam_lsolve3S(void) +static unsigned exam_lsolve3S() { // A degenerate example that went wrong while trying to improve elimination unsigned result = 0; @@ -177,18 +181,17 @@ static unsigned exam_lsolve3S(void) (sol_z != (b+c)/2)) { ++result; clog << "solution of the system " << eqns << " for " << vars - << " erroneously returned " << sol << endl; + << " erroneously returned " << sol << endl; } return result; } -unsigned exam_lsolve(void) +unsigned exam_lsolve() { unsigned result = 0; cout << "examining linear solve" << flush; - clog << "----------linear solve:" << endl; result += exam_lsolve1(); cout << '.' << flush; result += exam_lsolve2a(); cout << '.' << flush; @@ -197,12 +200,10 @@ unsigned exam_lsolve(void) result += exam_lsolve2S(); cout << '.' << flush; result += exam_lsolve3S(); cout << '.' << flush; - if (!result) { - cout << " passed " << endl; - clog << "(no output)" << endl; - } else { - cout << " failed " << endl; - } - return result; } + +int main(int argc, char** argv) +{ + return exam_lsolve(); +}