X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=check%2Fbugme_chinrem_gcd.cpp;h=107ebca32a6f8e922666b3d863b52405ce9739d3;hp=87c718c7114cf4ceff3ad617b092ab959c0454b3;hb=cca88b51436e4b654d16a4d60cd0d1c66fcf5dd6;hpb=3d09388a8ea144a19949c216fae43ccba92e47aa;ds=sidebyside diff --git a/check/bugme_chinrem_gcd.cpp b/check/bugme_chinrem_gcd.cpp index 87c718c7..107ebca3 100644 --- a/check/bugme_chinrem_gcd.cpp +++ b/check/bugme_chinrem_gcd.cpp @@ -3,7 +3,7 @@ * A small program exposing historical bug in poly_cra function. */ /* - * GiNaC Copyright (C) 1999-2010 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2014 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 @@ -54,11 +54,24 @@ static void check_extract_integer_content() ex g = chinrem_gcd(A, B); } +static void integer_coeff_braindamage() +{ + parser readme; + ex A = readme("3*x^2 + 1"); + ex B = readme("9*x^2 + 1"); + ex g = chinrem_gcd(A, B); + if (!g.is_equal(ex(1))) { + std::cerr << "expected 1, got " << g << std::endl; + throw std::logic_error("chinrem_gcd miscomputed integer content"); + } +} + int main(int argc, char** argv) { cout << "checking for bugs in poly_cra() and friends " << flush; check_poly_cra(); check_extract_integer_content(); + integer_coeff_braindamage(); cout << "not found."; return 0; }