[Gmp-commit] /var/hg/gmp: Sanity checks for the previous commit, test variabl...

mercurial at gmplib.org mercurial at gmplib.org
Mon Jan 30 12:05:07 CET 2012


details:   /var/hg/gmp/rev/e4f8d0f38df0
changeset: 14590:e4f8d0f38df0
user:      Marc Glisse <marc.glisse at inria.fr>
date:      Mon Jan 30 12:04:40 2012 +0100
description:
Sanity checks for the previous commit, test variable reuse.

diffstat:

 ChangeLog             |  1 +
 tests/cxx/t-binary.cc |  9 +++++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diffs (86 lines):

diff -r 266f945dc222 -r e4f8d0f38df0 ChangeLog
--- a/ChangeLog	Mon Jan 30 11:31:45 2012 +0100
+++ b/ChangeLog	Mon Jan 30 12:04:40 2012 +0100
@@ -2,6 +2,7 @@
 
 	* gmpxx.h (__gmp_binary_expr): Let things happen in place: d=a+b+c
 	when d != c.
+	* tests/cxx/t-binary.cc: Test variable reuse: c=a+b+c.
 
 2012-01-28  Marc Glisse  <marc.glisse at inria.fr>
 
diff -r 266f945dc222 -r e4f8d0f38df0 tests/cxx/t-binary.cc
--- a/tests/cxx/t-binary.cc	Mon Jan 30 11:31:45 2012 +0100
+++ b/tests/cxx/t-binary.cc	Mon Jan 30 12:04:40 2012 +0100
@@ -94,6 +94,7 @@
   {
     mpz_class a(3), b(4);
     mpz_class c(a * (-b)); ASSERT_ALWAYS(c == -12);
+    c = c * (-b); ASSERT_ALWAYS(c == 48);
   }
 
   // template <class T, class U, class Op>
@@ -102,6 +103,7 @@
     mpz_class a(3), b(2), c(1);
     mpz_class d;
     d = (a % b) + c; ASSERT_ALWAYS(d == 2);
+    d = (a % b) + d; ASSERT_ALWAYS(d == 3);
   }
 
   // template <class T, class U, class V, class Op>
@@ -215,6 +217,7 @@
     double c = 2.0;
     mpq_class d;
     d = a * (b + c); ASSERT_ALWAYS(d == 2);
+    d = d * (b + c); ASSERT_ALWAYS(d == 6);
   }
 
   // template <class T, class U, class V, class Op>
@@ -229,6 +232,7 @@
     mpz_class b(1), c(4);
     mpq_class d;
     d = (b - c) * a; ASSERT_ALWAYS(d == -2);
+    d = (b - c) * d; ASSERT_ALWAYS(d == 6);
   }
 
   // template <class T, class U, class Op>
@@ -237,6 +241,7 @@
     mpq_class a(1, 3), b(3, 4);
     mpq_class c;
     c = a * (-b); ASSERT_ALWAYS(c == -0.25);
+    a = a * (-b); ASSERT_ALWAYS(a == -0.25);
   }
 
   // template <class T, class U, class Op>
@@ -244,6 +249,7 @@
   {
     mpq_class a(1, 3), b(2, 3), c(1, 4);
     mpq_class d((a / b) + c); ASSERT_ALWAYS(d == 0.75);
+    c = (a / b) + c; ASSERT_ALWAYS(c == 0.75);
   }
 
   // template <class T, class U, class V, class Op>
@@ -350,6 +356,7 @@
     mpz_class b(2), c(1);
     mpf_class d;
     d = a * (b + c); ASSERT_ALWAYS(d == 9);
+    a = a * (b + c); ASSERT_ALWAYS(a == 9);
   }
 
   // template <class T, class U, class V, class Op>
@@ -366,6 +373,7 @@
     mpf_class a(2), b(-3);
     mpf_class c;
     c = a * (-b); ASSERT_ALWAYS(c == 6);
+    c = c * (-b); ASSERT_ALWAYS(c == 18);
   }
 
   // template <class T, class U, class Op>
@@ -374,6 +382,7 @@
     mpf_class a(3), b(4), c(5);
     mpf_class d;
     d = (a / b) - c; ASSERT_ALWAYS(d == -4.25);
+    c = (a / b) - c; ASSERT_ALWAYS(c == -4.25);
   }
 
   // template <class T, class U, class V, class Op>


More information about the gmp-commit mailing list