[GIT] ppl/ppl(floating_point): Added a test for Octagonal_Shape:: affine_image in

Module: ppl/ppl Branch: floating_point Commit: 4670807b162f2b4a09893794bac6cf56829bc4fe URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=4670807b162f2...
Author: Roberto Amadini r.amadini@virgilio.it Date: Tue Sep 15 14:52:41 2009 +0200
Added a test for Octagonal_Shape::affine_image in tests/Floating_Point_Expression/affineimage3.cc
---
tests/Floating_Point_Expression/Makefile.am | 4 +- tests/Floating_Point_Expression/affineimage3.cc | 77 +++++++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletions(-)
diff --git a/tests/Floating_Point_Expression/Makefile.am b/tests/Floating_Point_Expression/Makefile.am index e455a93..4039297 100755 --- a/tests/Floating_Point_Expression/Makefile.am +++ b/tests/Floating_Point_Expression/Makefile.am @@ -49,7 +49,8 @@ $(top_builddir)/tests/libppl_tests.a \ $(top_builddir)/src/libppl.la \ @extra_libraries@
-TESTS = floatingpointexpr1 +TESTS = floatingpointexpr1 \ +affineimage3
XFAIL_TESTS =
@@ -60,6 +61,7 @@ BUGS = #
floatingpointexpr1_SOURCES = floatingpointexpr1.cc +affineimage3_SOURCES = affineimage3.cc
check_PROGRAMS = \ $(TESTS) \ diff --git a/tests/Floating_Point_Expression/affineimage3.cc b/tests/Floating_Point_Expression/affineimage3.cc new file mode 100644 index 0000000..cb619a5 --- /dev/null +++ b/tests/Floating_Point_Expression/affineimage3.cc @@ -0,0 +1,77 @@ +/* Test Octagonal_Shape::affine_image on interval linear forms. + Copyright (C) 2001-2009 Roberto Bagnara bagnara@cs.unipr.it + +This file is part of the Parma Polyhedra Library (PPL). + +The PPL 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 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" + +namespace { + +// tests affine_image(A, [-2, 1]) +bool +test01() { + Variable A(0); + Variable B(1); + + Octagonal_Shape<float> oc1(3); + oc1.add_constraint(A <= 2); + oc1.add_constraint(A - B <= 3); + oc1.add_constraint(B <= 2); + Octagonal_Shape<float> oc2(3); + + fl_r_oc free_term(-2); + free_term.join_assign(1); + Linear_Form<fl_r_oc> l(free_term); + oc1.affine_image(A, l); + print_constraints(oc1, "*** oc1.affine_image(A, [-2, 1]) ***"); + + Octagonal_Shape<float> known_result(3); + known_result.add_constraint(A >= -2); + known_result.add_constraint(B <= 2); + known_result.add_constraint(A <= 1); + print_constraints(known_result, "*** known_result ***"); + + bool ok = (oc1 == known_result); + + return ok; +} + +/* +// tests affine_image(A, [-1, -1]*A) +bool test02() { + return true; +} + +// tests affine_image(A, [-1, 1]*B) +bool test03() { + return true; +} + +// tests affine_image(A, i + i1*A + i2*B) +bool test04() { + return true; +} +*/ + +} //namespace + +BEGIN_MAIN + DO_TEST(test01); +END_MAIN
participants (1)
-
Roberto Amadini