[PPL-devel] [GIT] ppl/ppl(floating_point): Improved test for class Linear_Form.

Roberto Amadini r.amadini at virgilio.it
Wed Sep 9 17:57:08 CEST 2009


Module: ppl/ppl
Branch: floating_point
Commit: 3d115f781b8c26b19c6a4fe0b8d491a909e9a82a
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=3d115f781b8c26b19c6a4fe0b8d491a909e9a82a

Author: Roberto Amadini <r.amadini at virgilio.it>
Date:   Wed Sep  9 17:55:46 2009 +0200

Improved test for class Linear_Form.

---

 tests/Floating_Point_Expression/linearform1.cc |   48 ++++++++++++++++++++++--
 1 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/tests/Floating_Point_Expression/linearform1.cc b/tests/Floating_Point_Expression/linearform1.cc
index bee32ba..c6ba2ab 100644
--- a/tests/Floating_Point_Expression/linearform1.cc
+++ b/tests/Floating_Point_Expression/linearform1.cc
@@ -219,22 +219,62 @@ test07() {
 
 
 // Tests overflows of space dimension.
-// FIXME: works in progress!
 bool
 test08() {
-  Linear_Form<fl_r_oc> f;
+  Linear_Form<db_r_oc> f;
   Variable A(f.max_space_dimension());
 
   bool ok1 = false;
   try {
-    f = Linear_Form<fl_r_oc>(A);
+    f = Linear_Form<db_r_oc>(A);
   }
   catch(std::length_error e) {
       nout << "Overflow in Linear_Form(const Variable v)." << endl;
       ok1 = true;
   }
 
-  return ok1;
+  bool ok2 = false;
+  try {
+    f += A;
+  }
+  catch(std::length_error e) {
+      nout << "Overflow in operator+=(Linear_Form<C>& f, const Variable v)."
+           << endl;
+      ok2 = true;
+  }
+
+  Linear_Form<db_r_oc> g;
+  bool ok3 = false;
+  try {
+    g = f - A;
+  }
+  catch(std::length_error e) {
+      nout << "Overflow in operator-(Linear_Form<C>& f, const Variable v)."
+           << endl;
+      ok3 = true;
+  }
+
+  bool ok4 = false;
+  try {
+    g = A - f;
+  }
+  catch(std::length_error e) {
+      nout << "Overflow in operator-(const Variable v, Linear_Form<C>& f)."
+           << endl;
+      ok4 = true;
+  }
+
+  bool ok5 = false;
+  try {
+    g = A + f;
+  }
+  catch(std::length_error e) {
+      nout << "Overflow in operator+(const Variable v, Linear_Form<C>& f)."
+           << endl;
+      ok5 = true;
+  }
+
+  return ok1 && ok2 && ok3 && ok4 && ok5;
 }
 
 } // namespace




More information about the PPL-devel mailing list