Rename test suite files...
authorRichard Kreckel <kreckel@ginac.de>
Mon, 12 Oct 2020 18:42:49 +0000 (20:42 +0200)
committerRichard Kreckel <kreckel@ginac.de>
Mon, 12 Oct 2020 22:10:13 +0000 (00:10 +0200)
...to match any of the three types:
exam*   test result for specific input (like a pupil's exam)
check*  test coherence of results among each other, for random input
time*   measure run-time

All tests are still there, but maybe elsewhere:
* rename match_bug.cpp => exam_match.cpp
* rename heur_gcd_bug.cpp => exam_heur_gcd.cpp
* rename bugme_chinrem_gcd.cpp => exam_chinrem_gcd.cpp
* rename parser_bugs.cpp => exam_parser.cpp
* rename exam_cra.cpp => check_cra.cpp
* include numeric_archive.cpp => exam_archive.cpp
* include pgcd_infinite_loop.cpp => exam_pgcd.cpp
* include pgcd_relatively_prime_bug.cpp => exam_pgcd.cpp

These two have been deleted, since memory leaks are best looked for
using tools on real programs on a regular basis (they were also not
automatically executed):
* delete parser_memleak.cpp
* delete mul_eval_memleak.cpp

15 files changed:
check/.gitignore
check/CMakeLists.txt
check/Makefile.am
check/check_cra.cpp [moved from check/exam_cra.cpp with 100% similarity]
check/exam_archive.cpp
check/exam_chinrem_gcd.cpp [moved from check/bugme_chinrem_gcd.cpp with 98% similarity]
check/exam_heur_gcd.cpp [moved from check/heur_gcd_bug.cpp with 93% similarity]
check/exam_match.cpp [moved from check/match_bug.cpp with 97% similarity]
check/exam_parser.cpp [moved from check/parser_bugs.cpp with 73% similarity]
check/exam_pgcd.cpp [new file with mode: 0644]
check/mul_eval_memleak.cpp [deleted file]
check/numeric_archive.cpp [deleted file]
check/parser_memleak.cpp [deleted file]
check/pgcd_infinite_loop.cpp [deleted file]
check/pgcd_relatively_prime_bug.cpp [deleted file]

index 341eaf9c675eca0072e9332c3b6e6b201dd486b8..c9cd5f25ea1b344245b8fddedbe051090fdd774a 100644 (file)
@@ -1,40 +1,40 @@
 .libs/
 *.log
 *.trs
-bugme_chinrem_gcd
-check_inifcns
-check_lsolve
-check_matrices
-check_numeric
 exam.gar
 exam_archive
 exam_clifford
 exam_color
-exam_cra
 exam_differentiation
 exam_factor
 exam_heur_gcd
 exam_indexed
 exam_inifcns
 exam_inifcns_nstdsums
+exam_inifcns_elliptic
 exam_lsolve
 exam_matrices
 exam_misc
+exam_pgcd
 exam_mod_gcd
 exam_normalization
 exam_sqrfree
 exam_numeric
-exam_numeric_archive
 exam_paranoia
 exam_polygcd
+exam_collect_common_factors
 exam_powerlaws
 exam_pseries
+exam_chinrem_gcd
 exam_real_imag
 exam_structure
-match_bug
-parser_bugs
-pgcd_infinite_loop
-pgcd_relatively_prime_bug
+exam_match
+exam_parser
+check_inifcns
+check_lsolve
+check_matrices
+check_numeric
+check_cra
 time_antipode
 time_dennyfliegner
 time_fateman_expand
index 6b8bd340ac48747fd6ca71f846f52537da7c7b32..a480e7c87ed122e60c78c2213356aa66498d41e8 100644 (file)
@@ -4,12 +4,11 @@ set(ginac_tests
        check_inifcns
        check_matrices
        check_lsolve
-       heur_gcd_bug
+       check_cra
        exam_paranoia
        exam_heur_gcd
-       match_bug
-       parser_bugs
-       exam_numeric_archive
+       exam_match
+       exam_parser
        exam_numeric
        exam_powerlaws
        exam_inifcns
@@ -30,12 +29,10 @@ set(ginac_tests
        exam_archive
        exam_structure
        exam_misc
+       exam_pgcd
        exam_mod_gcd
-       exam_cra
        exam_real_imag
-       bugme_chinrem_gcd
-       pgcd_relatively_prime_bug
-       pgcd_infinite_loop)
+       exam_chinrem_gcd)
 
 set(ginac_timings
        time_dennyfliegner
@@ -83,8 +80,6 @@ endmacro()
 
 set(check_matrices_extra_src genex.cpp)
 set(check_lsolve_extra_src genex.cpp)
-set(exam_heur_gcd_sources heur_gcd_bug.cpp)
-set(exam_numeric_archive_sources numeric_archive.cpp)
 
 foreach(tst ${ginac_tests})
        add_ginac_test(${tst})
index d1881520f2702efb73bad022c7ab61ab43fe98ab..a1fb19df78f8466bb886accc31daadc57f84c29c 100644 (file)
@@ -3,38 +3,36 @@
 CHECKS = check_numeric \
         check_inifcns \
         check_matrices \
-        check_lsolve 
+        check_lsolve \
+        check_cra
 
 EXAMS = exam_paranoia \
        exam_heur_gcd \
-       match_bug \
-       parser_bugs \
-       exam_numeric_archive \
+       exam_match \
+       exam_parser \
        exam_numeric \
-       exam_powerlaws  \
+       exam_powerlaws \
        exam_inifcns \
        exam_inifcns_nstdsums \
        exam_inifcns_elliptic \
        exam_differentiation  \
-       exam_polygcd  \
+       exam_polygcd \
        exam_collect_common_factors \
-       exam_normalization  \
+       exam_normalization \
        exam_sqrfree  \
        exam_factor \
        exam_pseries  \
        exam_matrices  \
        exam_lsolve  \
        exam_indexed  \
-       exam_color  \
+       exam_color \
        exam_clifford  \
        exam_archive  \
        exam_structure  \
        exam_misc \
+       exam_pgcd \
        exam_mod_gcd \
-       bugme_chinrem_gcd \
-       pgcd_relatively_prime_bug \
-       pgcd_infinite_loop \
-       exam_cra \
+       exam_chinrem_gcd \
        exam_real_imag
 
 TIMES = time_dennyfliegner \
@@ -78,20 +76,20 @@ check_matrices_LDADD = ../ginac/libginac.la
 check_lsolve_SOURCES = check_lsolve.cpp genex.cpp
 check_lsolve_LDADD = ../ginac/libginac.la
 
+check_cra_SOURCES = check_cra.cpp
+check_cra_LDADD = ../ginac/libginac.la
+
 exam_paranoia_SOURCES = exam_paranoia.cpp
 exam_paranoia_LDADD = ../ginac/libginac.la
 
-exam_heur_gcd_SOURCES = heur_gcd_bug.cpp 
+exam_heur_gcd_SOURCES = exam_heur_gcd.cpp
 exam_heur_gcd_LDADD = ../ginac/libginac.la
 
-match_bug_SOURCES = match_bug.cpp error_report.h
-match_bug_LDADD = ../ginac/libginac.la
-
-parser_bugs_SOURCES = parser_bugs.cpp
-parser_bugs_LDADD = ../ginac/libginac.la
+exam_match_SOURCES = exam_match.cpp error_report.h
+exam_match_LDADD = ../ginac/libginac.la
 
-exam_numeric_archive_SOURCES = numeric_archive.cpp
-exam_numeric_archive_LDADD = ../ginac/libginac.la
+exam_parser_SOURCES = exam_parser.cpp
+exam_parser_LDADD = ../ginac/libginac.la
 
 exam_numeric_SOURCES = exam_numeric.cpp
 exam_numeric_LDADD = ../ginac/libginac.la
@@ -154,15 +152,18 @@ exam_structure_LDADD = ../ginac/libginac.la
 exam_misc_SOURCES = exam_misc.cpp
 exam_misc_LDADD = ../ginac/libginac.la
 
+exam_pgcd_SOURCES = exam_pgcd.cpp
+exam_pgcd_LDADD = ../ginac/libginac.la
+
 exam_mod_gcd_SOURCES = exam_mod_gcd.cpp
 exam_mod_gcd_LDADD = ../ginac/libginac.la
 
-exam_cra_SOURCES = exam_cra.cpp
-exam_cra_LDADD = ../ginac/libginac.la
-
 exam_real_imag_SOURCES = exam_real_imag.cpp
 exam_real_imag_LDADD = ../ginac/libginac.la
 
+exam_chinrem_gcd_SOURCES = exam_chinrem_gcd.cpp
+exam_chinrem_gcd_LDADD = ../ginac/libginac.la
+
 time_dennyfliegner_SOURCES = time_dennyfliegner.cpp \
                             randomize_serials.cpp timer.cpp timer.h
 time_dennyfliegner_LDADD = ../ginac/libginac.la
@@ -262,15 +263,6 @@ time_parser_SOURCES = time_parser.cpp \
                      randomize_serials.cpp timer.cpp timer.h
 time_parser_LDADD = ../ginac/libginac.la
 
-bugme_chinrem_gcd_SOURCES = bugme_chinrem_gcd.cpp
-bugme_chinrem_gcd_LDADD = ../ginac/libginac.la
-
-pgcd_relatively_prime_bug_SOURCES = pgcd_relatively_prime_bug.cpp
-pgcd_relatively_prime_bug_LDADD = ../ginac/libginac.la
-
-pgcd_infinite_loop_SOURCES =  pgcd_infinite_loop.cpp
-pgcd_infinite_loop_LDADD =  ../ginac/libginac.la
-
 AM_CPPFLAGS = -I$(srcdir)/../ginac -I../ginac -DIN_GINAC
 
 CLEANFILES = exam.gar
similarity index 100%
rename from check/exam_cra.cpp
rename to check/check_cra.cpp
index 10ed3ffb2d8f72d72f5af431d3778f99fd4b736e..0abc752183e67c512dac67b2e577b3e837a1fca1 100644 (file)
@@ -27,12 +27,13 @@ using namespace GiNaC;
 #include <iostream>
 using namespace std;
 
+#include <cln/cln.h>
+
+
 unsigned exam_archive()
 {
        unsigned result = 0;
        
-       cout << "examining archiving system" << flush;
-
        symbol x("x"), y("y"), mu("mu"), dim("dim", "\\Delta");
        ex e, f;
 
@@ -76,7 +77,49 @@ unsigned exam_archive()
        return result;
 }
 
+/** numeric::archive used to fail if the real part of a complex number
+ *  is a rational number and the imaginary part is a floating point one. */
+unsigned numeric_complex_bug()
+{
+       using namespace cln;
+       struct archive_unarchive_check
+       {
+               unsigned operator()(const cl_N& n) const
+               {
+                       ex e = numeric(n);
+                       archive ar;
+                       ar.archive_ex(e, "test");
+                       ex check = ar.unarchive_ex(lst{}, "test");
+                       if (!check.is_equal(e)) {
+                               clog << __FILE__ << ':' << __LINE__ << ": expected: " << e << ", got " << check << endl;
+                               return 1;
+                       }
+                       return 0;
+               }
+       } checker;
+       unsigned result = 0;
+       const cl_I one(1);
+       const cl_R three_fp = cl_float(3.0);
+       std::vector<cl_N> numbers = {
+               complex(one, one),
+               complex(one, three_fp),
+               complex(three_fp, one),
+               complex(three_fp, three_fp)
+       };
+       for (auto & n : numbers) {
+               result += checker(n);
+       }
+       return result;
+}
+
 int main(int argc, char** argv)
 {
-       return exam_archive();
+       unsigned result = 0;
+
+       cout << "examining archiving system" << flush;
+
+       result += exam_archive();  cout << '.' << flush;
+       result += numeric_complex_bug();  cout << '.' << flush;
+
+       return result;
 }
similarity index 98%
rename from check/bugme_chinrem_gcd.cpp
rename to check/exam_chinrem_gcd.cpp
index 0bdcc93a66beb3895a7e6ed6d5d0991898955bb6..e67098d70edd979e4a0cde7636379f005ee9c314 100644 (file)
@@ -1,4 +1,4 @@
-/** @file bugme_chinrem_gcd.cpp
+/** @file exam_chinrem_gcd.cpp
  *
  * A small program exposing historical bug in poly_cra function. */
 
@@ -68,7 +68,7 @@ static void integer_coeff_braindamage()
 
 int main(int argc, char** argv)
 {
-       cout << "checking for bugs in poly_cra() and friends " << flush;
+       cout << "examining in poly_cra() and friends " << flush;
        check_poly_cra();
        check_extract_integer_content();
        integer_coeff_braindamage();
similarity index 93%
rename from check/heur_gcd_bug.cpp
rename to check/exam_heur_gcd.cpp
index 736b9c029f7b9446e1a8245d3e7d0b1f57ff8e68..4daa09a0a746c7d96e708828e154e06eb41c7b01 100644 (file)
@@ -1,6 +1,6 @@
 /** @file heur_gcd_bug.cpp
  *
- *  heur_gcd_oops.cpp Check for a bug in heur_gcd().
+ *  exam_heur_gcd.cpp Check for a bug in heur_gcd().
  *
  *  heur_gcd() did not check if the arguments are integer polynomials
  *  (and did not convert them to integer polynomials), which lead to
@@ -32,7 +32,7 @@ using namespace std;
 
 int main(int argc, char** argv)
 {
-       cout << "checking if heur_gcd() can cope with rational polynomials. ";
+       cout << "examining if heur_gcd() can cope with rational polynomials. ";
        const symbol x("x");
        const ex _ex1(1);
        ex a1 = x + numeric(5, 4);
similarity index 97%
rename from check/match_bug.cpp
rename to check/exam_match.cpp
index ecce6e2b4c0df14d104ff5c10880f2fad3d6bb9a..4049af877e0f4fbf8fecf06c5d40ac90becce521 100644 (file)
@@ -1,4 +1,4 @@
-/** @file match_bug.cpp
+/** @file exam_match.cpp
  *
  *  Check for bug in GiNaC::ex::match() described here:
  *  https://www.ginac.de/pipermail/ginac-devel/2006-April/000942.html */
@@ -117,7 +117,7 @@ static void expairseq_match_false_negative(int count)
 int main(int argc, char** argv)
 {
        const int repetitions = 100;
-       std::cout << "checking for historical bugs in match()... " << std::flush;
+       std::cout << "examining historical bugs in match()... " << std::flush;
        failed_match_have_side_effects();
        match_false_negative();
        expairseq_failed_match_no_side_effect(repetitions);
similarity index 73%
rename from check/parser_bugs.cpp
rename to check/exam_parser.cpp
index 6a5f2fe4af15439042be98e5d2f4b26e0c94ded1..25c0b383d608b7fc6958e1165216fc09f1ec5482 100644 (file)
@@ -28,10 +28,12 @@ using namespace GiNaC;
 #include <stdexcept>
 #include <string>
 
+using namespace std;
+
 // - a - b was misparsed as -a + b due to a bug in parser::parse_unary_expr()
-static int check1(std::ostream& err_str)
+static int check1(ostream& err_str)
 {
-       const std::string srep("-a-b");
+       const string srep("-a-b");
        parser reader;
        ex e = reader(srep);
        ex a = reader.get_syms()["a"];
@@ -40,16 +42,16 @@ static int check1(std::ostream& err_str)
        ex d = (e - g).expand();
        if (!d.is_zero()) {
                err_str << "\"" << srep << "\" was misparsed as \""
-                       << e << "\"" << std::endl;
+                       << e << "\"" << endl;
                return 1;
        }
        return 0;
 }
 
 /// Parser was rejecting the valid expression '5 - (3*x)/10'.
-static int check2(std::ostream& err_str)
+static int check2(ostream& err_str)
 {
-       const std::string srep("5-(3*x)/10");
+       const string srep("5-(3*x)/10");
        parser reader;
        ex e = reader(srep);
        ex x = reader.get_syms()["x"];
@@ -57,7 +59,7 @@ static int check2(std::ostream& err_str)
        ex d = (e - g).expand();
        if (!d.is_zero()) {
                err_str << "\"" << srep << "\" was misparsed as \""
-                       << e << "\"" << std::endl;
+                       << e << "\"" << endl;
                return 1;
        }
        return 0;
@@ -65,30 +67,30 @@ static int check2(std::ostream& err_str)
 
 /// parse_literal_expr forget to consume the token, so parser get
 /// very confused.
-static int check3(std::ostream& err_str)
+static int check3(ostream& err_str)
 {
-       const std::string srep("5-(2*I)/3");
+       const string srep("5-(2*I)/3");
        parser reader;
        ex e = reader(srep);
        ex g = numeric(5) - (numeric(2)*I)/3;
        ex d = (e - g).expand();
        if (!d.is_zero()) {
                err_str << "\"" << srep << "\" was misparsed as \""
-                       << e << "\"" << std::endl;
+                       << e << "\"" << endl;
                return 1;
        }
        return 0;
 }
 
 /// parser happily accepted various junk like 'x^2()+1'
-static int check4(std::ostream& err_str)
+static int check4(ostream& err_str)
 {
-       const std::string junk("x^2()+1");
+       const string junk("x^2()+1");
        parser reader;
        ex e;
        try {
                e = reader(junk);
-               err_str << "parser accepts junk: \"" << junk << "\"" << std::endl;
+               err_str << "parser accepts junk: \"" << junk << "\"" << endl;
                return 1;
        } catch (parse_error& err) {
                // Ok, parser rejects the nonsense.
@@ -98,18 +100,18 @@ static int check4(std::ostream& err_str)
 
 int main(int argc, char** argv)
 {
-       std::cout << "checking for parser bugs. " << std::flush;
-       std::ostringstream err_str;
+       cout << "examining old parser bugs" << flush;
+       ostringstream err_str;
        int errors = 0;
-       errors += check1(err_str);
-       errors += check2(err_str);
-       errors += check3(err_str);
-       errors += check4(err_str);
+       errors += check1(err_str);  cout << '.' << flush;
+       errors += check2(err_str);  cout << '.' << flush;
+       errors += check3(err_str);  cout << '.' << flush;
+       errors += check4(err_str);  cout << '.' << flush;
        if (errors) {
-               std::cout << "Yes, unfortunately:" << std::endl;
-               std::cout << err_str.str();
+               cout << "Yes, unfortunately:" << endl;
+               cout << err_str.str();
        } else {
-               std::cout << "Not found. ";
+               cout << "Not found. ";
        }
        return errors;
 }
diff --git a/check/exam_pgcd.cpp b/check/exam_pgcd.cpp
new file mode 100644 (file)
index 0000000..0d61c6e
--- /dev/null
@@ -0,0 +1,68 @@
+/** @file exam_pgcd.cpp
+ *
+ * Exam GCD over prime fields computations.
+ */
+#include <string>
+#include <iostream>
+#include <utility>
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
+
+// Check for an infite loop in PGCD, fixed 2010-02-23.
+static unsigned pgcd_relatively_prime_bug()
+{
+       const symbol q("q");
+       parser reader;
+       reader.get_syms().insert(make_pair(string("q"), q));
+
+       ex t = reader("-E20^16*E4^8*E5^8*E1^16*q^4"
+                     "-(E10^24-E20^8*E5^16)*E4^16*E1^8"
+                     "+E2^24*E20^16*E5^8*q^4");
+       ex g = gcd(t.expand(), t.diff(q).expand()) - 1;
+       if (!g.is_zero()) {
+               clog << " oops!" << endl <<
+                       "** Error: should be 0, got " << g << endl;
+               return 1;
+       }
+       return 0;
+}
+
+// Check for an infinite loop in PGCD, fixed 2010-03-18.
+static unsigned pgcd_infinite_loop()
+{
+       parser the_parser;
+       ex e = the_parser(string(R"ex(792*z^8*w^4*x^3*y^4*u^7
++ 24*z^4*w^4*x^2*y^3*u^4 + 264*z^8*w^3*x^2*y^7*u^5 + 198*z^4*w^5*x^5*y*u^6
++ 110*z^2*w^3*x^5*y^4*u^6 - 120*z^8*w*x^4*u^6 - 480*z^5*w*x^4*y^6*u^8
+- 720*z^7*x^3*y^3*u^7 + 165*z^4*w^2*x^4*y*u^5 + 450*z^8*w^6*x^2*y*u^8
++ 40*z^2*w^3*x^3*y^3*u^6 - 288*z^7*w^2*x^3*y^6*u^6 + 250*z^6*w^4*x^2*y^4*u^8
++ 576*z^7*w^7*x^2*y^4*u^8 - 80*z^6*w^2*x^5*y^3*u^7 - 144*z^8*w^4*x^5*u^7
++ 120*z^4*w*x^2*y^6*u^6 + 320*z^5*w^5*x^2*y^7*u^8 + 192*z^7*w^6*x*y^7*u^6
+- 12*z^4*w^3*x^3*y^5*u^6 - 36*z^4*w^4*x^4*y^2*u^8 + 72*z^4*w^5*x^3*u^6
+- 20*z^2*w^2*x^4*y^5*u^8 + 660*z^8*w*x^2*y^4*u^6 + 66*z^4*w^4*x^4*y^4*u^4
++ 440*z^6*w^2*x^3*y^7*u^7 - 30*z^4*w*x^3*y^2*u^7 - 48*z^8*w^3*x^4*y^3*u^5
++ 72*z^6*w^2*x*y^6*u^4 - 864*z^7*w^3*x^4*y^3*u^8 + 480*z^7*w^4*x*y^4*u^7
++ 60*z^4*w^2*x^2*u^5 + 375*z^8*w^3*x*y*u^7 + 150*z^8*w^5*x*y^4*u^6
++ 180*z^6*x*y^3*u^5 + 216*z^6*w^3*x^2*y^3*u^6)ex"));
+       const symbol x = ex_to<symbol>(the_parser.get_syms()["x"]);
+       ex g = gcd(e, e.diff(x));
+       ex should_be = the_parser(string("u^4*z^2"));
+       if (!(g-should_be).expand().is_zero()) {
+               clog << "GCD was miscomputed. " << endl;
+               return 1;
+       }
+       return 0;
+}
+
+int main()
+{
+       unsigned result = 0;
+
+       cout << "Examining pgcd() bugs (infinite loop, miscalculation)" << flush;
+
+       result += pgcd_relatively_prime_bug();  cout << '.' << flush;
+       result += pgcd_infinite_loop();  cout << '.' << flush;
+
+       return result;
+}
diff --git a/check/mul_eval_memleak.cpp b/check/mul_eval_memleak.cpp
deleted file mode 100644 (file)
index 0b79ce4..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/** @file mul_eval_memleak.cpp
- *
- *  mul_eval_memleak.cpp Test for memory leak in {mul,power}::eval
- *
- *  The bug was introduced by
- *
- *  commit f418c6ee4d558c852e1fb95533af07a3ae43f409
- *  Author: Alexei Sheplyakov <varg@theor.jinr.ru>
- *  Date:   Wed Jul 11 14:34:42 2007 +0400
- *  (it was commited into the official branch as
- *  commit a602d34c225dceb3e53742a7b3e19a4b5e280485
- *  Author: Jens Vollinga <vollinga@thep.physik.uni-mainz.de>
- *  Date:   Wed Jul 11 21:07:40 2007 +0000)
- */
-
-/*
- *  GiNaC Copyright (C) 1999-2020 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#include <ginac/ginac.h>
-using namespace GiNaC;
-
-#include <iostream>
-#include <stdexcept>
-#include <string>
-using namespace std;
-
-const unsigned check_mul_eval_memleak(const unsigned N)
-{
-       // Expanding this expression into a Laurent series triggers the bug.
-       static const string e_str("\
-1/605927415293858601*tgamma(3-eps)^(-1)*tgamma(2-eps)*(5013234896802\
-*(-1+2*eps)*((-2539001/2)*eps^(-2)+(-7617003/2+1692800*log(920*scale\
-^(-1))+3385202*log(1301*scale^(-1)))*eps^(-1)+F)+(846400+2539001*eps\
-)*(2539001*(-1+2*eps)*((-2539001/2)*eps^(-2)+(-7617003/2+1692800*log\
-(920*scale^(-1))+3385202*log(1301*scale^(-1)))*eps^(-1)+F)+286523497\
-2800*(-1+eps)^(-1)*eps^(-2)*(920*scale^(-1))^(-2*eps)*(1301*scale^(-\
-1))^(-2*eps)*tgamma(1+eps)^2)+6061411748045832000*(-1+eps)^(-1)*eps^\
-(-2)*(920*scale^(-1))^(-2*eps)*(1301*scale^(-1))^(-2*eps)*tgamma(1+e\
-ps)^2+716056132401*((-2539001/2)*eps^(-2)+(-7617003/2+1692800*log(92\
-0*scale^(-1))+3385202*log(1301*scale^(-1)))*eps^(-1)+F))+71656139360\
-0/716056132401*tgamma(1-eps)*tgamma(2*eps)^(-1)*tgamma(eps)^2*tgamma\
-(3-eps)^(-1)*(920*scale^(-1))^(-4*eps)*tgamma(-1+2*eps)-2/6059274152\
-93858601*tgamma(3-eps)^(-1)*(2149010446400*(-1+2*eps)*((-2539001/2)*\
-eps^(-2)+(-7617003/2+1692800*log(920*scale^(-1))+3385202*log(1301*sc\
-ale^(-1)))*eps^(-1)+F)+2425134880977920000*(-1+eps)^(-1)*eps^(-2)*(9\
-20*scale^(-1))^(-2*eps)*(1301*scale^(-1))^(-2*eps)*tgamma(1+eps)^2-7\
-16056132401*((-2539001/2)*eps^(-2)+(-7617003/2+1692800*log(920*scale\
-^(-1))+3385202*log(1301*scale^(-1)))*eps^(-1)+F)+1692601*(-1+2*eps)*\
-(2539001*(-1+2*eps)*((-2539001/2)*eps^(-2)+(-7617003/2+1692800*log(9\
-20*scale^(-1))+3385202*log(1301*scale^(-1)))*eps^(-1)+F)+28652349728\
-00*(-1+eps)^(-1)*eps^(-2)*(920*scale^(-1))^(-2*eps)*(1301*scale^(-1)\
-)^(-2*eps)*tgamma(1+eps)^2))*tgamma(2-eps)+(1/716056132401*I)*tgamma\
-(-1+eps)*mb^2*(mb*scale^(-1))^(-2*eps)*((716392960000*I)*mb^(-2)*(92\
-0*scale^(-1))^(-2*eps)*tgamma(-2+eps)-(2864898145201*I)*mb^(-2)*(130\
-1*scale^(-1))^(-2*eps)*tgamma(-2+eps)-(716224526400*I)*tgamma(-1+eps\
-)*mb^(-2)*(920*scale^(-1))^(-2*eps))-3385202/605927415293858601*tgam\
-ma(3-eps)^(-1)*tgamma(2-eps)*(2539001*(-1+2*eps)*((-2539001/2)*eps^(\
--2)+(-7617003/2+1692800*log(920*scale^(-1))+3385202*log(1301*scale^(\
--1)))*eps^(-1)+F)+2865234972800*(-1+eps)^(-1)*eps^(-2)*(920*scale^(-\
-1))^(-2*eps)*(1301*scale^(-1))^(-2*eps)*tgamma(1+eps)^2+846201*((-25\
-39001/2)*eps^(-2)+(-7617003/2+1692800*log(920*scale^(-1))+3385202*lo\
-g(1301*scale^(-1)))*eps^(-1)+F))\
-");
-       const symbol eps("eps"), scale("scale"), mb("mb"), F("F");
-       const lst syms(eps, scale, mb, F);
-       const ex e0(e_str, syms);
-
-       unsigned i = 0;
-       unsigned n_failures = 0;
-
-       ex e;
-       try {
-               for (; i < N; i++)
-                       e = e0.series(eps, 1).subs(Euler==0).expand();
-       } catch (std::bad_alloc) {
-               return i;
-       }
-       return 0;
-}
-                       
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-
-static void set_VM_limit(const unsigned long MB) {
-       const unsigned mem_lim_kb = MB*1024*1024;
-       struct rlimit lim;
-       lim.rlim_cur = mem_lim_kb;
-       lim.rlim_max = mem_lim_kb;
-       setrlimit(RLIMIT_AS, &lim);
-}
-
-int main(int argc, char** argv) {
-       static const unsigned max_mem = 32; // megabytes
-       // otherwise one need wait for a long[er] time.
-       set_VM_limit(max_mem); 
-       static const unsigned n_of_tests = 10000;
-       const unsigned n_loops = check_mul_eval_memleak(n_of_tests);
-       if (n_loops) {
-               cerr << "memory exhausted after " << n_loops << " loops" << endl;
-               return 1;
-       }
-       return 0;
-}
diff --git a/check/numeric_archive.cpp b/check/numeric_archive.cpp
deleted file mode 100644 (file)
index 741dc02..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/** @file numeric_archive.cpp
- *
- *  Check for a bug in numeric::archive
- *
- *  numeric::archive used to fail if the real part of a complex number
- *  is a rational number and the imaginary part is a floating point one. */
-
-/*
- *  GiNaC Copyright (C) 1999-2020 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#include "ginac.h"
-using namespace GiNaC;
-
-#include <algorithm>
-#include <cln/cln.h>
-#include <iostream>
-#include <iterator>
-#include <sstream>
-#include <stdexcept>
-#include <vector>
-using namespace cln;
-
-struct archive_unarchive_check
-{
-       cl_N operator()(const cl_N& n) const
-       {
-               ex e = numeric(n);
-               archive ar;
-               ar.archive_ex(e, "test");
-               lst l;
-               ex check = ar.unarchive_ex(l, "test");
-               if (!check.is_equal(e)) {
-                       std::ostringstream s;
-                       s << __FILE__ << ':' << __LINE__ << ": expected: " << e << ", got " << check;
-                       throw std::logic_error(s.str());
-               }
-               return n;
-       }
-};
-
-int main(int argc, char** argv)
-{
-       const cl_I one(1);
-       std::cout << "checking if numeric::archive handles complex numbers properly" << std::endl;
-       const cl_R three_fp = cl_float(3.0, default_float_format);
-       std::vector<cl_N> numbers;
-       numbers.push_back(complex(one, three_fp));
-       numbers.push_back(complex(three_fp, one));
-       numbers.push_back(complex(three_fp, three_fp));
-       numbers.push_back(complex(one, one));
-       std::for_each(numbers.begin(), numbers.end(), archive_unarchive_check());
-       return 0;
-}
diff --git a/check/parser_memleak.cpp b/check/parser_memleak.cpp
deleted file mode 100644 (file)
index 1eb56c0..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/** @file parser_memleak.cpp
- *
- *  This small program exhibits the memory leak in the ginac_yylex().
- *  Run it as
- *
- *  valgrind --leak-check=yes  ./parser_memleak
- *
- *  or simply
- *
- *  ulimit -v `expr 64 \* 1024` ./parser_memleak
- */
-
-/*
- *  GiNaC Copyright (C) 1999-2020 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#include <ginac/ginac.h>
-using namespace GiNaC;
-
-#include <iostream>
-#include <stdexcept>
-using namespace std;
-
-int main(int argc, char** argv) {
-       const symbol x("x"), y("y");
-       const lst syms(x, y);
-       // parser-generated symbol => memory leak.
-       static const char* str[] = { "x^2+2*x*y + cos(x)", "Li2(x/y) + log(y/x)" };
-       
-       // depends on the amount of the available VM, compiler options, etc.
-       const unsigned N_max = 500000;
-       unsigned N=0;
-       ex e;
-       try {
-               for (; N < N_max; N++) {
-                       e = ex(str[N & 1], syms);
-               }
-       } catch (std::bad_alloc) {
-               cerr << "N = " << N << endl;
-               return 1;
-       }
-       return 0;
-}
diff --git a/check/pgcd_infinite_loop.cpp b/check/pgcd_infinite_loop.cpp
deleted file mode 100644 (file)
index 0ad5a70..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#include <iostream>
-#include <string>
-#include "ginac.h"
-using namespace GiNaC;
-using namespace std;
-
-static const string srep("\
-792*z^8*w^4*x^3*y^4*u^7 + 24*z^4*w^4*x^2*y^3*u^4       \
-+ 264*z^8*w^3*x^2*y^7*u^5 + 198*z^4*w^5*x^5*y*u^6      \
-+ 110*z^2*w^3*x^5*y^4*u^6 - 120*z^8*w*x^4*u^6          \
-- 480*z^5*w*x^4*y^6*u^8 - 720*z^7*x^3*y^3*u^7          \
-+ 165*z^4*w^2*x^4*y*u^5 + 450*z^8*w^6*x^2*y*u^8                \
-+ 40*z^2*w^3*x^3*y^3*u^6 - 288*z^7*w^2*x^3*y^6*u^6     \
-+ 250*z^6*w^4*x^2*y^4*u^8 + 576*z^7*w^7*x^2*y^4*u^8    \
-- 80*z^6*w^2*x^5*y^3*u^7 - 144*z^8*w^4*x^5*u^7         \
-+ 120*z^4*w*x^2*y^6*u^6 + 320*z^5*w^5*x^2*y^7*u^8      \
-+ 192*z^7*w^6*x*y^7*u^6 - 12*z^4*w^3*x^3*y^5*u^6       \
-- 36*z^4*w^4*x^4*y^2*u^8 + 72*z^4*w^5*x^3*u^6          \
-- 20*z^2*w^2*x^4*y^5*u^8 + 660*z^8*w*x^2*y^4*u^6       \
-+ 66*z^4*w^4*x^4*y^4*u^4 + 440*z^6*w^2*x^3*y^7*u^7     \
-- 30*z^4*w*x^3*y^2*u^7 - 48*z^8*w^3*x^4*y^3*u^5                \
-+ 72*z^6*w^2*x*y^6*u^4 - 864*z^7*w^3*x^4*y^3*u^8       \
-+ 480*z^7*w^4*x*y^4*u^7 + 60*z^4*w^2*x^2*u^5           \
-+ 375*z^8*w^3*x*y*u^7 + 150*z^8*w^5*x*y^4*u^6          \
-+ 180*z^6*x*y^3*u^5 + 216*z^6*w^3*x^2*y^3*u^6");
-
-int main(int argc, char** argv)
-{
-       cout << "Checking for more pgcd() bugs (infinite loop, miscalculation) ... " << flush;
-       parser the_parser;
-       ex e = the_parser(srep);
-       const symbol x = ex_to<symbol>(the_parser.get_syms()["x"]);
-       ex g = gcd(e, e.diff(x));
-       ex should_be = the_parser(string("u^4*z^2"));
-       if (!(g-should_be).expand().is_zero()) {
-               cout << "GCD was miscomputed. " << flush;
-               return 1;
-       }
-       cout << "not found. " << flush;
-       return 0;
-}
diff --git a/check/pgcd_relatively_prime_bug.cpp b/check/pgcd_relatively_prime_bug.cpp
deleted file mode 100644 (file)
index 1d4c287..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/** @file pgcd_relatively_prime_bug.cpp
- *
- * A program exposing historical bug in the pgcd() function. 
- */
-#include <string>
-#include <iostream>
-#include <utility>
-#include "ginac.h"
-using namespace std;
-using namespace GiNaC;
-
-int main(int argc, char** argv)
-{
-       cout << "Checking for pgcd() bug regarding relatively prime polynomials: " << flush;
-       const symbol q("q");
-       parser reader;
-       reader.get_syms().insert(make_pair(string("q"), q));
-
-       ex t = reader("-E20^16*E4^8*E5^8*E1^16*q^4"
-                     "-(E10^24-E20^8*E5^16)*E4^16*E1^8"
-                     "+E2^24*E20^16*E5^8*q^4");
-       ex g = gcd(t.expand(), t.diff(q).expand()) - 1;
-       if (!g.is_zero()) {
-               cout << " oops!" << endl <<
-                       "** Error: should be 0, got " << g << endl << flush;
-               throw std::logic_error("gcd was miscalculated");
-       }
-       cout << "not found" << endl << flush;
-       return 0;
-}
-