X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=check%2Fchecks.cpp;h=44299c770b91af11532818a4ed5cccf5e1fedb09;hp=b78273812e0701f13fe0b1657d898560b182a0e6;hb=2dcbb3a4955e294d62b45c3db8bdccb7d6fdf833;hpb=db5765dc91202851739e196ba11bfccb0b3fe7bc diff --git a/check/checks.cpp b/check/checks.cpp index b7827381..44299c77 100644 --- a/check/checks.cpp +++ b/check/checks.cpp @@ -3,7 +3,7 @@ * Main program that calls the individual tests. */ /* - * GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2002 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 @@ -21,59 +21,40 @@ */ #include -#include #include #include "checks.h" int main() { - unsigned result = 0; - - srand((unsigned)time(NULL)); - - try { - for (int i=0; i<1; ++i) - result += check_numeric(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - for (int i=0; i<1; ++i) - result += check_inifcns(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - for (int i=0; i<1; ++i) - result += check_matrices(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - for (int i=0; i<1; ++i) - result += check_lsolve(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - if (result) { - cout << "Error: something went wrong. "; - if (result == 1) { - cout << "(one failure)" << endl; - } else { - cout << "(" << result << " individual failures)" << endl; - } - cout << "please check checks.out against check.ref for more details." - << endl << "happy debugging!" << endl; - } - - return result; + unsigned result = 0; + + srand((unsigned)time(NULL)); + +#define CHECK(which) \ +try { \ + for (int i=0; i<1; ++i) \ + result += check_ ## which (); \ +} catch (const exception &e) { \ + cout << "Error: caught exception " << e.what() << endl; \ + ++result; \ +} + + CHECK(numeric) + CHECK(inifcns) + CHECK(matrices) + CHECK(lsolve) + + if (result) { + cout << "Error: something went wrong. "; + if (result == 1) { + cout << "(one failure)" << endl; + } else { + cout << "(" << result << " individual failures)" << endl; + } + cout << "please check checks.out against check.ref for more details." + << endl << "happy debugging!" << endl; + } + + return result; }