From 15c7209ed2f914cd3a40490c0e80e34307b1fead Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Thu, 29 Mar 2001 20:48:17 +0000 Subject: [PATCH] - introduced macros to shorten the source files - added exam_color() --- check/Makefile.am | 2 +- check/checks.cpp | 44 ++++------- check/exams.cpp | 104 ++++++-------------------- check/exams.h | 1 + check/exams.ref | 2 + check/times.cpp | 183 ++++++++-------------------------------------- 6 files changed, 68 insertions(+), 268 deletions(-) diff --git a/check/Makefile.am b/check/Makefile.am index bb9ef632..26ef2584 100644 --- a/check/Makefile.am +++ b/check/Makefile.am @@ -10,7 +10,7 @@ checks_LDADD = ../ginac/libginac.la exams_SOURCES = exam_paranoia.cpp exam_numeric.cpp exam_powerlaws.cpp \ exam_inifcns.cpp exam_differentiation.cpp exam_polygcd.cpp \ exam_normalization.cpp exam_pseries.cpp exam_matrices.cpp exam_lsolve.cpp \ - exam_indexed.cpp exam_misc.cpp exams.cpp exams.h + exam_indexed.cpp exam_color.cpp exam_misc.cpp exams.cpp exams.h exams_LDADD = ../ginac/libginac.la times_SOURCES = time_dennyfliegner.cpp time_gammaseries.cpp \ diff --git a/check/checks.cpp b/check/checks.cpp index 6f325d9e..6cfeaff8 100644 --- a/check/checks.cpp +++ b/check/checks.cpp @@ -31,38 +31,20 @@ int main() 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; \ +} - 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; - } + CHECK(numeric) + CHECK(inifcns) + CHECK(matrices) + CHECK(lsolve) if (result) { cout << "Error: something went wrong. "; diff --git a/check/exams.cpp b/check/exams.cpp index 385ed9a3..429bfc13 100644 --- a/check/exams.cpp +++ b/check/exams.cpp @@ -28,90 +28,28 @@ int main() { unsigned result = 0; + +#define EXAM(which) \ +try { \ + result += exam_ ## which (); \ +} catch (const exception &e) { \ + cout << "Error: caught exception " << e.what() << endl; \ + ++result; \ +} - try { - result += exam_paranoia(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += exam_numeric(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += exam_powerlaws(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += exam_inifcns(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += exam_differentiation(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += exam_polygcd(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += exam_normalization(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += exam_pseries(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += exam_matrices(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += exam_lsolve(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += exam_indexed(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += exam_misc(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } + EXAM(paranoia) + EXAM(numeric) + EXAM(powerlaws) + EXAM(inifcns) + EXAM(differentiation) + EXAM(polygcd) + EXAM(normalization) + EXAM(pseries) + EXAM(matrices) + EXAM(lsolve) + EXAM(indexed) + EXAM(color) + EXAM(misc) if (result) { cout << "Error: something went wrong. "; diff --git a/check/exams.h b/check/exams.h index 6677659d..94ae18a1 100644 --- a/check/exams.h +++ b/check/exams.h @@ -39,6 +39,7 @@ unsigned exam_pseries(); unsigned exam_matrices(); unsigned exam_lsolve(); unsigned exam_indexed(); +unsigned exam_color(); unsigned exam_misc(); #endif // ndef EXAMS_H diff --git a/check/exams.ref b/check/exams.ref index f9c4afb4..47d34012 100644 --- a/check/exams.ref +++ b/check/exams.ref @@ -20,5 +20,7 @@ (no output) ----------indexed objects: (no output) +----------color objects: +(no output) ----------miscellaneous other things: (no output) diff --git a/check/times.cpp b/check/times.cpp index 246a5123..7b6858be 100644 --- a/check/times.cpp +++ b/check/times.cpp @@ -29,159 +29,36 @@ int main() { unsigned result = 0; - try { - result += time_dennyfliegner(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_gammaseries(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_vandermonde(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_toeplitz(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_lw_A(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_lw_B(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_lw_C(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_lw_D(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_lw_E(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_lw_F(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_lw_G(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_lw_H(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_lw_IJKL(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_lw_M1(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_lw_M2(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_lw_N(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_lw_O(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_lw_P(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_lw_Pprime(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_lw_Q(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_lw_Qprime(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } - - try { - result += time_antipode(); - } catch (const exception &e) { - cout << "Error: caught exception " << e.what() << endl; - ++result; - } +#define TIME(which) \ +try { \ + result += time_ ## which (); \ +} catch (const exception &e) { \ + cout << "Error: caught exception " << e.what() << endl; \ + ++result; \ +} + + TIME(dennyfliegner) + TIME(gammaseries) + TIME(vandermonde) + TIME(toeplitz) + TIME(lw_A) + TIME(lw_B) + TIME(lw_C) + TIME(lw_D) + TIME(lw_E) + TIME(lw_F) + TIME(lw_G) + TIME(lw_H) + TIME(lw_IJKL) + TIME(lw_M1) + TIME(lw_M2) + TIME(lw_N) + TIME(lw_O) + TIME(lw_P) + TIME(lw_Pprime) + TIME(lw_Q) + TIME(lw_Qprime) + TIME(antipode) if (result) { cout << "Error: something went wrong. "; -- 2.44.0