[PPL-devel] [GIT] ppl/ppl(floating_point): Added test file for the new linearization algorithm.
Fabio Bossi
bossi at cs.unipr.it
Tue Jul 27 14:00:36 CEST 2010
Module: ppl/ppl
Branch: floating_point
Commit: 0701ca66ee0a9d2b462bfe8174d8e4d2cf98ed0f
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=0701ca66ee0a9d2b462bfe8174d8e4d2cf98ed0f
Author: Fabio Bossi <bossi at cs.unipr.it>
Date: Tue Jul 27 13:59:48 2010 +0200
Added test file for the new linearization algorithm.
---
tests/Concrete_Expression/Makefile.am | 5 ++-
tests/Concrete_Expression/float.cc | 4 +-
tests/Concrete_Expression/linearize.cc | 49 ++++++++++++++++++++++++++++++++
3 files changed, 55 insertions(+), 3 deletions(-)
diff --git a/tests/Concrete_Expression/Makefile.am b/tests/Concrete_Expression/Makefile.am
index 9c105e0..ead3d19 100644
--- a/tests/Concrete_Expression/Makefile.am
+++ b/tests/Concrete_Expression/Makefile.am
@@ -53,7 +53,8 @@ $(top_builddir)/src/libppl.la \
ORIGINAL_TESTS = \
C_Expr \
float \
-linearform1
+linearform1 \
+linearize
#bdshape1 \
#bdshape2 \
#digitalfilters1 \
@@ -145,6 +146,8 @@ floatingpointexpr1_SOURCES = floatingpointexpr1.cc
linearform1_SOURCES = linearform1.cc
+linearize_SOURCES = linearize.cc
+
octagonalshape1_SOURCES = octagonalshape1.cc
octagonalshape2_SOURCES = octagonalshape2.cc
diff --git a/tests/Concrete_Expression/float.cc b/tests/Concrete_Expression/float.cc
index 28f8d78..7506993 100644
--- a/tests/Concrete_Expression/float.cc
+++ b/tests/Concrete_Expression/float.cc
@@ -28,10 +28,10 @@ using namespace Parma_Polyhedra_Library::IO_Operators;
bool
test01() {
- std::cout << compute_absolute_error<FP_Interval>(IEEE754_HALF) <<
+ std::cout << compute_absolute_error<FP_Interval>(ANALYZED_FP_FORMAT) <<
std::endl;
- std::cout << compute_absolute_error<FP_Interval>(IEEE754_HALF) <<
+ std::cout << compute_absolute_error<FP_Interval>(ANALYZED_FP_FORMAT) <<
std::endl;
return 1;
diff --git a/tests/Concrete_Expression/linearize.cc b/tests/Concrete_Expression/linearize.cc
new file mode 100644
index 0000000..f8ea4c1
--- /dev/null
+++ b/tests/Concrete_Expression/linearize.cc
@@ -0,0 +1,49 @@
+/* Testing linearization algorithm ad its related functions.
+ Copyright (C) 2001-2010 Roberto Bagnara <bagnara at cs.unipr.it>
+
+This file is part of the Parma Polyhedra Library (PPL).
+
+The PPL is free software; you can redistribute it and/or moDif_FP_Expressiony it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The PPL 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 02111-1307, USA.
+
+For the most up-to-date information see the Parma Polyhedra Library
+site: http://www.cs.unipr.it/ppl/ . */
+
+#include "ppl_test.hh"
+#include "C_Expr.defs.hh"
+
+namespace {
+
+using namespace Parma_Polyhedra_Library::IO_Operators;
+
+// Tests division by zero.
+bool
+test01() {
+ Floating_Point_Constant<C_Expr> num("3", 2);
+ Floating_Point_Constant<C_Expr> den("0", 2);
+ Binary_Operator<C_Expr> div(Binary_Operator<C_Expr>::DIV, num, den);
+ FP_Linear_Form result;
+ if (!linearize(div, FP_Interval_Abstract_Store(),
+ FP_Linear_Form_Abstract_Store(), result)) {
+ nout << "*** Linearization failed due to division by zero. ***" << endl;
+ return true;
+ }
+ return false;
+}
+
+} // namespace
+
+BEGIN_MAIN
+ DO_TEST(test01);
+END_MAIN
More information about the PPL-devel
mailing list