diff options
author | Anas Nashif <anas.nashif@intel.com> | 2012-11-06 07:10:54 -0800 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2012-11-06 07:10:54 -0800 |
commit | ede95f2eabeab645352a36af072ee998c400bca1 (patch) | |
tree | fcd5dc9c73c1bdc0444deee28a9b329f62a2ed7b /tests/Powerset | |
download | ppl-ede95f2eabeab645352a36af072ee998c400bca1.tar.gz ppl-ede95f2eabeab645352a36af072ee998c400bca1.tar.bz2 ppl-ede95f2eabeab645352a36af072ee998c400bca1.zip |
Imported Upstream version 0.11.2upstream/0.11.2upstream
Diffstat (limited to 'tests/Powerset')
43 files changed, 9104 insertions, 0 deletions
diff --git a/tests/Powerset/Makefile.am b/tests/Powerset/Makefile.am new file mode 100644 index 000000000..222cd018f --- /dev/null +++ b/tests/Powerset/Makefile.am @@ -0,0 +1,192 @@ +# Automake source file for the Parma Polyhedra Library. +# Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> +# Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) +# +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +# USA. +# +# For the most up-to-date information see the Parma Polyhedra Library +# site: http://www.cs.unipr.it/ppl/ . + +if VALGRIND_TESTS_ENABLED + +CHECKER = \ +$(VALGRIND) --tool=memcheck -q --trace-children=yes --leak-check=yes \ +--num-callers=40 --leak-resolution=high \ +--suppressions=$(top_srcdir)/tests/valgrind_suppressions + +else !VALGRIND_TESTS_ENABLED + +CHECKER = + +endif !VALGRIND_TESTS_ENABLED + +TESTS_ENVIRONMENT = $(CHECKER) + +AM_CPPFLAGS = \ +-I$(top_builddir)/src \ +-I$(top_srcdir)/src -I$(top_srcdir)/tests \ +-I$(top_srcdir)/utils \ +@extra_includes@ \ +@debug_flag@ + +LDADD = \ +$(top_builddir)/utils/libppl_utils.a \ +$(top_builddir)/tests/libppl_tests.a \ +$(top_builddir)/src/libppl.la \ +@extra_libraries@ + +TESTS = \ +addcongruences1 \ +addconstraints1 \ +affinedimension1 \ +affineimage1 \ +affinepreimage1 \ +bounded1 \ +bounds1 \ +closed1 \ +closure1 \ +collapse1 \ +concatenate1 \ +contains1 \ +containsintegerpoint1 \ +difference1 \ +discrete1 \ +disjoint1 \ +disjunct1 \ +empty1 \ +entails1 \ +equals1 \ +frombdshape1 \ +frombox1 \ +fromcongruences1 \ +fromconstraints1 \ +fromgrid1 \ +fromoctagonalshape1 \ +frompolyhedron1 \ +fromspacedimension1 \ +intersection1 \ +maxmin1 \ +meet1 \ +membytes1 \ +powerset1 \ +reduce1 \ +refinewith1 \ +relationwith1 \ +simplifyusingcontext1 \ +size1 \ +spacedims1 \ +universe1 \ +upperbound1 + +XFAIL_TESTS = + +# +# Sources for the tests +# +addcongruences1_SOURCES = addcongruences1.cc + +addconstraints1_SOURCES = addconstraints1.cc + +affinedimension1_SOURCES = affinedimension1.cc + +affineimage1_SOURCES = affineimage1.cc + +affinepreimage1_SOURCES = affinepreimage1.cc + +bounded1_SOURCES = bounded1.cc + +bounds1_SOURCES = bounds1.cc + +closed1_SOURCES = closed1.cc + +closure1_SOURCES = closure1.cc + +collapse1_SOURCES = collapse1.cc + +concatenate1_SOURCES = concatenate1.cc + +contains1_SOURCES = contains1.cc + +containsintegerpoint1_SOURCES = containsintegerpoint1.cc + +difference1_SOURCES = difference1.cc + +discrete1_SOURCES = discrete1.cc + +disjoint1_SOURCES = disjoint1.cc + +disjunct1_SOURCES = disjunct1.cc + +empty1_SOURCES = empty1.cc + +entails1_SOURCES = entails1.cc + +equals1_SOURCES = equals1.cc + +frombdshape1_SOURCES = frombdshape1.cc + +frombox1_SOURCES = frombox1.cc + +fromcongruences1_SOURCES = fromcongruences1.cc + +fromconstraints1_SOURCES = fromconstraints1.cc + +fromgrid1_SOURCES = fromgrid1.cc + +fromoctagonalshape1_SOURCES = fromoctagonalshape1.cc + +frompolyhedron1_SOURCES = frompolyhedron1.cc + +fromspacedimension1_SOURCES = fromspacedimension1.cc + +intersection1_SOURCES = intersection1.cc + +maxmin1_SOURCES = maxmin1.cc + +meet1_SOURCES = meet1.cc + +membytes1_SOURCES = membytes1.cc + +powerset1_SOURCES = powerset1.cc + +reduce1_SOURCES = reduce1.cc + +refinewith1_SOURCES = refinewith1.cc + +relationwith1_SOURCES = relationwith1.cc + +simplifyusingcontext1_SOURCES = simplifyusingcontext1.cc + +size1_SOURCES = size1.cc + +spacedims1_SOURCES = spacedims1.cc + +universe1_SOURCES = universe1.cc + +upperbound1_SOURCES = upperbound1.cc + +check_PROGRAMS = $(TESTS) + +$(top_builddir)/utils/libppl_utils.a: + $(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/utils libppl_utils.a + +$(top_builddir)/tests/libppl_tests.a: + $(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/tests libppl_tests.a + +$(top_builddir)/src/libppl.la: + $(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src libppl.la diff --git a/tests/Powerset/Makefile.in b/tests/Powerset/Makefile.in new file mode 100644 index 000000000..ae6a3aba2 --- /dev/null +++ b/tests/Powerset/Makefile.in @@ -0,0 +1,1265 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Automake source file for the Parma Polyhedra Library. +# Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> +# Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) +# +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +# USA. +# +# For the most up-to-date information see the Parma Polyhedra Library +# site: http://www.cs.unipr.it/ppl/ . +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +TESTS = addcongruences1$(EXEEXT) addconstraints1$(EXEEXT) \ + affinedimension1$(EXEEXT) affineimage1$(EXEEXT) \ + affinepreimage1$(EXEEXT) bounded1$(EXEEXT) bounds1$(EXEEXT) \ + closed1$(EXEEXT) closure1$(EXEEXT) collapse1$(EXEEXT) \ + concatenate1$(EXEEXT) contains1$(EXEEXT) \ + containsintegerpoint1$(EXEEXT) difference1$(EXEEXT) \ + discrete1$(EXEEXT) disjoint1$(EXEEXT) disjunct1$(EXEEXT) \ + empty1$(EXEEXT) entails1$(EXEEXT) equals1$(EXEEXT) \ + frombdshape1$(EXEEXT) frombox1$(EXEEXT) \ + fromcongruences1$(EXEEXT) fromconstraints1$(EXEEXT) \ + fromgrid1$(EXEEXT) fromoctagonalshape1$(EXEEXT) \ + frompolyhedron1$(EXEEXT) fromspacedimension1$(EXEEXT) \ + intersection1$(EXEEXT) maxmin1$(EXEEXT) meet1$(EXEEXT) \ + membytes1$(EXEEXT) powerset1$(EXEEXT) reduce1$(EXEEXT) \ + refinewith1$(EXEEXT) relationwith1$(EXEEXT) \ + simplifyusingcontext1$(EXEEXT) size1$(EXEEXT) \ + spacedims1$(EXEEXT) universe1$(EXEEXT) upperbound1$(EXEEXT) +XFAIL_TESTS = +check_PROGRAMS = $(am__EXEEXT_1) +subdir = tests/Powerset +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_check_ciao.m4 \ + $(top_srcdir)/m4/ac_check_fpu_control.m4 \ + $(top_srcdir)/m4/ac_check_gmp.m4 \ + $(top_srcdir)/m4/ac_check_sicstus_prolog.m4 \ + $(top_srcdir)/m4/ac_check_swi_prolog.m4 \ + $(top_srcdir)/m4/ac_check_xsb_prolog.m4 \ + $(top_srcdir)/m4/ac_check_yap.m4 \ + $(top_srcdir)/m4/ac_cxx_attribute_weak.m4 \ + $(top_srcdir)/m4/ac_cxx_double_binary_format.m4 \ + $(top_srcdir)/m4/ac_cxx_double_exact_output.m4 \ + $(top_srcdir)/m4/ac_cxx_flexible_arrays.m4 \ + $(top_srcdir)/m4/ac_cxx_float_binary_format.m4 \ + $(top_srcdir)/m4/ac_cxx_float_exact_output.m4 \ + $(top_srcdir)/m4/ac_cxx_ieee_inexact_flag.m4 \ + $(top_srcdir)/m4/ac_cxx_limit_memory.m4 \ + $(top_srcdir)/m4/ac_cxx_long_double_binary_format.m4 \ + $(top_srcdir)/m4/ac_cxx_long_double_exact_output.m4 \ + $(top_srcdir)/m4/ac_cxx_plain_char_is_signed.m4 \ + $(top_srcdir)/m4/ac_cxx_proper_long_double.m4 \ + $(top_srcdir)/m4/ac_cxx_remainder_bug.m4 \ + $(top_srcdir)/m4/ac_prog_jar.m4 \ + $(top_srcdir)/m4/ac_prog_java.m4 \ + $(top_srcdir)/m4/ac_prog_javac.m4 \ + $(top_srcdir)/m4/ac_prog_javah.m4 \ + $(top_srcdir)/m4/ac_text_md5sum.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/m4.m4 \ + $(top_srcdir)/m4/ocaml.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__EXEEXT_1 = addcongruences1$(EXEEXT) addconstraints1$(EXEEXT) \ + affinedimension1$(EXEEXT) affineimage1$(EXEEXT) \ + affinepreimage1$(EXEEXT) bounded1$(EXEEXT) bounds1$(EXEEXT) \ + closed1$(EXEEXT) closure1$(EXEEXT) collapse1$(EXEEXT) \ + concatenate1$(EXEEXT) contains1$(EXEEXT) \ + containsintegerpoint1$(EXEEXT) difference1$(EXEEXT) \ + discrete1$(EXEEXT) disjoint1$(EXEEXT) disjunct1$(EXEEXT) \ + empty1$(EXEEXT) entails1$(EXEEXT) equals1$(EXEEXT) \ + frombdshape1$(EXEEXT) frombox1$(EXEEXT) \ + fromcongruences1$(EXEEXT) fromconstraints1$(EXEEXT) \ + fromgrid1$(EXEEXT) fromoctagonalshape1$(EXEEXT) \ + frompolyhedron1$(EXEEXT) fromspacedimension1$(EXEEXT) \ + intersection1$(EXEEXT) maxmin1$(EXEEXT) meet1$(EXEEXT) \ + membytes1$(EXEEXT) powerset1$(EXEEXT) reduce1$(EXEEXT) \ + refinewith1$(EXEEXT) relationwith1$(EXEEXT) \ + simplifyusingcontext1$(EXEEXT) size1$(EXEEXT) \ + spacedims1$(EXEEXT) universe1$(EXEEXT) upperbound1$(EXEEXT) +am_addcongruences1_OBJECTS = addcongruences1.$(OBJEXT) +addcongruences1_OBJECTS = $(am_addcongruences1_OBJECTS) +addcongruences1_LDADD = $(LDADD) +addcongruences1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am_addconstraints1_OBJECTS = addconstraints1.$(OBJEXT) +addconstraints1_OBJECTS = $(am_addconstraints1_OBJECTS) +addconstraints1_LDADD = $(LDADD) +addconstraints1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_affinedimension1_OBJECTS = affinedimension1.$(OBJEXT) +affinedimension1_OBJECTS = $(am_affinedimension1_OBJECTS) +affinedimension1_LDADD = $(LDADD) +affinedimension1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_affineimage1_OBJECTS = affineimage1.$(OBJEXT) +affineimage1_OBJECTS = $(am_affineimage1_OBJECTS) +affineimage1_LDADD = $(LDADD) +affineimage1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_affinepreimage1_OBJECTS = affinepreimage1.$(OBJEXT) +affinepreimage1_OBJECTS = $(am_affinepreimage1_OBJECTS) +affinepreimage1_LDADD = $(LDADD) +affinepreimage1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_bounded1_OBJECTS = bounded1.$(OBJEXT) +bounded1_OBJECTS = $(am_bounded1_OBJECTS) +bounded1_LDADD = $(LDADD) +bounded1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_bounds1_OBJECTS = bounds1.$(OBJEXT) +bounds1_OBJECTS = $(am_bounds1_OBJECTS) +bounds1_LDADD = $(LDADD) +bounds1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_closed1_OBJECTS = closed1.$(OBJEXT) +closed1_OBJECTS = $(am_closed1_OBJECTS) +closed1_LDADD = $(LDADD) +closed1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_closure1_OBJECTS = closure1.$(OBJEXT) +closure1_OBJECTS = $(am_closure1_OBJECTS) +closure1_LDADD = $(LDADD) +closure1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_collapse1_OBJECTS = collapse1.$(OBJEXT) +collapse1_OBJECTS = $(am_collapse1_OBJECTS) +collapse1_LDADD = $(LDADD) +collapse1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_concatenate1_OBJECTS = concatenate1.$(OBJEXT) +concatenate1_OBJECTS = $(am_concatenate1_OBJECTS) +concatenate1_LDADD = $(LDADD) +concatenate1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_contains1_OBJECTS = contains1.$(OBJEXT) +contains1_OBJECTS = $(am_contains1_OBJECTS) +contains1_LDADD = $(LDADD) +contains1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_containsintegerpoint1_OBJECTS = containsintegerpoint1.$(OBJEXT) +containsintegerpoint1_OBJECTS = $(am_containsintegerpoint1_OBJECTS) +containsintegerpoint1_LDADD = $(LDADD) +containsintegerpoint1_DEPENDENCIES = \ + $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_difference1_OBJECTS = difference1.$(OBJEXT) +difference1_OBJECTS = $(am_difference1_OBJECTS) +difference1_LDADD = $(LDADD) +difference1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_discrete1_OBJECTS = discrete1.$(OBJEXT) +discrete1_OBJECTS = $(am_discrete1_OBJECTS) +discrete1_LDADD = $(LDADD) +discrete1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_disjoint1_OBJECTS = disjoint1.$(OBJEXT) +disjoint1_OBJECTS = $(am_disjoint1_OBJECTS) +disjoint1_LDADD = $(LDADD) +disjoint1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_disjunct1_OBJECTS = disjunct1.$(OBJEXT) +disjunct1_OBJECTS = $(am_disjunct1_OBJECTS) +disjunct1_LDADD = $(LDADD) +disjunct1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_empty1_OBJECTS = empty1.$(OBJEXT) +empty1_OBJECTS = $(am_empty1_OBJECTS) +empty1_LDADD = $(LDADD) +empty1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_entails1_OBJECTS = entails1.$(OBJEXT) +entails1_OBJECTS = $(am_entails1_OBJECTS) +entails1_LDADD = $(LDADD) +entails1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_equals1_OBJECTS = equals1.$(OBJEXT) +equals1_OBJECTS = $(am_equals1_OBJECTS) +equals1_LDADD = $(LDADD) +equals1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_frombdshape1_OBJECTS = frombdshape1.$(OBJEXT) +frombdshape1_OBJECTS = $(am_frombdshape1_OBJECTS) +frombdshape1_LDADD = $(LDADD) +frombdshape1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_frombox1_OBJECTS = frombox1.$(OBJEXT) +frombox1_OBJECTS = $(am_frombox1_OBJECTS) +frombox1_LDADD = $(LDADD) +frombox1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_fromcongruences1_OBJECTS = fromcongruences1.$(OBJEXT) +fromcongruences1_OBJECTS = $(am_fromcongruences1_OBJECTS) +fromcongruences1_LDADD = $(LDADD) +fromcongruences1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_fromconstraints1_OBJECTS = fromconstraints1.$(OBJEXT) +fromconstraints1_OBJECTS = $(am_fromconstraints1_OBJECTS) +fromconstraints1_LDADD = $(LDADD) +fromconstraints1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_fromgrid1_OBJECTS = fromgrid1.$(OBJEXT) +fromgrid1_OBJECTS = $(am_fromgrid1_OBJECTS) +fromgrid1_LDADD = $(LDADD) +fromgrid1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_fromoctagonalshape1_OBJECTS = fromoctagonalshape1.$(OBJEXT) +fromoctagonalshape1_OBJECTS = $(am_fromoctagonalshape1_OBJECTS) +fromoctagonalshape1_LDADD = $(LDADD) +fromoctagonalshape1_DEPENDENCIES = \ + $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_frompolyhedron1_OBJECTS = frompolyhedron1.$(OBJEXT) +frompolyhedron1_OBJECTS = $(am_frompolyhedron1_OBJECTS) +frompolyhedron1_LDADD = $(LDADD) +frompolyhedron1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_fromspacedimension1_OBJECTS = fromspacedimension1.$(OBJEXT) +fromspacedimension1_OBJECTS = $(am_fromspacedimension1_OBJECTS) +fromspacedimension1_LDADD = $(LDADD) +fromspacedimension1_DEPENDENCIES = \ + $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_intersection1_OBJECTS = intersection1.$(OBJEXT) +intersection1_OBJECTS = $(am_intersection1_OBJECTS) +intersection1_LDADD = $(LDADD) +intersection1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_maxmin1_OBJECTS = maxmin1.$(OBJEXT) +maxmin1_OBJECTS = $(am_maxmin1_OBJECTS) +maxmin1_LDADD = $(LDADD) +maxmin1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_meet1_OBJECTS = meet1.$(OBJEXT) +meet1_OBJECTS = $(am_meet1_OBJECTS) +meet1_LDADD = $(LDADD) +meet1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_membytes1_OBJECTS = membytes1.$(OBJEXT) +membytes1_OBJECTS = $(am_membytes1_OBJECTS) +membytes1_LDADD = $(LDADD) +membytes1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_powerset1_OBJECTS = powerset1.$(OBJEXT) +powerset1_OBJECTS = $(am_powerset1_OBJECTS) +powerset1_LDADD = $(LDADD) +powerset1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_reduce1_OBJECTS = reduce1.$(OBJEXT) +reduce1_OBJECTS = $(am_reduce1_OBJECTS) +reduce1_LDADD = $(LDADD) +reduce1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_refinewith1_OBJECTS = refinewith1.$(OBJEXT) +refinewith1_OBJECTS = $(am_refinewith1_OBJECTS) +refinewith1_LDADD = $(LDADD) +refinewith1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_relationwith1_OBJECTS = relationwith1.$(OBJEXT) +relationwith1_OBJECTS = $(am_relationwith1_OBJECTS) +relationwith1_LDADD = $(LDADD) +relationwith1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_simplifyusingcontext1_OBJECTS = simplifyusingcontext1.$(OBJEXT) +simplifyusingcontext1_OBJECTS = $(am_simplifyusingcontext1_OBJECTS) +simplifyusingcontext1_LDADD = $(LDADD) +simplifyusingcontext1_DEPENDENCIES = \ + $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_size1_OBJECTS = size1.$(OBJEXT) +size1_OBJECTS = $(am_size1_OBJECTS) +size1_LDADD = $(LDADD) +size1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_spacedims1_OBJECTS = spacedims1.$(OBJEXT) +spacedims1_OBJECTS = $(am_spacedims1_OBJECTS) +spacedims1_LDADD = $(LDADD) +spacedims1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_universe1_OBJECTS = universe1.$(OBJEXT) +universe1_OBJECTS = $(am_universe1_OBJECTS) +universe1_LDADD = $(LDADD) +universe1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +am_upperbound1_OBJECTS = upperbound1.$(OBJEXT) +upperbound1_OBJECTS = $(am_upperbound1_OBJECTS) +upperbound1_LDADD = $(LDADD) +upperbound1_DEPENDENCIES = $(top_builddir)/utils/libppl_utils.a \ + $(top_builddir)/tests/libppl_tests.a \ + $(top_builddir)/src/libppl.la +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_$(V)) +am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY)) +am__v_CXX_0 = @echo " CXX " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_$(V)) +am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CXXLD_0 = @echo " CXXLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(addcongruences1_SOURCES) $(addconstraints1_SOURCES) \ + $(affinedimension1_SOURCES) $(affineimage1_SOURCES) \ + $(affinepreimage1_SOURCES) $(bounded1_SOURCES) \ + $(bounds1_SOURCES) $(closed1_SOURCES) $(closure1_SOURCES) \ + $(collapse1_SOURCES) $(concatenate1_SOURCES) \ + $(contains1_SOURCES) $(containsintegerpoint1_SOURCES) \ + $(difference1_SOURCES) $(discrete1_SOURCES) \ + $(disjoint1_SOURCES) $(disjunct1_SOURCES) $(empty1_SOURCES) \ + $(entails1_SOURCES) $(equals1_SOURCES) $(frombdshape1_SOURCES) \ + $(frombox1_SOURCES) $(fromcongruences1_SOURCES) \ + $(fromconstraints1_SOURCES) $(fromgrid1_SOURCES) \ + $(fromoctagonalshape1_SOURCES) $(frompolyhedron1_SOURCES) \ + $(fromspacedimension1_SOURCES) $(intersection1_SOURCES) \ + $(maxmin1_SOURCES) $(meet1_SOURCES) $(membytes1_SOURCES) \ + $(powerset1_SOURCES) $(reduce1_SOURCES) $(refinewith1_SOURCES) \ + $(relationwith1_SOURCES) $(simplifyusingcontext1_SOURCES) \ + $(size1_SOURCES) $(spacedims1_SOURCES) $(universe1_SOURCES) \ + $(upperbound1_SOURCES) +DIST_SOURCES = $(addcongruences1_SOURCES) $(addconstraints1_SOURCES) \ + $(affinedimension1_SOURCES) $(affineimage1_SOURCES) \ + $(affinepreimage1_SOURCES) $(bounded1_SOURCES) \ + $(bounds1_SOURCES) $(closed1_SOURCES) $(closure1_SOURCES) \ + $(collapse1_SOURCES) $(concatenate1_SOURCES) \ + $(contains1_SOURCES) $(containsintegerpoint1_SOURCES) \ + $(difference1_SOURCES) $(discrete1_SOURCES) \ + $(disjoint1_SOURCES) $(disjunct1_SOURCES) $(empty1_SOURCES) \ + $(entails1_SOURCES) $(equals1_SOURCES) $(frombdshape1_SOURCES) \ + $(frombox1_SOURCES) $(fromcongruences1_SOURCES) \ + $(fromconstraints1_SOURCES) $(fromgrid1_SOURCES) \ + $(fromoctagonalshape1_SOURCES) $(frompolyhedron1_SOURCES) \ + $(fromspacedimension1_SOURCES) $(intersection1_SOURCES) \ + $(maxmin1_SOURCES) $(meet1_SOURCES) $(membytes1_SOURCES) \ + $(powerset1_SOURCES) $(reduce1_SOURCES) $(refinewith1_SOURCES) \ + $(relationwith1_SOURCES) $(simplifyusingcontext1_SOURCES) \ + $(size1_SOURCES) $(spacedims1_SOURCES) $(universe1_SOURCES) \ + $(upperbound1_SOURCES) +ETAGS = etags +CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CIAO_PROLOG = @CIAO_PROLOG@ +CIAO_PROLOG_INCLUDE_OPTIONS = @CIAO_PROLOG_INCLUDE_OPTIONS@ +CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GNU_PROLOG = @GNU_PROLOG@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +ISODATE = @ISODATE@ +JAR = @JAR@ +JAVA = @JAVA@ +JAVAC = @JAVAC@ +JAVAH = @JAVAH@ +JNIFLAGS = @JNIFLAGS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBEXT = @LIBEXT@ +LIBGMP = @LIBGMP@ +LIBGMPXX = @LIBGMPXX@ +LIBGMPXX_PREFIX = @LIBGMPXX_PREFIX@ +LIBGMP_PREFIX = @LIBGMP_PREFIX@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBGMP = @LTLIBGMP@ +LTLIBGMPXX = @LTLIBGMPXX@ +LTLIBOBJS = @LTLIBOBJS@ +M4 = @M4@ +M4_DEBUGFILE = @M4_DEBUGFILE@ +MAKEINFO = @MAKEINFO@ +MD5SUM = @MD5SUM@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OCAMLBEST = @OCAMLBEST@ +OCAMLBUILD = @OCAMLBUILD@ +OCAMLC = @OCAMLC@ +OCAMLCDOTOPT = @OCAMLCDOTOPT@ +OCAMLDEP = @OCAMLDEP@ +OCAMLDOC = @OCAMLDOC@ +OCAMLLIB = @OCAMLLIB@ +OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKTOP = @OCAMLMKTOP@ +OCAMLOPT = @OCAMLOPT@ +OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ +OCAMLVERSION = @OCAMLVERSION@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PPL_VERSION_BETA = @PPL_VERSION_BETA@ +PPL_VERSION_MAJOR = @PPL_VERSION_MAJOR@ +PPL_VERSION_MINOR = @PPL_VERSION_MINOR@ +PPL_VERSION_REVISION = @PPL_VERSION_REVISION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SHREXT = @SHREXT@ +SICSTUS_PROLOG_INCLUDE_OPTIONS = @SICSTUS_PROLOG_INCLUDE_OPTIONS@ +STRIP = @STRIP@ +SWI_PROLOG = @SWI_PROLOG@ +SWI_PROLOG_INCLUDE_OPTIONS = @SWI_PROLOG_INCLUDE_OPTIONS@ +SWI_PROLOG_LD = @SWI_PROLOG_LD@ +SWI_PROLOG_LD_OPTIONS = @SWI_PROLOG_LD_OPTIONS@ +TEXT_MD5SUM = @TEXT_MD5SUM@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +XSB_PROLOG_INCLUDE_OPTIONS = @XSB_PROLOG_INCLUDE_OPTIONS@ +YAP_PROLOG = @YAP_PROLOG@ +YAP_PROLOG_INCLUDE_OPTIONS = @YAP_PROLOG_INCLUDE_OPTIONS@ +YAP_PROLOG_LD_OPTIONS = @YAP_PROLOG_LD_OPTIONS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +ciao_prolog = @ciao_prolog@ +coefficient_mnemonic = @coefficient_mnemonic@ +datadir = @datadir@ +datarootdir = @datarootdir@ +debug_flag = @debug_flag@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +extra_includes = @extra_includes@ +extra_libraries = @extra_libraries@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mlgmp_dir = @mlgmp_dir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +required_instantiations = @required_instantiations@ +required_instantiations_c_cxx_headers = @required_instantiations_c_cxx_headers@ +required_instantiations_c_cxx_objects = @required_instantiations_c_cxx_objects@ +required_instantiations_c_cxx_sources = @required_instantiations_c_cxx_sources@ +required_instantiations_canonical_names = @required_instantiations_canonical_names@ +required_instantiations_java_classes = @required_instantiations_java_classes@ +required_instantiations_java_cxx_headers = @required_instantiations_java_cxx_headers@ +required_instantiations_java_cxx_headers_sources = @required_instantiations_java_cxx_headers_sources@ +required_instantiations_java_cxx_objects = @required_instantiations_java_cxx_objects@ +required_instantiations_java_cxx_sources = @required_instantiations_java_cxx_sources@ +required_instantiations_java_sources = @required_instantiations_java_sources@ +required_instantiations_ocaml_cxx_headers = @required_instantiations_ocaml_cxx_headers@ +required_instantiations_ocaml_cxx_objects = @required_instantiations_ocaml_cxx_objects@ +required_instantiations_ocaml_cxx_sources = @required_instantiations_ocaml_cxx_sources@ +required_instantiations_prolog_cxx_headers = @required_instantiations_prolog_cxx_headers@ +required_instantiations_prolog_cxx_objects = @required_instantiations_prolog_cxx_objects@ +required_instantiations_prolog_cxx_sources = @required_instantiations_prolog_cxx_sources@ +required_instantiations_prolog_generated_test_sources = @required_instantiations_prolog_generated_test_sources@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sicstus_prolog = @sicstus_prolog@ +srcdir = @srcdir@ +subdirs = @subdirs@ +swi_prolog = @swi_prolog@ +swi_prolog_ld = @swi_prolog_ld@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +uudecode = @uudecode@ +xsb_prolog = @xsb_prolog@ +yap_prolog = @yap_prolog@ +@VALGRIND_TESTS_ENABLED_FALSE@CHECKER = +@VALGRIND_TESTS_ENABLED_TRUE@CHECKER = \ +@VALGRIND_TESTS_ENABLED_TRUE@$(VALGRIND) --tool=memcheck -q --trace-children=yes --leak-check=yes \ +@VALGRIND_TESTS_ENABLED_TRUE@--num-callers=40 --leak-resolution=high \ +@VALGRIND_TESTS_ENABLED_TRUE@--suppressions=$(top_srcdir)/tests/valgrind_suppressions + +TESTS_ENVIRONMENT = $(CHECKER) +AM_CPPFLAGS = \ +-I$(top_builddir)/src \ +-I$(top_srcdir)/src -I$(top_srcdir)/tests \ +-I$(top_srcdir)/utils \ +@extra_includes@ \ +@debug_flag@ + +LDADD = \ +$(top_builddir)/utils/libppl_utils.a \ +$(top_builddir)/tests/libppl_tests.a \ +$(top_builddir)/src/libppl.la \ +@extra_libraries@ + + +# +# Sources for the tests +# +addcongruences1_SOURCES = addcongruences1.cc +addconstraints1_SOURCES = addconstraints1.cc +affinedimension1_SOURCES = affinedimension1.cc +affineimage1_SOURCES = affineimage1.cc +affinepreimage1_SOURCES = affinepreimage1.cc +bounded1_SOURCES = bounded1.cc +bounds1_SOURCES = bounds1.cc +closed1_SOURCES = closed1.cc +closure1_SOURCES = closure1.cc +collapse1_SOURCES = collapse1.cc +concatenate1_SOURCES = concatenate1.cc +contains1_SOURCES = contains1.cc +containsintegerpoint1_SOURCES = containsintegerpoint1.cc +difference1_SOURCES = difference1.cc +discrete1_SOURCES = discrete1.cc +disjoint1_SOURCES = disjoint1.cc +disjunct1_SOURCES = disjunct1.cc +empty1_SOURCES = empty1.cc +entails1_SOURCES = entails1.cc +equals1_SOURCES = equals1.cc +frombdshape1_SOURCES = frombdshape1.cc +frombox1_SOURCES = frombox1.cc +fromcongruences1_SOURCES = fromcongruences1.cc +fromconstraints1_SOURCES = fromconstraints1.cc +fromgrid1_SOURCES = fromgrid1.cc +fromoctagonalshape1_SOURCES = fromoctagonalshape1.cc +frompolyhedron1_SOURCES = frompolyhedron1.cc +fromspacedimension1_SOURCES = fromspacedimension1.cc +intersection1_SOURCES = intersection1.cc +maxmin1_SOURCES = maxmin1.cc +meet1_SOURCES = meet1.cc +membytes1_SOURCES = membytes1.cc +powerset1_SOURCES = powerset1.cc +reduce1_SOURCES = reduce1.cc +refinewith1_SOURCES = refinewith1.cc +relationwith1_SOURCES = relationwith1.cc +simplifyusingcontext1_SOURCES = simplifyusingcontext1.cc +size1_SOURCES = size1.cc +spacedims1_SOURCES = spacedims1.cc +universe1_SOURCES = universe1.cc +upperbound1_SOURCES = upperbound1.cc +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Powerset/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign tests/Powerset/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +addcongruences1$(EXEEXT): $(addcongruences1_OBJECTS) $(addcongruences1_DEPENDENCIES) + @rm -f addcongruences1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(addcongruences1_OBJECTS) $(addcongruences1_LDADD) $(LIBS) +addconstraints1$(EXEEXT): $(addconstraints1_OBJECTS) $(addconstraints1_DEPENDENCIES) + @rm -f addconstraints1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(addconstraints1_OBJECTS) $(addconstraints1_LDADD) $(LIBS) +affinedimension1$(EXEEXT): $(affinedimension1_OBJECTS) $(affinedimension1_DEPENDENCIES) + @rm -f affinedimension1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(affinedimension1_OBJECTS) $(affinedimension1_LDADD) $(LIBS) +affineimage1$(EXEEXT): $(affineimage1_OBJECTS) $(affineimage1_DEPENDENCIES) + @rm -f affineimage1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(affineimage1_OBJECTS) $(affineimage1_LDADD) $(LIBS) +affinepreimage1$(EXEEXT): $(affinepreimage1_OBJECTS) $(affinepreimage1_DEPENDENCIES) + @rm -f affinepreimage1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(affinepreimage1_OBJECTS) $(affinepreimage1_LDADD) $(LIBS) +bounded1$(EXEEXT): $(bounded1_OBJECTS) $(bounded1_DEPENDENCIES) + @rm -f bounded1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(bounded1_OBJECTS) $(bounded1_LDADD) $(LIBS) +bounds1$(EXEEXT): $(bounds1_OBJECTS) $(bounds1_DEPENDENCIES) + @rm -f bounds1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(bounds1_OBJECTS) $(bounds1_LDADD) $(LIBS) +closed1$(EXEEXT): $(closed1_OBJECTS) $(closed1_DEPENDENCIES) + @rm -f closed1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(closed1_OBJECTS) $(closed1_LDADD) $(LIBS) +closure1$(EXEEXT): $(closure1_OBJECTS) $(closure1_DEPENDENCIES) + @rm -f closure1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(closure1_OBJECTS) $(closure1_LDADD) $(LIBS) +collapse1$(EXEEXT): $(collapse1_OBJECTS) $(collapse1_DEPENDENCIES) + @rm -f collapse1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(collapse1_OBJECTS) $(collapse1_LDADD) $(LIBS) +concatenate1$(EXEEXT): $(concatenate1_OBJECTS) $(concatenate1_DEPENDENCIES) + @rm -f concatenate1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(concatenate1_OBJECTS) $(concatenate1_LDADD) $(LIBS) +contains1$(EXEEXT): $(contains1_OBJECTS) $(contains1_DEPENDENCIES) + @rm -f contains1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(contains1_OBJECTS) $(contains1_LDADD) $(LIBS) +containsintegerpoint1$(EXEEXT): $(containsintegerpoint1_OBJECTS) $(containsintegerpoint1_DEPENDENCIES) + @rm -f containsintegerpoint1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(containsintegerpoint1_OBJECTS) $(containsintegerpoint1_LDADD) $(LIBS) +difference1$(EXEEXT): $(difference1_OBJECTS) $(difference1_DEPENDENCIES) + @rm -f difference1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(difference1_OBJECTS) $(difference1_LDADD) $(LIBS) +discrete1$(EXEEXT): $(discrete1_OBJECTS) $(discrete1_DEPENDENCIES) + @rm -f discrete1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(discrete1_OBJECTS) $(discrete1_LDADD) $(LIBS) +disjoint1$(EXEEXT): $(disjoint1_OBJECTS) $(disjoint1_DEPENDENCIES) + @rm -f disjoint1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(disjoint1_OBJECTS) $(disjoint1_LDADD) $(LIBS) +disjunct1$(EXEEXT): $(disjunct1_OBJECTS) $(disjunct1_DEPENDENCIES) + @rm -f disjunct1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(disjunct1_OBJECTS) $(disjunct1_LDADD) $(LIBS) +empty1$(EXEEXT): $(empty1_OBJECTS) $(empty1_DEPENDENCIES) + @rm -f empty1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(empty1_OBJECTS) $(empty1_LDADD) $(LIBS) +entails1$(EXEEXT): $(entails1_OBJECTS) $(entails1_DEPENDENCIES) + @rm -f entails1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(entails1_OBJECTS) $(entails1_LDADD) $(LIBS) +equals1$(EXEEXT): $(equals1_OBJECTS) $(equals1_DEPENDENCIES) + @rm -f equals1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(equals1_OBJECTS) $(equals1_LDADD) $(LIBS) +frombdshape1$(EXEEXT): $(frombdshape1_OBJECTS) $(frombdshape1_DEPENDENCIES) + @rm -f frombdshape1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(frombdshape1_OBJECTS) $(frombdshape1_LDADD) $(LIBS) +frombox1$(EXEEXT): $(frombox1_OBJECTS) $(frombox1_DEPENDENCIES) + @rm -f frombox1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(frombox1_OBJECTS) $(frombox1_LDADD) $(LIBS) +fromcongruences1$(EXEEXT): $(fromcongruences1_OBJECTS) $(fromcongruences1_DEPENDENCIES) + @rm -f fromcongruences1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fromcongruences1_OBJECTS) $(fromcongruences1_LDADD) $(LIBS) +fromconstraints1$(EXEEXT): $(fromconstraints1_OBJECTS) $(fromconstraints1_DEPENDENCIES) + @rm -f fromconstraints1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fromconstraints1_OBJECTS) $(fromconstraints1_LDADD) $(LIBS) +fromgrid1$(EXEEXT): $(fromgrid1_OBJECTS) $(fromgrid1_DEPENDENCIES) + @rm -f fromgrid1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fromgrid1_OBJECTS) $(fromgrid1_LDADD) $(LIBS) +fromoctagonalshape1$(EXEEXT): $(fromoctagonalshape1_OBJECTS) $(fromoctagonalshape1_DEPENDENCIES) + @rm -f fromoctagonalshape1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fromoctagonalshape1_OBJECTS) $(fromoctagonalshape1_LDADD) $(LIBS) +frompolyhedron1$(EXEEXT): $(frompolyhedron1_OBJECTS) $(frompolyhedron1_DEPENDENCIES) + @rm -f frompolyhedron1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(frompolyhedron1_OBJECTS) $(frompolyhedron1_LDADD) $(LIBS) +fromspacedimension1$(EXEEXT): $(fromspacedimension1_OBJECTS) $(fromspacedimension1_DEPENDENCIES) + @rm -f fromspacedimension1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(fromspacedimension1_OBJECTS) $(fromspacedimension1_LDADD) $(LIBS) +intersection1$(EXEEXT): $(intersection1_OBJECTS) $(intersection1_DEPENDENCIES) + @rm -f intersection1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(intersection1_OBJECTS) $(intersection1_LDADD) $(LIBS) +maxmin1$(EXEEXT): $(maxmin1_OBJECTS) $(maxmin1_DEPENDENCIES) + @rm -f maxmin1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(maxmin1_OBJECTS) $(maxmin1_LDADD) $(LIBS) +meet1$(EXEEXT): $(meet1_OBJECTS) $(meet1_DEPENDENCIES) + @rm -f meet1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(meet1_OBJECTS) $(meet1_LDADD) $(LIBS) +membytes1$(EXEEXT): $(membytes1_OBJECTS) $(membytes1_DEPENDENCIES) + @rm -f membytes1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(membytes1_OBJECTS) $(membytes1_LDADD) $(LIBS) +powerset1$(EXEEXT): $(powerset1_OBJECTS) $(powerset1_DEPENDENCIES) + @rm -f powerset1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(powerset1_OBJECTS) $(powerset1_LDADD) $(LIBS) +reduce1$(EXEEXT): $(reduce1_OBJECTS) $(reduce1_DEPENDENCIES) + @rm -f reduce1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(reduce1_OBJECTS) $(reduce1_LDADD) $(LIBS) +refinewith1$(EXEEXT): $(refinewith1_OBJECTS) $(refinewith1_DEPENDENCIES) + @rm -f refinewith1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(refinewith1_OBJECTS) $(refinewith1_LDADD) $(LIBS) +relationwith1$(EXEEXT): $(relationwith1_OBJECTS) $(relationwith1_DEPENDENCIES) + @rm -f relationwith1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(relationwith1_OBJECTS) $(relationwith1_LDADD) $(LIBS) +simplifyusingcontext1$(EXEEXT): $(simplifyusingcontext1_OBJECTS) $(simplifyusingcontext1_DEPENDENCIES) + @rm -f simplifyusingcontext1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(simplifyusingcontext1_OBJECTS) $(simplifyusingcontext1_LDADD) $(LIBS) +size1$(EXEEXT): $(size1_OBJECTS) $(size1_DEPENDENCIES) + @rm -f size1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(size1_OBJECTS) $(size1_LDADD) $(LIBS) +spacedims1$(EXEEXT): $(spacedims1_OBJECTS) $(spacedims1_DEPENDENCIES) + @rm -f spacedims1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(spacedims1_OBJECTS) $(spacedims1_LDADD) $(LIBS) +universe1$(EXEEXT): $(universe1_OBJECTS) $(universe1_DEPENDENCIES) + @rm -f universe1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(universe1_OBJECTS) $(universe1_LDADD) $(LIBS) +upperbound1$(EXEEXT): $(upperbound1_OBJECTS) $(upperbound1_DEPENDENCIES) + @rm -f upperbound1$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(upperbound1_OBJECTS) $(upperbound1_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addcongruences1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addconstraints1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/affinedimension1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/affineimage1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/affinepreimage1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bounded1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bounds1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/closed1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/closure1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collapse1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/concatenate1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/contains1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/containsintegerpoint1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/difference1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/discrete1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disjoint1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disjunct1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/empty1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/entails1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/equals1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frombdshape1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frombox1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fromcongruences1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fromconstraints1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fromgrid1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fromoctagonalshape1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frompolyhedron1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fromspacedimension1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/intersection1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/maxmin1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/meet1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/membytes1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/powerset1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reduce1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/refinewith1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/relationwith1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simplifyusingcontext1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/size1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spacedims1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/universe1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upperbound1.Po@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + echo "$$grn$$dashes"; \ + else \ + echo "$$red$$dashes"; \ + fi; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes$$std"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +$(top_builddir)/utils/libppl_utils.a: + $(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/utils libppl_utils.a + +$(top_builddir)/tests/libppl_tests.a: + $(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/tests libppl_tests.a + +$(top_builddir)/src/libppl.la: + $(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src libppl.la + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/Powerset/addcongruences1.cc b/tests/Powerset/addcongruences1.cc new file mode 100644 index 000000000..54ae688cf --- /dev/null +++ b/tests/Powerset/addcongruences1.cc @@ -0,0 +1,68 @@ +/* Test Pointset_Powerset<PH>::add_congruence(). + Pointset_Powerset<PH>::add_congruences(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: add_congruence(). +bool +test01() { + Variable x(0); + Congruence cg = (Linear_Expression(0) %= 0); + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + ps.add_disjunct(C_Polyhedron(1)); + ps.add_congruence(cg); + Congruence cg1 = ((Linear_Expression(25) %= 1) / 2); + ps.add_congruence(cg1); + bool ok = !ps.is_empty() && ps.OK(); + return ok; +} + +// Powerset of C polyhedra: add_congruences(). +bool +test02() { + Variable x(0); + Congruence_System cgs; + cgs.insert((x %= 0) / 0); + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + ps.add_disjunct(C_Polyhedron(1)); + ps.add_congruences(cgs); + cgs.insert((x %= 0) / 0); + ps.add_congruences(cgs); + bool ok = !ps.is_empty(); + cgs.insert((x %= 0) / 0); + cgs.insert((x %= 1) / 0); + ps.add_congruences(cgs); + ok &= ps.is_empty() && ps.OK(); + + return ok; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); +END_MAIN diff --git a/tests/Powerset/addconstraints1.cc b/tests/Powerset/addconstraints1.cc new file mode 100644 index 000000000..29ee476b8 --- /dev/null +++ b/tests/Powerset/addconstraints1.cc @@ -0,0 +1,69 @@ +/* Test Pointset_Powerset<PH>::add_constraint(). + Pointset_Powerset<PH>::add_constraints(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: add_constraint(). +bool +test01() { + Variable x(0); + Constraint c = (x >= 0); + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + ps.add_disjunct(C_Polyhedron(1)); + ps.add_constraint(c); + Constraint c1 = (x >= 1); + ps.add_constraint(c1); + bool ok = !ps.is_empty(); + + return ok && ps.OK(); +} + +// Powerset of C polyhedra: add_constraints(). +bool +test02() { + Variable x(0); + Constraint_System cs; + cs.insert(x >= 3); + cs.insert(x <= 4); + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + ps.add_disjunct(C_Polyhedron(1)); + ps.add_constraints(cs); + cs.insert(x <= 3); + ps.add_constraints(cs); + bool ok = !ps.is_empty(); + cs.insert(x <= 2); + ps.add_constraints(cs); + ok &= ps.is_empty(); + + return ok && ps.OK(); +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); +END_MAIN diff --git a/tests/Powerset/affinedimension1.cc b/tests/Powerset/affinedimension1.cc new file mode 100644 index 000000000..2e97d4cdc --- /dev/null +++ b/tests/Powerset/affinedimension1.cc @@ -0,0 +1,139 @@ +/* Test Pointset_Powerset<PH>::affine_dimension(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: affine_dimension(). +bool +test01() { + Variable x(0); + Variable y(1); + Variable z(1); + Pointset_Powerset<C_Polyhedron> c_ps(3, EMPTY); + Constraint_System cs; + cs.insert(x >= 0); + cs.insert(x <= 2); + cs.insert(z <= 2); + cs.insert(z >= 2); + C_Polyhedron ph(3); + ph.add_constraints(cs); + c_ps.add_disjunct(ph); + + Constraint_System cs1; + cs1.insert(y >= 3); + cs1.insert(y <= 5); + cs1.insert(x == 6); + C_Polyhedron ph1(3); + ph1.add_constraints(cs1); + c_ps.add_disjunct(ph1); + + dimension_type d = c_ps.affine_dimension(); + + bool ok = (d == 3); + + Pointset_Powerset<C_Polyhedron>::const_iterator i = c_ps.begin(); + C_Polyhedron phi = i->pointset(); + i++; + C_Polyhedron phi1 = i->pointset(); + + print_constraints(phi, "*** phi ***"); + print_constraints(phi1, "*** phi1 ***"); + + c_ps.add_constraint(z == 2); + + dimension_type d1 = c_ps.affine_dimension(); + + bool ok1 = (d1 == 2); + + Pointset_Powerset<C_Polyhedron>::const_iterator j = c_ps.begin(); + C_Polyhedron phj = j->pointset(); + j++; + C_Polyhedron phj1 = j->pointset(); + + print_constraints(phj, "*** phj ***"); + print_constraints(phj1, "*** phj1 ***"); + + return ok && ok1; +} + +// Powerset of NNC polyhedra: affine_dimension(). +bool +test02() { + Variable x(0); + Variable y(1); + Variable z(1); + Pointset_Powerset<NNC_Polyhedron> c_ps(3, EMPTY); + Constraint_System cs; + cs.insert(x > 0); + cs.insert(x <= 2); + cs.insert(z <= 2); + cs.insert(z >= 2); + NNC_Polyhedron ph(3); + ph.add_constraints(cs); + c_ps.add_disjunct(ph); + + Constraint_System cs1; + cs1.insert(y >= 3); + cs1.insert(y <= 5); + cs1.insert(x == 6); + NNC_Polyhedron ph1(3); + ph1.add_constraints(cs1); + c_ps.add_disjunct(ph1); + + dimension_type d = c_ps.affine_dimension(); + + bool ok = (d == 3); + + Pointset_Powerset<NNC_Polyhedron>::const_iterator i = c_ps.begin(); + NNC_Polyhedron phi = i->pointset(); + i++; + NNC_Polyhedron phi1 = i->pointset(); + + print_constraints(phi, "*** phi ***"); + print_constraints(phi1, "*** phi1 ***"); + + c_ps.add_constraint(z == 2); + + dimension_type d1 = c_ps.affine_dimension(); + + bool ok1 = (d1 == 2); + + Pointset_Powerset<NNC_Polyhedron>::const_iterator j = c_ps.begin(); + NNC_Polyhedron phj = j->pointset(); + j++; + NNC_Polyhedron phj1 = j->pointset(); + + print_constraints(phj, "*** phj ***"); + print_constraints(phj1, "*** phj1 ***"); + + return ok && ok1; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); +END_MAIN diff --git a/tests/Powerset/affineimage1.cc b/tests/Powerset/affineimage1.cc new file mode 100644 index 000000000..ca54292d1 --- /dev/null +++ b/tests/Powerset/affineimage1.cc @@ -0,0 +1,240 @@ +/* Test Pointset_Powerset<PH>::affine_image(), + Pointset_Powerset<PH>::generalized_affine_image(), + Pointset_Powerset<PH>::bounded_affine_image(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of polyhedra: affine_image(). +bool +test01() { + Variable x(0); + Variable y(1); + Pointset_Powerset<C_Polyhedron> c_ps(2, EMPTY); + Constraint_System cs; + cs.insert(x >= 0); + cs.insert(x <= 2); + C_Polyhedron ph(2); + ph.add_constraints(cs); + c_ps.add_disjunct(ph); + + Constraint_System cs1; + cs1.insert(y >= 3); + cs1.insert(y <= 5); + C_Polyhedron ph1(2); + ph1.add_constraints(cs1); + c_ps.add_disjunct(ph1); + + c_ps.affine_image(x, x + y); + + ph.affine_image(x, x + y); + ph1.affine_image(x, x + y); + + Pointset_Powerset<C_Polyhedron>::const_iterator i = c_ps.begin(); + C_Polyhedron phi = i->pointset(); + i++; + C_Polyhedron phi1 = i->pointset(); + + bool ok = phi.OK() && phi == ph; + + print_constraints(ph, "*** ph ***"); + print_constraints(phi, "*** phi ***"); + + bool ok1 = phi1.OK() && phi1 == ph1; + + print_constraints(ph1, "*** ph1 ***"); + print_constraints(phi1, "*** phi1 ***"); + + return ok && ok1; +} + +// Powerset of boxes: affine_image() and intersection_assign(). +bool +test02() { + Variable x(0); + Constraint_System cs; + Pointset_Powerset<TBox> ps1(1, EMPTY); + + cs.clear(); + cs.insert(x > 0); + cs.insert(x <= 1); + ps1.add_disjunct(TBox(cs)); + + cs.clear(); + cs.insert(x >= 0); + cs.insert(x < 1); + ps1.add_disjunct(TBox(cs)); + + Pointset_Powerset<TBox> ps2(ps1); + ps2.affine_image(x, 2*x+1, 2); + + print_constraints(ps1, "*** ps1 ***"); + print_constraints(ps2, "*** ps2 ***"); + + ps1.intersection_assign(ps2); + + Pointset_Powerset<TBox> known_result(1, EMPTY); + TBox box(1); + box.add_constraint(2*x >= 1); + box.add_constraint(2*x <= 2); + known_result.add_disjunct(box); + + bool ok = (ps1 == known_result); + + print_constraints(ps1, "*** ps1.intersect_assign(ps2) ***"); + print_constraints(known_result, "*** known_result ***"); + + return ok; +} + +// Powerset of Boxes: affine_image(). +bool +test03() { + Variable x(0); + Variable y(1); + Variable z(2); + + Pointset_Powerset<TBox> ps(3, EMPTY); + for (int i = -10; i <= 9; ++i) { + TBox pps_box(3, UNIVERSE); + pps_box.add_constraint(i <= x); + pps_box.add_constraint(x <= i+1); + const TBox::interval_type& ix = pps_box.get_interval(x); + TBox::interval_type iy = ix*ix; + pps_box.set_interval(y, iy); + ps.add_disjunct(pps_box); + } + + print_constraints(ps, "*** ps ***"); + + ps.affine_image(z, y+2*x+1, 2); + + print_constraints(ps, "*** ps ***"); + + return ps.OK(); +} + +// Powerset of polyhedra: generalized_affine_image( +// const Linear_Expression&, +// Relation_Symbol relsym, +// const Linear_Expression&). +bool +test04() { + Variable x(0); + Variable y(1); + Pointset_Powerset<C_Polyhedron> c_ps(2, EMPTY); + Constraint_System cs; + cs.insert(x >= 0); + cs.insert(x <= 2); + C_Polyhedron ph(2); + ph.add_constraints(cs); + c_ps.add_disjunct(ph); + + Constraint_System cs1; + cs1.insert(y >= 3); + cs1.insert(y <= 5); + C_Polyhedron ph1(2); + ph1.add_constraints(cs1); + c_ps.add_disjunct(ph1); + + c_ps.generalized_affine_image(x - y, GREATER_OR_EQUAL, Linear_Expression(3)); + + ph.generalized_affine_image(x - y, GREATER_OR_EQUAL, Linear_Expression(3)); + ph1.generalized_affine_image(x - y, GREATER_OR_EQUAL, Linear_Expression(3)); + + Pointset_Powerset<C_Polyhedron>::const_iterator i = c_ps.begin(); + C_Polyhedron phi = i->pointset(); + i++; + C_Polyhedron phi1 = i->pointset(); + + bool ok = phi.OK() && phi == ph; + + print_constraints(ph, "*** ph ***"); + print_constraints(phi, "*** phi ***"); + + bool ok1 = phi1.OK() && phi1 == ph1; + + print_constraints(ph1, "*** ph1 ***"); + print_constraints(phi1, "*** phi1 ***"); + + return ok && ok1; +} + +// Powerset of polyhedra: bounded_affine_image( +// Variable, +// Relation_Symbol relsym, +// const Linear_Expression&, +// Coefficient_traits::const_reference).. +bool +test05() { + Variable x(0); + Variable y(1); + Pointset_Powerset<C_Polyhedron> c_ps(2, EMPTY); + Constraint_System cs; + cs.insert(x >= 0); + cs.insert(x <= 2); + C_Polyhedron ph(2); + ph.add_constraints(cs); + c_ps.add_disjunct(ph); + + Constraint_System cs1; + cs1.insert(y >= 3); + cs1.insert(y <= 5); + C_Polyhedron ph1(2); + ph1.add_constraints(cs1); + c_ps.add_disjunct(ph1); + + c_ps.bounded_affine_image(y, Linear_Expression(0), 2*y, 5); + + ph.bounded_affine_image(y, Linear_Expression(0), 2*y, 5); + ph1.bounded_affine_image(y, Linear_Expression(0), 2*y, 5); + + Pointset_Powerset<C_Polyhedron>::const_iterator i = c_ps.begin(); + C_Polyhedron phi = i->pointset(); + i++; + C_Polyhedron phi1 = i->pointset(); + + bool ok = phi.OK() && phi == ph; + + print_constraints(ph, "*** ph ***"); + print_constraints(phi, "*** phi ***"); + + bool ok1 = phi1.OK() && phi1 == ph1; + + print_constraints(ph1, "*** ph1 ***"); + print_constraints(phi1, "*** phi1 ***"); + + return ok && ok1; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); + DO_TEST(test04); + DO_TEST(test05); +END_MAIN diff --git a/tests/Powerset/affinepreimage1.cc b/tests/Powerset/affinepreimage1.cc new file mode 100644 index 000000000..6e8705188 --- /dev/null +++ b/tests/Powerset/affinepreimage1.cc @@ -0,0 +1,172 @@ +/* Test Pointset_Powerset<PH>::affine_preimage(), + Pointset_Powerset<PH>::generalized_affine_preimage(), + Pointset_Powerset<PH>::bounded_affine_preimage(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: affine_preimage(). +bool +test01() { + Variable x(0); + Variable y(1); + Pointset_Powerset<C_Polyhedron> c_ps(2, EMPTY); + Constraint_System cs; + cs.insert(x >= 0); + cs.insert(x <= 2); + C_Polyhedron ph(2); + ph.add_constraints(cs); + c_ps.add_disjunct(ph); + + Constraint_System cs1; + cs1.insert(y >= 3); + cs1.insert(y <= 5); + C_Polyhedron ph1(2); + ph1.add_constraints(cs1); + c_ps.add_disjunct(ph1); + + c_ps.affine_preimage(x, x + y); + + ph.affine_preimage(x, x + y); + ph1.affine_preimage(x, x + y); + + Pointset_Powerset<C_Polyhedron>::const_iterator i = c_ps.begin(); + C_Polyhedron phi = i->pointset(); + i++; + C_Polyhedron phi1 = i->pointset(); + + bool ok = phi.OK() && phi == ph; + + print_constraints(ph, "*** ph ***"); + print_constraints(phi, "*** phi ***"); + + bool ok1 = phi1.OK() && phi1 == ph1; + + print_constraints(ph1, "*** ph1 ***"); + print_constraints(phi1, "*** phi1 ***"); + + return ok && ok1; +} + +// Powerset of polyhedra: generalized_affine_preimage( +// const Linear_Expression&, +// Relation_Symbol relsym, +// const Linear_Expression&). +bool +test02() { + Variable x(0); + Variable y(1); + Pointset_Powerset<C_Polyhedron> c_ps(2, EMPTY); + Constraint_System cs; + cs.insert(x >= 0); + cs.insert(x <= 2); + C_Polyhedron ph(2); + ph.add_constraints(cs); + c_ps.add_disjunct(ph); + + Constraint_System cs1; + cs1.insert(y >= 3); + cs1.insert(y <= 5); + C_Polyhedron ph1(2); + ph1.add_constraints(cs1); + c_ps.add_disjunct(ph1); + + c_ps.generalized_affine_preimage(2*y, LESS_OR_EQUAL, 4*y); + + ph.generalized_affine_preimage(2*y, LESS_OR_EQUAL, 4*y); + ph1.generalized_affine_preimage(2*y, LESS_OR_EQUAL, 4*y); + + Pointset_Powerset<C_Polyhedron>::const_iterator i = c_ps.begin(); + C_Polyhedron phi = i->pointset(); + i++; + C_Polyhedron phi1 = i->pointset(); + + bool ok = phi.OK() && phi == ph; + + print_constraints(ph, "*** ph ***"); + print_constraints(phi, "*** phi ***"); + + bool ok1 = phi1.OK() && phi1 == ph1; + + print_constraints(ph1, "*** ph1 ***"); + print_constraints(phi1, "*** phi1 ***"); + + return ok && ok1; +} + +// Powerset of polyhedra: bounded_affine_preimage( +// Variable, +// Relation_Symbol relsym, +// const Linear_Expression&, +// Coefficient_traits::const_reference). +bool +test03() { + Variable x(0); + Variable y(1); + Pointset_Powerset<C_Polyhedron> c_ps(2, EMPTY); + Constraint_System cs; + cs.insert(x >= 0); + cs.insert(x <= 2); + C_Polyhedron ph(2); + ph.add_constraints(cs); + c_ps.add_disjunct(ph); + + Constraint_System cs1; + cs1.insert(y >= 3); + cs1.insert(y <= 5); + C_Polyhedron ph1(2); + ph1.add_constraints(cs1); + c_ps.add_disjunct(ph1); + + c_ps.bounded_affine_preimage(y, x, 2*y, 5); + + ph.bounded_affine_preimage(y, x, 2*y, 5); + ph1.bounded_affine_preimage(y, x, 2*y, 5); + + Pointset_Powerset<C_Polyhedron>::const_iterator i = c_ps.begin(); + C_Polyhedron phi = i->pointset(); + i++; + C_Polyhedron phi1 = i->pointset(); + + bool ok = phi.OK() && phi == ph; + + print_constraints(ph, "*** ph ***"); + print_constraints(phi, "*** phi ***"); + + bool ok1 = phi1.OK() && phi1 == ph1; + + print_constraints(ph1, "*** ph1 ***"); + print_constraints(phi1, "*** phi1 ***"); + + return ok && ok1; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); +END_MAIN diff --git a/tests/Powerset/bounded1.cc b/tests/Powerset/bounded1.cc new file mode 100644 index 000000000..42acbfc2d --- /dev/null +++ b/tests/Powerset/bounded1.cc @@ -0,0 +1,78 @@ +/* Test Pointset_Powerset<PH>::is_bounded(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: is_bounded(). +bool +test01() { + Pointset_Powerset<C_Polyhedron> ps(0, EMPTY); + bool b = ps.is_bounded(); + + ps.add_disjunct(C_Polyhedron(0)); + // A zero-dimension universe is bounded. + bool b1 = ps.is_bounded(); + return b && b1; +} + +// Powerset of NNC polyhedra: is_bounded(). +bool +test02() { + Variable x(0); + Constraint_System cs; + Pointset_Powerset<NNC_Polyhedron> ps(1, EMPTY); + + cs.clear(); + cs.insert(x > 0); + cs.insert(x <= 1); + ps.add_disjunct(NNC_Polyhedron(cs)); + + cs.clear(); + cs.insert(x >= 2); + ps.add_disjunct(NNC_Polyhedron(cs)); + + bool b = !ps.is_bounded(); + return b; +} + +// Powerset of C polyhedra: is_bounded(). +bool +test03() { + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + bool b = ps.is_bounded(); + + ps.add_disjunct(C_Polyhedron(1)); + + bool b1 = !ps.is_bounded(); + return b && b1; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); +END_MAIN diff --git a/tests/Powerset/bounds1.cc b/tests/Powerset/bounds1.cc new file mode 100644 index 000000000..f9f12796e --- /dev/null +++ b/tests/Powerset/bounds1.cc @@ -0,0 +1,97 @@ +/* Test Pointset_Powerset<PH>::bounds_from_above(), + Pointset_Powerset<PH>::bounds_from_below(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: bounds_from_above(), bounds_from_below(). +bool +test01() { + Pointset_Powerset<C_Polyhedron> ps(0, EMPTY); + Linear_Expression LE; + bool ok1 = ps.bounds_from_above(LE); + bool ok2 = ps.bounds_from_below(LE); + + if (!ok1 || !ok2) + return false; + + ps.add_disjunct(C_Polyhedron(0)); + ok1 = ps.bounds_from_above(LE); + ok2 = ps.bounds_from_below(LE); + + return ok1 && ok2; +} + +// Powerset of NNC polyhedra: bounds_from_above(), bounds_from_below(). +bool +test02() { + Variable x(0); + Constraint_System cs; + Pointset_Powerset<NNC_Polyhedron> ps(1, EMPTY); + Linear_Expression LE = x; + + cs.clear(); + cs.insert(x > 0); + cs.insert(x <= 1); + ps.add_disjunct(NNC_Polyhedron(cs)); + + cs.clear(); + cs.insert(x > 1); + ps.add_disjunct(NNC_Polyhedron(cs)); + + bool ok1 = !ps.bounds_from_above(LE); + bool ok2 = ps.bounds_from_below(LE); + + return ok1 && ok2; +} + +// Powerset of C polyhedra: bounds_from_above(), bounds_from_below(). +bool +test03() { + Variable x(0); + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + Linear_Expression LE = x; + + bool ok1 = ps.bounds_from_above(LE); + bool ok2 = ps.bounds_from_below(LE); + + if (!ok1 || !ok2) + return false; + + ps.add_disjunct(C_Polyhedron(1)); + + ok1 = !ps.bounds_from_above(LE); + ok2 = !ps.bounds_from_below(LE); + + return ok1 && ok2; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); +END_MAIN diff --git a/tests/Powerset/closed1.cc b/tests/Powerset/closed1.cc new file mode 100644 index 000000000..27fa3e7a9 --- /dev/null +++ b/tests/Powerset/closed1.cc @@ -0,0 +1,100 @@ +/* Test Pointset_Powerset<PH>::is_topologically_closed(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: is_topologically_closed(). +bool +test01() { + Pointset_Powerset<C_Polyhedron> ps(0, EMPTY); + bool b = ps.is_topologically_closed(); + + ps.add_disjunct(C_Polyhedron(0)); + bool b1 = ps.is_topologically_closed(); + return b && b1; +} + +// Powerset of NNC polyhedra: is_topologically_closed(). +bool +test02() { + Variable x(0); + Constraint_System cs; + Pointset_Powerset<NNC_Polyhedron> ps(1, EMPTY); + + cs.clear(); + cs.insert(x > 0); + cs.insert(x <= 1); + ps.add_disjunct(NNC_Polyhedron(cs)); + + cs.clear(); + cs.insert(x >= 0); + cs.insert(x <= 2); + ps.add_disjunct(NNC_Polyhedron(cs)); + + bool b = ps.is_topologically_closed(); + return b; +} + +// Powerset of NNC polyhedra: is_topologically_closed(). +bool +test03() { + Variable x(0); + Constraint_System cs; + Pointset_Powerset<NNC_Polyhedron> ps(1, EMPTY); + + cs.clear(); + cs.insert(x >= 0); + cs.insert(x <= 1); + ps.add_disjunct(NNC_Polyhedron(cs)); + + cs.clear(); + cs.insert(x > 0); + cs.insert(x < 2); + ps.add_disjunct(NNC_Polyhedron(cs)); + + bool b = !ps.is_topologically_closed(); + return b; +} + +// Powerset of C polyhedra: is_topologically_closed(). +bool +test04() { + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + bool b = ps.is_topologically_closed(); + + ps.add_disjunct(C_Polyhedron(1)); + + bool b1 = ps.is_topologically_closed(); + return b && b1; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); + DO_TEST(test04); +END_MAIN diff --git a/tests/Powerset/closure1.cc b/tests/Powerset/closure1.cc new file mode 100644 index 000000000..837f581f6 --- /dev/null +++ b/tests/Powerset/closure1.cc @@ -0,0 +1,59 @@ +/* Test Pointset_Powerset<PH>::topological_closure_assign(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: topological_closure_assign(). + +bool +test01() { + Variable x(0); + Pointset_Powerset<NNC_Polyhedron> ps(1); + Constraint_System cs; + cs.clear(); + cs.insert(x > 5); + cs.insert(x > 8); + ps.add_constraints(cs); + + ps.topological_closure_assign(); + + bool ok = ps.OK(); + + Pointset_Powerset<NNC_Polyhedron> known_ps(1); + cs.clear(); + cs.insert(x >= 5); + cs.insert(x >= 8); + known_ps.add_constraints(cs); + + ok = ok && ps.contains(known_ps); + + return ok; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); +END_MAIN diff --git a/tests/Powerset/collapse1.cc b/tests/Powerset/collapse1.cc new file mode 100644 index 000000000..5fb6efcce --- /dev/null +++ b/tests/Powerset/collapse1.cc @@ -0,0 +1,95 @@ +/* Test Pointset_Powerset<PH>::collapse(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of polyhedra: collapse(). +bool +test01() { + Variable x(0); + Pointset_Powerset<C_Polyhedron> c_ps(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + c_ps.add_disjunct(C_Polyhedron(cs)); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 3); + c_ps.add_disjunct(C_Polyhedron(cs)); + + c_ps.collapse(); + + cs.clear(); + cs.insert(x >= 0); + cs.insert(x <= 3); + Pointset_Powerset<C_Polyhedron> c_ps_expected(1, EMPTY); + c_ps_expected.add_disjunct(C_Polyhedron(cs)); + + bool ok = c_ps.definitely_entails(c_ps_expected); + bool ok1 = c_ps_expected.definitely_entails(c_ps); + bool ok2 = (c_ps.size() == 1); + + return ok && ok1 && ok2; +} + +// Powerset of boxes: collapse(). +bool +test02() { + Variable x(0); + Pointset_Powerset<TBox> pps_box(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + pps_box.add_disjunct(TBox(cs)); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 3); + pps_box.add_disjunct(TBox(cs)); + + pps_box.collapse(); + + cs.clear(); + cs.insert(x >= 0); + cs.insert(x <= 3); + Pointset_Powerset<TBox> pps_box_expected(1, EMPTY); + pps_box_expected.add_disjunct(TBox(cs)); + + bool ok = pps_box.definitely_entails(pps_box_expected); + bool ok1 = pps_box_expected.definitely_entails(pps_box); + bool ok2 = (pps_box.size() == 1); + + return ok && ok1 && ok2; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); +END_MAIN diff --git a/tests/Powerset/concatenate1.cc b/tests/Powerset/concatenate1.cc new file mode 100644 index 000000000..7647f29e7 --- /dev/null +++ b/tests/Powerset/concatenate1.cc @@ -0,0 +1,75 @@ +/* Test Pointset_Powerset<PH>::concatenate(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of polyhedra: concatenate_assign(). +bool +test01() { + Variable x(0); + Pointset_Powerset<C_Polyhedron> c_ps(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + c_ps.add_disjunct(C_Polyhedron(cs)); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 3); + c_ps.add_disjunct(C_Polyhedron(cs)); + + c_ps.concatenate_assign(c_ps); + + return c_ps.OK(); +} + +// Powerset of boxes: concatenate_assign(). +bool +test02() { + Variable x(0); + Pointset_Powerset<TBox> pps_box(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + pps_box.add_disjunct(TBox(cs)); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 3); + pps_box.add_disjunct(TBox(cs)); + + pps_box.concatenate_assign(pps_box); + + return pps_box.OK(); +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); +END_MAIN diff --git a/tests/Powerset/contains1.cc b/tests/Powerset/contains1.cc new file mode 100644 index 000000000..b25c8d79a --- /dev/null +++ b/tests/Powerset/contains1.cc @@ -0,0 +1,109 @@ +/* Test Pointset_Powerset<PH>::contains(), + Pointset_Powerset<PH>::strictly_contains(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: contains(), strictly_contains(). +bool +test01() { + Pointset_Powerset<C_Polyhedron> ps1(1, EMPTY); + + Pointset_Powerset<C_Polyhedron> ps2(1, EMPTY); + bool b = ps1.contains(ps2); + bool c = ps2.contains(ps1); + bool bs = ps1.strictly_contains(ps2); + bool cs = ps2.strictly_contains(ps1); + + ps1.add_disjunct(C_Polyhedron(1)); + bool b1 = ps1.contains(ps2); + bool c1 = !ps2.contains(ps1); + bool bs1 = ps1.strictly_contains(ps2); + bool cs1 = !ps2.strictly_contains(ps1); + + ps2.add_disjunct(C_Polyhedron(1)); + bool b2 = ps1.contains(ps2); + bool c2 = ps2.contains(ps1); + bool bs2 = !ps1.strictly_contains(ps2); + bool cs2 = !ps2.strictly_contains(ps1); + + bool ok = b && c && b1 && c1 && b2 && c2; + bool oks = bs && cs && bs1 && cs1 && bs2 && cs2; + + return ok && oks; +} + +// Powerset of C polyhedra: contains(), strictly_contains(). +bool +test02() { + Variable x(0); + Pointset_Powerset<C_Polyhedron> c_ps(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + c_ps.add_disjunct(C_Polyhedron(cs)); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 4); + c_ps.add_disjunct(C_Polyhedron(cs)); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 3); + c_ps.add_disjunct(C_Polyhedron(cs)); + + Pointset_Powerset<C_Polyhedron> c_ps1(1, EMPTY); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 3); + c_ps1.add_disjunct(C_Polyhedron(cs)); + + bool ok = c_ps.contains(c_ps1) + && !c_ps1.contains(c_ps) + && c_ps.strictly_contains(c_ps1) + && !c_ps1.strictly_contains(c_ps); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 4); + c_ps1.add_disjunct(C_Polyhedron(cs)); + + bool ok1 = c_ps.contains(c_ps1) + && !c_ps1.contains(c_ps) + && !c_ps.strictly_contains(c_ps1) + && !c_ps1.strictly_contains(c_ps); + + return ok && ok1; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); +END_MAIN diff --git a/tests/Powerset/containsintegerpoint1.cc b/tests/Powerset/containsintegerpoint1.cc new file mode 100644 index 000000000..d08525f24 --- /dev/null +++ b/tests/Powerset/containsintegerpoint1.cc @@ -0,0 +1,132 @@ +/* Test Pointset_Powerset<PH>::contains_integer_point(), + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: contains_integer_point() returns false. +bool +test01() { + Variable x(0); + Variable y(1); + + Pointset_Powerset<C_Polyhedron> ps(2); + Constraint_System cs; + cs.insert(x >= 0); + cs.insert(x <= 1); + cs.insert(4*y <= 3); + cs.insert(4*y >= 1); + + ps.refine_with_constraints(cs); + + bool contains = ps.contains_integer_point(); + + print_constraints(ps, "*** ps ***"); + nout << "ps.contains_integer_point() == " + << (contains ? "true" : "false") << endl; + + return !contains; +} + +// Powerset of C polyhedra: contains_integer_point() returns true. +bool +test02() { + Variable x(0); + Variable y(1); + Variable z(2); + + Pointset_Powerset<C_Polyhedron> ps(3); + Constraint_System cs; + cs.insert(x >= 0); + cs.insert(x <= 1); + cs.insert(4*z - 4*y >= 3); + + ps.refine_with_constraints(cs); + + print_constraints(ps, "*** ps ***"); + + bool contains = ps.contains_integer_point(); + + nout << "ps.contains_integer_point() == " + << (contains ? "true" : "false") << endl; + + return contains; +} + +// Empty 0-dimensional powerset of C polyhedra: contains_integer_point(). +bool +test03() { + Pointset_Powerset<C_Polyhedron> ps(0, EMPTY); + + print_constraints(ps, "*** ps ***"); + + bool contains = ps.contains_integer_point(); + + nout << "ps.contains_integer_point() == " + << (contains ? "true" : "false") << endl; + + return !contains; +} + +// Universe 0-dimensional powerset of C polyhedra: contains_integer_point(). +bool +test04() { + Pointset_Powerset<C_Polyhedron> ps(0); + + bool contains = ps.contains_integer_point(); + + print_constraints(ps, "*** ps ***"); + + nout << "ps.contains_integer_point() == " + << (contains ? "true" : "false") << endl; + + return contains; +} + +// Empty 1-dimensional powerset of C polyhedra: contains_integer_point(). +bool +test05() { + Pointset_Powerset<C_Polyhedron> ps(1); + + ps.refine_with_constraint(Linear_Expression(0) == 1); + + bool contains = ps.contains_integer_point(); + + print_constraints(ps, "*** ps ***"); + + nout << "ps.contains_integer_point() == " + << (contains ? "true" : "false") << endl; + + return !contains; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); + DO_TEST(test04); + DO_TEST(test05); +END_MAIN diff --git a/tests/Powerset/difference1.cc b/tests/Powerset/difference1.cc new file mode 100644 index 000000000..613ab42e0 --- /dev/null +++ b/tests/Powerset/difference1.cc @@ -0,0 +1,151 @@ +/* Test Pointset_Powerset<PH>::difference_assign(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: difference_assign(). +bool +test01() { + Variable x(0); + Variable y(1); + Pointset_Powerset<C_Polyhedron> c_ps1(2, UNIVERSE); + + Pointset_Powerset<C_Polyhedron> c_ps2(2); + Constraint_System cs; + cs.insert(x >= 0); + cs.insert(x <= 1); + cs.insert(y >= 0); + cs.insert(y <= 1); + c_ps2.add_constraints(cs); + + using namespace IO_Operators; + c_ps1.difference_assign(c_ps2); + + nout << c_ps1 << endl; + + return true; +} + +// Powerset of C polyhedra: difference_assign(). +bool +test02() { + Variable x(0); + Variable y(1); + Pointset_Powerset<C_Polyhedron> c_ps1(2, UNIVERSE); + + Pointset_Powerset<C_Polyhedron> c_ps2(2); + Constraint_System cs; + cs.insert(x >= 0); + cs.insert(x <= 1); + cs.insert(y >= 0); + cs.insert(y <= 1); + c_ps2.add_constraints(cs); + + using namespace IO_Operators; + c_ps1.difference_assign(c_ps2); + + nout << c_ps1 << endl; + + return true; +} + +// Creating a rectangle. +C_Polyhedron +aux_test03(int lx, int ly, int dx, int dy) { + Variable x(0); + Variable y(1); + C_Polyhedron ph(2, EMPTY); + ph.add_generator(point((lx+0*dx)*x + (ly+0*dy)*y)); + ph.add_generator(point((lx+1*dx)*x + (ly+0*dy)*y)); + ph.add_generator(point((lx+1*dx)*x + (ly+1*dy)*y)); + ph.add_generator(point((lx+0*dx)*x + (ly+1*dy)*y)); + return ph; +} + +// Powerset of C polyhedra: difference_assign(), meet_assign, +// upper_bound_assign() and pairwise_reduce(). +bool +test03() { + Pointset_Powerset<C_Polyhedron> cross(2, EMPTY); + cross.add_disjunct(aux_test03(0, 3, 9, 3)); + cross.add_disjunct(aux_test03(3, 0, 3, 9)); + + using namespace IO_Operators; + nout << "cross = " << cross << endl; + + Pointset_Powerset<C_Polyhedron> squares(2, EMPTY); + squares.add_disjunct(aux_test03(1, 4, 1, 1)); + squares.add_disjunct(aux_test03(4, 4, 1, 1)); + squares.add_disjunct(aux_test03(7, 4, 1, 1)); + squares.add_disjunct(aux_test03(4, 1, 1, 1)); + squares.add_disjunct(aux_test03(4, 7, 1, 1)); + + nout << "squares = " << squares << endl; + + Pointset_Powerset<C_Polyhedron> difference = cross; + difference.difference_assign(squares); + + nout << "cross - squares = " << difference << endl; + + Pointset_Powerset<C_Polyhedron> intersection = difference; + intersection.meet_assign(squares); + + nout << "(cross - squares) inters squares = " << intersection << endl; + + // When using Pointset_Powerset<NNC_Polyhedron>, intersection will be + // empty. When using Pointset_Powerset<C_Polyhedron>, + // intersection will consist of objects of affine dimension at most 1. + bool ok1 = true; + for (Pointset_Powerset<C_Polyhedron>::const_iterator + i = intersection.begin(), in_end = intersection.end(); + i != in_end; ++i) + if (i->pointset().affine_dimension() > 1) { + nout << "intersection contains " << i->pointset() << "," << endl + << "which is of affine dimension greater than 1" << endl; + ok1 = false; + } + + Pointset_Powerset<C_Polyhedron> re_union = difference; + re_union.upper_bound_assign(squares); + + nout << "(cross - squares) union squares = " << re_union << endl; + re_union.pairwise_reduce(); + nout << "<Above union pairwise reduced> = " << re_union << endl; + + bool ok2 = re_union.geometrically_equals(cross); + + if (!ok2) + nout << "Union does not give back the original!" << endl; + + return ok1 && ok2; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); +END_MAIN diff --git a/tests/Powerset/discrete1.cc b/tests/Powerset/discrete1.cc new file mode 100644 index 000000000..0fb570246 --- /dev/null +++ b/tests/Powerset/discrete1.cc @@ -0,0 +1,80 @@ +/* Test Pointset_Powerset<PH>::is_discrete(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: is_discrete(). +bool +test01() { + Pointset_Powerset<C_Polyhedron> ps(0, EMPTY); + bool b = ps.is_discrete(); + + ps.add_disjunct(C_Polyhedron(0)); + // A zero-dimension universe is discrete. + bool b1 = ps.is_discrete(); + return b && b1; +} + +// Powerset of NNC polyhedra: is_discrete(). +bool +test02() { + Variable x(0); + Constraint_System cs; + Pointset_Powerset<NNC_Polyhedron> ps(1, EMPTY); + + cs.clear(); + cs.insert(x == 2); + ps.add_disjunct(NNC_Polyhedron(cs)); + + bool b = ps.is_discrete(); + + cs.clear(); + cs.insert(x > 0); + cs.insert(x <= 1); + ps.add_disjunct(NNC_Polyhedron(cs)); + + bool b1 = !ps.is_discrete(); + return b && b1; +} + +// Powerset of C polyhedra: is_discrete(). +bool +test03() { + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + bool b = ps.is_discrete(); + + ps.add_disjunct(C_Polyhedron(1)); + + bool b1 = !ps.is_discrete(); + return b && b1; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); +END_MAIN diff --git a/tests/Powerset/disjoint1.cc b/tests/Powerset/disjoint1.cc new file mode 100644 index 000000000..6314924ec --- /dev/null +++ b/tests/Powerset/disjoint1.cc @@ -0,0 +1,117 @@ +/* Test Pointset_Powerset<PH>::is_disjoint_from(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: is_disjoint_from(). +bool +test01() { + Pointset_Powerset<C_Polyhedron> ps1(0, EMPTY); + + Pointset_Powerset<C_Polyhedron> ps2(0, EMPTY); + bool b = ps1.is_disjoint_from(ps2); + bool c = ps2.is_disjoint_from(ps1); + + ps1.add_disjunct(C_Polyhedron(0)); + bool b1 = ps1.is_disjoint_from(ps2); + bool c1 = ps2.is_disjoint_from(ps1); + + ps2.add_disjunct(C_Polyhedron(0)); + bool b2 = !ps1.is_disjoint_from(ps2); + bool c2 = !ps2.is_disjoint_from(ps1); + + return b && c && b1 && c1 && b2 && c2; +} + +// Powerset of NNC polyhedra: is_disjoint_from(). +bool +test02() { + Variable x(0); + Constraint_System cs; + Pointset_Powerset<NNC_Polyhedron> ps1(1, EMPTY); + + cs.clear(); + cs.insert(x > 0); + cs.insert(x <= 1); + ps1.add_disjunct(NNC_Polyhedron(cs)); + + cs.clear(); + cs.insert(x == 2); + ps1.add_disjunct(NNC_Polyhedron(cs)); + + Pointset_Powerset<NNC_Polyhedron> ps2(1, EMPTY); + + cs.clear(); + cs.insert(x > 2); + cs.insert(x <= 6); + ps2.add_disjunct(NNC_Polyhedron(cs)); + + bool b = ps1.is_disjoint_from(ps2); + bool c = ps2.is_disjoint_from(ps1); + + cs.clear(); + cs.insert(x >= 2); + ps2.add_disjunct(NNC_Polyhedron(cs)); + + bool b1 = !ps1.is_disjoint_from(ps2); + bool c1 = !ps2.is_disjoint_from(ps1); + + return b && c && b1 && c1; +} + +// Powerset of C polyhedra: is_disjoint_from(). +bool +test03() { + Variable x(0); + Constraint_System cs; + Pointset_Powerset<C_Polyhedron> ps1(1, EMPTY); + + Pointset_Powerset<C_Polyhedron> ps2(1, EMPTY); + bool b = ps1.is_disjoint_from(ps2); + bool c = ps2.is_disjoint_from(ps1); + + ps1.add_disjunct(C_Polyhedron(1)); + + bool b1 = ps1.is_disjoint_from(ps2); + bool c1 = ps2.is_disjoint_from(ps1); + + cs.clear(); + cs.insert(x >= 0); + cs.insert(x <= 1); + ps2.add_disjunct(C_Polyhedron(cs)); + + bool b2 = !ps1.is_disjoint_from(ps2); + bool c2 = !ps2.is_disjoint_from(ps1); + + return b && c && b1 && c1 && b2 && c2; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); +END_MAIN diff --git a/tests/Powerset/disjunct1.cc b/tests/Powerset/disjunct1.cc new file mode 100644 index 000000000..3aceb83e5 --- /dev/null +++ b/tests/Powerset/disjunct1.cc @@ -0,0 +1,311 @@ +/* Test Pointset_Powerset<PH>::add_disjunct(). + Pointset_Powerset<PH>::drop_disjunct(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: add_disjunct(). +bool +test01() { + Variable x(0); + Constraint_System cs; + Pointset_Powerset<C_Polyhedron> c_ps(1, EMPTY); + + cs.clear(); + cs.insert(x >= 0); + cs.insert(x <= 2); + c_ps.add_disjunct(C_Polyhedron(cs)); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 3); + c_ps.add_disjunct(C_Polyhedron(cs)); + + c_ps.add_constraint(x == 1); + + Pointset_Powerset<NNC_Polyhedron> nnc_ps(c_ps); + + Pointset_Powerset<C_Polyhedron>::const_iterator c_i = c_ps.begin(); + C_Polyhedron c_phi = c_i->pointset(); + print_constraints(c_phi, "*** c_phi ***"); + Pointset_Powerset<NNC_Polyhedron>::const_iterator nnc_i = nnc_ps.begin(); + NNC_Polyhedron nnc_phi = nnc_i->pointset(); + print_constraints(nnc_phi, "*** nnc_phi ***"); + + return c_ps.OK() && nnc_ps.OK(); +} + +// Powerset of NNC polyhedra: add_disjunct(). +bool +test02() { + Variable x(0); + Constraint_System cs; + Pointset_Powerset<NNC_Polyhedron> nnc_ps(1, EMPTY); + + cs.clear(); + cs.insert(x > 0); + cs.insert(x <= 1); + nnc_ps.add_disjunct(NNC_Polyhedron(cs)); + + cs.clear(); + cs.insert(x >= 0); + cs.insert(x < 1); + nnc_ps.add_disjunct(NNC_Polyhedron(cs)); + + Pointset_Powerset<C_Polyhedron> c_ps(nnc_ps); + + Pointset_Powerset<C_Polyhedron>::const_iterator c_i = c_ps.begin(); + C_Polyhedron c_phi = c_i->pointset(); + print_constraints(c_phi, "*** c_phi ***"); + Pointset_Powerset<NNC_Polyhedron>::const_iterator nnc_i = nnc_ps.begin(); + NNC_Polyhedron nnc_phi = nnc_i->pointset(); + print_constraints(nnc_phi, "*** nnc_phi ***"); + + return nnc_ps.OK() && c_ps.OK(); +} + +// Powerset of C polyhedra: add_disjunct() and drop_disjunct(). +bool +test03() { + Variable x(0); + Pointset_Powerset<C_Polyhedron> c_ps(1, EMPTY); + Constraint_System cs; + cs.insert(x >= 0); + cs.insert(x <= 2); + Constraint_System cs1 = cs; + c_ps.add_disjunct(C_Polyhedron(cs)); + c_ps.drop_disjunct(c_ps.begin()); + + bool ok = c_ps.empty(); + + Constraint_System cs2 = cs1; + c_ps.add_disjunct(C_Polyhedron(cs1)); + + cs.insert(x >= 0); + cs.insert(x <= 3); + c_ps.add_disjunct(C_Polyhedron(cs)); + c_ps.drop_disjuncts(c_ps.begin(), c_ps.end()); + + bool ok1 = c_ps.empty(); + + return ok && ok1; +} + +// Powerset of C polyhedra: add_disjunct(). +bool +test04() { + Variable x(0); + Variable y(1); + Pointset_Powerset<C_Polyhedron> c_ps(2, EMPTY); + Constraint_System cs; + cs.insert(x >= 0); + cs.insert(x <= 2); + C_Polyhedron ph(2); + ph.add_constraints(cs); + c_ps.add_disjunct(ph); + + Constraint_System cs1; + cs1.insert(y >= 3); + cs1.insert(y <= 5); + C_Polyhedron ph1(2); + ph1.add_constraints(cs1); + c_ps.add_disjunct(ph1); + + Pointset_Powerset<C_Polyhedron>::const_iterator i = c_ps.begin(); + C_Polyhedron phi = i->pointset(); + i++; + C_Polyhedron phi1 = i->pointset(); + + bool ok = phi.OK() && phi == ph; + + print_constraints(ph, "*** ph ***"); + print_constraints(phi, "*** phi ***"); + + bool ok1 = phi1.OK() && phi1 == ph1; + + print_constraints(ph1, "*** ph1 ***"); + print_constraints(phi1, "*** phi1 ***"); + + phi.upper_bound_assign(phi1); + print_constraints(phi, "*** phi ***"); + + return ok && ok1; +} + +// Powerset of boxes: add_disjunct(). +bool +test05() { + Variable x(0); + Variable y(1); + Pointset_Powerset<TBox> pps_box(2, EMPTY); + Constraint_System cs; + cs.insert(x >= 0); + cs.insert(x <= 2); + TBox box(2); + box.add_constraints(cs); + pps_box.add_disjunct(box); + + Constraint_System cs1; + cs1.insert(y >= 3); + cs1.insert(y <= 5); + TBox box1(2); + box1.add_constraints(cs1); + pps_box.add_disjunct(box1); + + Pointset_Powerset<TBox>::const_iterator i = pps_box.begin(); + TBox pps_boxi = i->pointset(); + i++; + TBox pps_boxi1 = i->pointset(); + + bool ok = pps_boxi.OK() && pps_boxi == box; + + print_constraints(box, "*** box ***"); + print_constraints(pps_boxi, "*** pps_boxi ***"); + + bool ok1 = pps_boxi1.OK() && pps_boxi1 == box1; + + print_constraints(box1, "*** box1 ***"); + print_constraints(pps_boxi1, "*** pps_boxi1 ***"); + + pps_boxi.upper_bound_assign(pps_boxi1); + print_constraints(pps_boxi, "*** pps_boxi ***"); + + return ok && ok1; +} + +// Powerset of boxes: add_disjunct(). +bool +test06() { + Variable x(0); + + Pointset_Powerset<TBox> ps(1, EMPTY); + Constraint_System cs; + cs.clear(); + cs.insert(x >= 0); + cs.insert(x < 2); + ps.add_disjunct(TBox(cs)); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 3); + ps.add_disjunct(TBox(cs)); + + print_constraints(ps, "*** ps ***"); + + ps.add_constraint(x == 1); + + Pointset_Powerset<TBox> known_result(1, EMPTY); + TBox box(1); + box.add_constraint(x == 1); + known_result.add_disjunct(box); + + bool ok = (ps == known_result); + + print_constraints(ps, "*** ps.add_constraint(x == 1) ***"); + print_constraints(known_result, "*** known_result ***"); + + return ok; +} + +// Powerset of boxes: add_disjuncts(). +bool +test07() { + Variable x(0); + Variable y(1); + Pointset_Powerset<TBox> pps_box(2, EMPTY); + Constraint_System cs; + cs.insert(x >= 0); + cs.insert(x <= 2); + TBox box(2); + box.add_constraints(cs); + pps_box.add_disjunct(box); + + Constraint_System cs1; + cs1.insert(y >= 3); + cs1.insert(y <= 5); + TBox box1(2); + box1.add_constraints(cs1); + pps_box.add_disjunct(box1); + + Pointset_Powerset<TBox>::const_iterator i = pps_box.begin(); + TBox pps_boxi = i->pointset(); + i++; + TBox pps_boxi1 = i->pointset(); + + bool ok = pps_boxi.OK() && pps_boxi == box; + + print_constraints(box, "*** box ***"); + print_constraints(pps_boxi, "*** pps_boxi ***"); + + bool ok1 = pps_boxi1.OK() && pps_boxi1 == box1; + + print_constraints(box1, "*** box1 ***"); + print_constraints(pps_boxi1, "*** pps_boxi1 ***"); + + pps_boxi.upper_bound_assign(pps_boxi1); + print_constraints(pps_boxi, "*** pps_boxi ***"); + + return ok && ok1; +} + +// Powerset of boxes: add_disjunct(), drop_disjuncts(). +bool +test08() { + Variable x(0); + Pointset_Powerset<TBox> pps_box(1, EMPTY); + Constraint_System cs; + cs.insert(x >= 0); + cs.insert(x <= 2); + Constraint_System cs1 = cs; + pps_box.add_disjunct(TBox(cs)); + pps_box.drop_disjunct(pps_box.begin()); + + bool ok = pps_box.empty(); + + Constraint_System cs2 = cs1; + pps_box.add_disjunct(TBox(cs1)); + + cs.insert(x >= 0); + cs.insert(x <= 3); + pps_box.add_disjunct(TBox(cs)); + pps_box.drop_disjuncts(pps_box.begin(), pps_box.end()); + + bool ok1 = pps_box.empty(); + + return ok && ok1; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); + DO_TEST(test04); + DO_TEST(test05); + DO_TEST(test06); + DO_TEST(test07); + DO_TEST(test08); +END_MAIN diff --git a/tests/Powerset/empty1.cc b/tests/Powerset/empty1.cc new file mode 100644 index 000000000..2bcbe136b --- /dev/null +++ b/tests/Powerset/empty1.cc @@ -0,0 +1,142 @@ +/* Test Pointset_Powerset<PH>::is_empty(), + Pointset_Powerset<PH>::empty(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: empty(). +bool +test01() { + Variable x(0); + Pointset_Powerset<C_Polyhedron> c_ps(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + c_ps.add_disjunct(C_Polyhedron(cs)); + + Pointset_Powerset<C_Polyhedron> c_ps1; + c_ps1 = c_ps; + + bool ok = !c_ps.empty(); + return ok; +} + +// Powerset of C polyhedra: empty(). +bool +test02() { + Variable x(0); + Pointset_Powerset<C_Polyhedron> c_ps(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + c_ps.add_disjunct(C_Polyhedron(cs)); + + Pointset_Powerset<C_Polyhedron> c_ps1(1, EMPTY); + c_ps.swap(c_ps1); + + bool ok = (c_ps.empty() && !c_ps1.empty()); + return ok; +} + +// Powerset of C polyhedra: is_empty(). +bool +test03() { + Pointset_Powerset<C_Polyhedron> ps(0, EMPTY); + bool b = ps.is_empty(); + + ps.add_disjunct(C_Polyhedron(0)); + bool b1 = !ps.is_empty(); + return b && b1; +} + +// Powerset of NNC polyhedra: is_empty(). +bool +test04() { + Variable x(0); + Constraint_System cs; + Pointset_Powerset<NNC_Polyhedron> ps(1, EMPTY); + + cs.clear(); + cs.insert(x > 0); + cs.insert(x <= 1); + ps.add_disjunct(NNC_Polyhedron(cs)); + + cs.clear(); + cs.insert(x >= 0); + cs.insert(x < 1); + ps.add_disjunct(NNC_Polyhedron(cs)); + + bool b = !ps.is_empty(); + return b; +} + +// Powerset of boxes: !empty(). +bool +test05() { + Variable x(0); + Pointset_Powerset<TBox> pps_box(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + pps_box.add_disjunct(TBox(cs)); + + Pointset_Powerset<TBox> pps_box1; + pps_box1 = pps_box; + + bool ok = !pps_box.empty(); + return ok; +} + +// Powerset of boxes: empty(). +bool +test06() { + Variable x(0); + Pointset_Powerset<TBox> pps_box(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + pps_box.add_disjunct(TBox(cs)); + + Pointset_Powerset<TBox> pps_box1(1, EMPTY); + pps_box.swap(pps_box1); + + bool ok = (pps_box.empty() && !pps_box1.empty()); + return ok; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); + DO_TEST(test04); + DO_TEST(test05); + DO_TEST(test06); +END_MAIN diff --git a/tests/Powerset/entails1.cc b/tests/Powerset/entails1.cc new file mode 100644 index 000000000..427680bc7 --- /dev/null +++ b/tests/Powerset/entails1.cc @@ -0,0 +1,73 @@ +/* Test Pointset_Powerset<PH>::definitely_entails(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of polyhedra: definitely_entails(). +bool +test01() { + Variable x(0); + Pointset_Powerset<C_Polyhedron> c_ps(1, EMPTY); + Constraint_System cs; + cs.insert(x >= 0); + c_ps.add_disjunct(C_Polyhedron(cs)); + + Pointset_Powerset<C_Polyhedron> c_ps1(1, EMPTY); + Constraint_System cs1; + cs1.insert(x >= 0); + cs1.insert(x <= 2); + c_ps1.add_disjunct(C_Polyhedron(cs1)); + + bool ok = c_ps1.definitely_entails(c_ps); + + return ok; +} + +// Powerset of boxes: definitely_entails(). +bool +test02() { + Variable x(0); + Pointset_Powerset<TBox> pps_box(1, EMPTY); + Constraint_System cs; + cs.insert(x >= 0); + pps_box.add_disjunct(TBox(cs)); + + Pointset_Powerset<TBox> pps_box1(1, EMPTY); + Constraint_System cs1; + cs1.insert(x >= 0); + cs1.insert(x <= 2); + pps_box1.add_disjunct(TBox(cs1)); + + bool ok = pps_box1.definitely_entails(pps_box); + + return ok; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); +END_MAIN diff --git a/tests/Powerset/equals1.cc b/tests/Powerset/equals1.cc new file mode 100644 index 000000000..860df6009 --- /dev/null +++ b/tests/Powerset/equals1.cc @@ -0,0 +1,79 @@ +/* Test Pointset_Powerset<PH>::equals(), + Pointset_Powerset<PH>::geometrically_equals(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// geometrically_equals(). +bool +test01() { + Variable x(0); + Pointset_Powerset<TBox> pps_box(1); + Constraint_System cs; + cs.insert(x >= 5); + cs.insert(x <= 3); + pps_box.add_constraints(cs); + + Pointset_Powerset<TBox> pps_box1(1, EMPTY); + + // pps_box.ascii_dump(); + // pps_box1.ascii_dump(); + + bool ok = pps_box.geometrically_equals(pps_box1); + bool ok1 = pps_box.geometrically_equals(pps_box1); + + return ok && ok1; +} + +// geometrically_equals(). +bool +test02() { + Variable x(0); + Pointset_Powerset<TBox> pps_box(1); + Constraint_System cs; + cs.insert(x >= 5); + cs.insert(x >= 8); + pps_box.add_constraints(cs); + + Pointset_Powerset<TBox> pps_box1(1); + cs.clear(); + cs.insert(x >= 8); + pps_box1.add_constraints(cs); + + // pps_box.ascii_dump(); + // pps_box1.ascii_dump(); + + bool ok = pps_box.geometrically_equals(pps_box1); + bool ok1 = pps_box.geometrically_equals(pps_box1); + + return ok && ok1; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); +END_MAIN diff --git a/tests/Powerset/frombdshape1.cc b/tests/Powerset/frombdshape1.cc new file mode 100644 index 000000000..e717298da --- /dev/null +++ b/tests/Powerset/frombdshape1.cc @@ -0,0 +1,425 @@ +/* Test Pointset_Powerset<PH>::Pointset_Powerset(BD_Shape<T>), + Pointset_Powerset<PH>::Pointset_Powerset(Pointset_Powerset(BD_Shape<T>)). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Constructs the powerset of polyhedra from a bd shape. +bool +test01() { + Variable x(0); + Variable y(1); + + TBD_Shape bds(2); + bds.add_constraint(x >= 0); + bds.add_constraint(x - y <= 1); + bds.add_constraint(y >= 0); + + Pointset_Powerset<C_Polyhedron> pps(bds); + + Pointset_Powerset<C_Polyhedron> known_pps(2); + known_pps.add_constraint(x >= 0); + known_pps.add_constraint(x - y <= 1); + known_pps.add_constraint(y >= 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<C_Polyhedron>::const_iterator i = pps.begin(); + C_Polyhedron phi = i->pointset(); + print_constraints(phi, "*** phi ***"); + + return ok; +} + +// Constructs the powerset of polyhedra from an empty bd shape. +bool +test02() { + Variable x(0); + Variable y(1); + + TBD_Shape bds(2, EMPTY); + + Pointset_Powerset<C_Polyhedron> pps(bds); + + Pointset_Powerset<C_Polyhedron> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of polyhedra from a powerset of bd shapes. +bool +test03() { + Variable x(0); + Variable y(1); + + Constraint_System cs; + cs.insert(x >= 1); + cs.insert(x <= 1); + cs.insert(y <= 0); + TBD_Shape bds(cs); + + // The complexity should be ignored. + Pointset_Powerset<TBD_Shape> pps_bds(bds, POLYNOMIAL_COMPLEXITY); + + // The complexity should be ignored. + Pointset_Powerset<C_Polyhedron> pps(pps_bds, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<C_Polyhedron> known_pps(2); + known_pps.add_constraint(x == 1); + known_pps.add_constraint(y <= 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<C_Polyhedron>::const_iterator j = pps.begin(); + C_Polyhedron phj = j->pointset(); + print_constraints(phj, "*** pps disjunct ***"); + + return ok; +} + +// Constructs the powerset of bd shapes from a bd shape. +bool +test04() { + Variable x(0); + Variable y(1); + Variable z(2); + Variable w(3); + + TBD_Shape bds(4); + bds.add_constraint(x >= 2); + bds.add_constraint(x - y <= 4); + bds.add_constraint(z == 1); + + Pointset_Powerset<TBD_Shape> pps1(bds); + Pointset_Powerset<TBD_Shape> pps2(4, EMPTY); + pps2.add_disjunct(bds); + + bool ok = (pps1 == pps2); + + Pointset_Powerset<TBD_Shape>::const_iterator i = pps1.begin(); + TBD_Shape bdsi = i->pointset(); + print_constraints(bdsi, "*** bdsi ***"); + Pointset_Powerset<TBD_Shape>::const_iterator i2 = pps2.begin(); + TBD_Shape bdsi2 = i2->pointset(); + print_constraints(bdsi2, "*** bdsi2 ***"); + + return ok && pps1.OK(); +} + +// Constructs the powerset of bd shapes from an empty bd shape. +bool + test05() { + Variable x(0); + Variable y(1); + + TBD_Shape bds(2, EMPTY); + + Pointset_Powerset<TBD_Shape> pps(bds); + + Pointset_Powerset<TBD_Shape> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of bd shapes from a powerset of bd shapes. +bool +test06() { + Variable x(0); + Variable y(1); + + Constraint_System cs; + cs.insert(x >= 1); + cs.insert(x <= 1); + cs.insert(y <= 0); + TBD_Shape bds(cs); + + // The complexity should be ignored. + Pointset_Powerset<TBD_Shape> pps_bds(bds, POLYNOMIAL_COMPLEXITY); + + // The complexity should be ignored. + Pointset_Powerset<TBD_Shape> pps(pps_bds, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<TBD_Shape> known_pps(2); + known_pps.add_constraint(x == 1); + known_pps.add_constraint(y <= 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TBD_Shape>::const_iterator j = pps.begin(); + TBD_Shape bdsj = j->pointset(); + print_constraints(bdsj, "*** pps disjunct ***"); + + return ok; +} + +// Constructs the powerset of octagonal_shapes from a bd shape. +bool +test07() { + Variable x(0); + Variable y(1); + + TBD_Shape bds(2); + bds.add_constraint(x == 0); + bds.add_constraint(x - y <= 1); + bds.add_constraint(y >= 0); + + Pointset_Powerset<TOctagonal_Shape> pps(bds); + + Pointset_Powerset<TOctagonal_Shape> known_pps(2); + known_pps.add_constraint(x == 0); + known_pps.add_constraint(x - y <= 1); + known_pps.add_constraint(y >= 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TOctagonal_Shape>::const_iterator i = pps.begin(); + TOctagonal_Shape osi = i->pointset(); + print_constraints(osi, "*** osi ***"); + + return ok; +} + +// Constructs the powerset of octagonal_shapes from an empty bd shape. +bool +test08() { + Variable x(0); + Variable y(1); + + TBD_Shape bds(2, EMPTY); + + Pointset_Powerset<TOctagonal_Shape> pps(bds); + + Pointset_Powerset<TOctagonal_Shape> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of octagonal_shapes from a powerset of bd shapes. +bool +test09() { + Variable x(0); + Variable y(1); + + Constraint_System cs; + cs.insert(x >= 1); + cs.insert(x - y <= 1); + cs.insert(y <= 0); + TBD_Shape bd(cs); + + // The complexity should be ignored. + Pointset_Powerset<TBD_Shape> pps_bd(bd, POLYNOMIAL_COMPLEXITY); + + // The complexity should be ignored. + Pointset_Powerset<TOctagonal_Shape> pps(pps_bd, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<TOctagonal_Shape> known_pps(2); + known_pps.add_constraint(x == 1); + known_pps.add_constraint(y == 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TOctagonal_Shape>::const_iterator i_os = pps.begin(); + TOctagonal_Shape osi = i_os->pointset(); + print_constraints(osi, "*** osi ***"); + + return ok; +} + +// Constructs the powerset of boxes from a bd shape. +bool +test10() { + Variable x(0); + Variable y(1); + + TBD_Shape bds(2); + bds.add_constraint(x == 0); + bds.add_constraint(x - y <= 1); + bds.add_constraint(y >= 0); + + Pointset_Powerset<TBox> pps(bds); + + Pointset_Powerset<TBox> known_pps(2); + known_pps.add_constraint(x == 0); + known_pps.add_constraint(y >= 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TBox>::const_iterator i = pps.begin(); + TBox phi = i->pointset(); + print_constraints(phi, "*** phi ***"); + + return ok; +} + +// Constructs the powerset of boxes from an empty bd shape. +bool +test11() { + Variable x(0); + Variable y(1); + + TBD_Shape bds(2, EMPTY); + + Pointset_Powerset<TBox> pps(bds); + + Pointset_Powerset<TBox> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of boxes from a powerset of bd shapes. +bool +test12() { + Variable x(0); + Variable y(1); + + Constraint_System cs; + cs.insert(x >= 1); + cs.insert(x - y <= 1); + cs.insert(y <= 0); + TBD_Shape bd(cs); + + // The complexity should be ignored. + Pointset_Powerset<TBD_Shape> pps_bd(bd, POLYNOMIAL_COMPLEXITY); + + // The complexity should be ignored. + Pointset_Powerset<TBox> pps(pps_bd, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<TBox> known_pps(2); + known_pps.add_constraint(x == 1); + known_pps.add_constraint(y == 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TBox>::const_iterator i_box = pps.begin(); + TBox boxi = i_box->pointset(); + print_constraints(boxi, "*** boxi ***"); + + return ok; +} + +// Constructs the powerset of grids from a bd shape. +bool +test13() { + Variable x(0); + Variable y(1); + + TBD_Shape bds(2); + bds.add_constraint(x == 0); + bds.add_constraint(x - y <= 1); + bds.add_constraint(y >= 0); + + Pointset_Powerset<Grid> pps(bds); + + Pointset_Powerset<Grid> known_pps(2); + known_pps.add_congruence((x %= 0) / 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<Grid>::const_iterator i = pps.begin(); + Grid phi = i->pointset(); + print_congruences(phi, "*** phi ***"); + + return ok; +} + +// Constructs the powerset of grids from an empty bd shape. +bool +test14() { + Variable x(0); + Variable y(1); + + TBD_Shape bds(2, EMPTY); + + Pointset_Powerset<Grid> pps(bds); + + Pointset_Powerset<Grid> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of grids from a powerset of bd shapes. +bool +test15() { + Variable x(0); + Variable y(1); + + Constraint_System cs; + cs.insert(x >= 1); + cs.insert(x - y <= 1); + cs.insert(y <= 0); + TBD_Shape bd(cs); + + // The complexity should be ignored. + Pointset_Powerset<TBD_Shape> pps_bd(bd, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<TBD_Shape>::const_iterator i_bd = pps_bd.begin(); + TBD_Shape bdi = i_bd->pointset(); + print_constraints(bdi, "*** bdi ***"); + + // The complexity should be ignored. + Pointset_Powerset<Grid> pps(pps_bd, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<Grid> known_pps(2); + known_pps.add_constraint(x == 1); + known_pps.add_constraint(y == 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<Grid>::const_iterator i_gr = pps.begin(); + Grid gri = i_gr->pointset(); + print_congruences(gri, "*** gri ***"); + + return ok; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); + DO_TEST(test04); + DO_TEST(test05); + DO_TEST(test06); + DO_TEST(test07); + DO_TEST(test08); + DO_TEST(test09); + DO_TEST(test10); + DO_TEST(test11); + DO_TEST(test12); + DO_TEST(test13); + DO_TEST(test14); + DO_TEST(test15); +END_MAIN diff --git a/tests/Powerset/frombox1.cc b/tests/Powerset/frombox1.cc new file mode 100644 index 000000000..b6b91fb35 --- /dev/null +++ b/tests/Powerset/frombox1.cc @@ -0,0 +1,421 @@ +/* Test Pointset_Powerset<PH>::Pointset_Powerset(Box<T>), + Pointset_Powerset<PH>::Pointset_Powerset(Pointset_Powerset(Box<T>)). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Constructs the powerset of polyhedra from a box. +bool +test01() { + Variable x(0); + Variable y(1); + + Rational_Box box(2); + box.add_constraint(x >= 0); + box.add_constraint(2*x <= 1); + box.add_constraint(y >= 0); + + Pointset_Powerset<C_Polyhedron> pps(box); + + Pointset_Powerset<C_Polyhedron> known_pps(2); + known_pps.add_constraint(x >= 0); + known_pps.add_constraint(2*x <= 1); + known_pps.add_constraint(y >= 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<C_Polyhedron>::const_iterator i = pps.begin(); + C_Polyhedron phi = i->pointset(); + print_constraints(phi, "*** phi ***"); + + return ok; +} + +// Constructs the powerset of polyhedra from an empty box. +bool +test02() { + Variable x(0); + Variable y(1); + + Rational_Box box(2, EMPTY); + + Pointset_Powerset<C_Polyhedron> pps(box); + + Pointset_Powerset<C_Polyhedron> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of polyhedra from a powerset of boxes. +bool +test03() { + Variable x(0); + Variable y(1); + + Constraint_System cs; + cs.insert(x >= 1); + cs.insert(x <= 1); + cs.insert(y <= 0); + TBox box(cs); + + // The complexity should be ignored. + Pointset_Powerset<TBox> pps_box(box, POLYNOMIAL_COMPLEXITY); + + // The complexity should be ignored. + Pointset_Powerset<C_Polyhedron> pps(pps_box, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<C_Polyhedron> known_pps(2); + known_pps.add_constraint(x == 1); + known_pps.add_constraint(y <= 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<C_Polyhedron>::const_iterator j = pps.begin(); + C_Polyhedron phj = j->pointset(); + print_constraints(phj, "*** pps disjunct ***"); + + return ok; +} + +// Constructs the powerset of bd shapes from a box. +bool +test04() { + Variable x(0); + Variable y(1); + + TBox box(2); + box.add_constraint(x >= 0); + box.add_constraint(y >= 0); + + // Complexity should be ignored. + Pointset_Powerset<TBD_Shape> pps(box, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<TBD_Shape> known_pps(2); + known_pps.add_constraint(x >= 0); + known_pps.add_constraint(y >= 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TBD_Shape>::const_iterator i = pps.begin(); + TBD_Shape bdsi = i->pointset(); + print_constraints(bdsi, "*** bdsi ***"); + + return ok; +} + +// Constructs the powerset of bd shapes from an empty box. +bool +test05() { + Variable x(0); + Variable y(1); + + TBox box(2, EMPTY); + + Pointset_Powerset<TBD_Shape> pps(box); + + Pointset_Powerset<TBD_Shape> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of bd shapes from a powerset of boxes. +bool +test06() { + Variable x(0); + Variable y(1); + + Constraint_System cs; + cs.insert(x >= 1); + cs.insert(y <= 0); + TBox box(cs); + + // The complexity should be ignored. + Pointset_Powerset<TBox> pps_box(box, POLYNOMIAL_COMPLEXITY); + + // The complexity should be ignored. + Pointset_Powerset<TBD_Shape> pps(pps_box, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<TBD_Shape> known_pps(2); + known_pps.add_constraint(x >= 1); + known_pps.add_constraint(y <= 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TBD_Shape>::const_iterator i_bds = pps.begin(); + TBD_Shape bdsi = i_bds->pointset(); + print_constraints(bdsi, "*** bdsi ***"); + + return ok; +} + +// Constructs the powerset of octagonal_shapes from a box. +bool +test07() { + Variable x(0); + Variable y(1); + + TBox box(2); + box.add_constraint(x >= 0); + box.add_constraint(y >= 0); + + // Complexity should be ignored. + Pointset_Powerset<TOctagonal_Shape> pps(box, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<TOctagonal_Shape> known_pps(2); + known_pps.add_constraint(x >= 0); + known_pps.add_constraint(y >= 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TOctagonal_Shape>::const_iterator i = pps.begin(); + TOctagonal_Shape osi = i->pointset(); + print_constraints(osi, "*** osi ***"); + + return ok; +} + +// Constructs the powerset of octagonal_shapes from an empty box. +bool +test08() { + Variable x(0); + Variable y(1); + + TBox box(2, EMPTY); + + Pointset_Powerset<TOctagonal_Shape> pps(box); + + Pointset_Powerset<TOctagonal_Shape> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of octagonal_shapes from a powerset of boxes. +bool +test09() { + Variable x(0); + Variable y(1); + + Constraint_System cs; + cs.insert(x >= 1); + cs.insert(y <= 0); + TBox box(cs); + + // The complexity should be ignored. + Pointset_Powerset<TBox> pps_box(box, POLYNOMIAL_COMPLEXITY); + + // The complexity should be ignored. + Pointset_Powerset<TOctagonal_Shape> pps(pps_box, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<TOctagonal_Shape> known_pps(2); + known_pps.add_constraint(x >= 1); + known_pps.add_constraint(y <= 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TOctagonal_Shape>::const_iterator i_os = pps.begin(); + TOctagonal_Shape osi = i_os->pointset(); + print_constraints(osi, "*** osi ***"); + + return ok; +} + +// Constructs the powerset of boxes from a box. +bool +test10() { + Variable x(0); + Variable y(1); + Variable z(2); + Variable w(3); + + TBox box(4); + box.add_constraint(x >= 2); + box.add_constraint(z == 1); + + Pointset_Powerset<TBox> pps1(box); + Pointset_Powerset<TBox> pps2(4, EMPTY); + pps2.add_disjunct(box); + + bool ok = (pps1 == pps2); + + print_constraints(box, "*** box ***"); + Pointset_Powerset<TBox>::const_iterator i = pps1.begin(); + TBox boxi = i->pointset(); + print_constraints(boxi, "*** boxi ***"); + Pointset_Powerset<TBox>::const_iterator i2 = pps2.begin(); + TBox boxi2 = i2->pointset(); + print_constraints(boxi2, "*** boxi2 ***"); + + return ok && pps1.OK(); +} + +// Constructs the powerset of boxes from an empty box. +bool +test11() { + Variable x(0); + Variable y(1); + + Rational_Box box(2, EMPTY); + + Pointset_Powerset<TBox> pps(box); + + Pointset_Powerset<TBox> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of boxes from a powerset of boxes. +bool +test12() { + Variable x(0); + Variable y(1); + + Constraint_System cs; + cs.insert(x >= 1); + cs.insert(x <= 1); + cs.insert(y <= 0); + TBox box(cs); + + // The complexity should be ignored. + Pointset_Powerset<TBox> pps_box(box, POLYNOMIAL_COMPLEXITY); + + // The complexity should be ignored. + Pointset_Powerset<TBox> pps(pps_box, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<TBox> known_pps(2); + known_pps.add_constraint(x == 1); + known_pps.add_constraint(y <= 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TBox>::const_iterator j = pps.begin(); + TBox boxj = j->pointset(); + print_constraints(boxj, "*** pps disjunct ***"); + + return ok; +} + +// Constructs the powerset of grids from a box. +bool +test13() { + Variable x(0); + Variable y(1); + + Rational_Box box(2); + box.add_constraint(x >= 0); + box.add_constraint(2*x == 1); + box.add_constraint(y >= 0); + + Pointset_Powerset<Grid> pps(box); + + Pointset_Powerset<Grid> known_pps(2); + known_pps.add_constraint(2*x == 1); + + bool ok = (pps == known_pps); + + Pointset_Powerset<Grid>::const_iterator i = pps.begin(); + Grid phi = i->pointset(); + print_congruences(phi, "*** phi ***"); + + return ok; +} + +// Constructs the powerset of grids from an empty box. +bool +test14() { + Variable x(0); + Variable y(1); + + Rational_Box box(2, EMPTY); + + Pointset_Powerset<Grid> pps(box); + + Pointset_Powerset<Grid> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of grids from a powerset of boxes. +bool +test15() { + Variable x(0); + Variable y(1); + + Constraint_System cs; + cs.insert(x >= 1); + cs.insert(x <= 1); + cs.insert(y <= 0); + TBox box(cs); + + // The complexity should be ignored. + Pointset_Powerset<TBox> pps_box(box, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<TBox>::const_iterator i_box = pps_box.begin(); + TBox boxi = i_box->pointset(); + print_constraints(boxi, "*** boxi ***"); + + // The complexity should be ignored. + Pointset_Powerset<Grid> pps(pps_box, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<Grid> known_pps(2); + known_pps.add_constraint(x == 1); + + bool ok = (pps == known_pps); + + Pointset_Powerset<Grid>::const_iterator i_gr = pps.begin(); + Grid gri = i_gr->pointset(); + print_congruences(gri, "*** gri ***"); + + return ok; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); + DO_TEST(test04); + DO_TEST(test05); + DO_TEST(test06); + DO_TEST(test07); + DO_TEST(test08); + DO_TEST(test09); + DO_TEST(test10); + DO_TEST(test11); + DO_TEST(test12); + DO_TEST(test13); + DO_TEST(test14); + DO_TEST(test15); +END_MAIN diff --git a/tests/Powerset/fromcongruences1.cc b/tests/Powerset/fromcongruences1.cc new file mode 100644 index 000000000..779e9359d --- /dev/null +++ b/tests/Powerset/fromcongruences1.cc @@ -0,0 +1,78 @@ +/* Test Pointset_Powerset<PH>:: + Pointset_Powerset(Congruence_System). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +bool +test01() { + Congruence_System cs; + Pointset_Powerset<C_Polyhedron> ps(cs); + + bool ok = (ps.OK() && ps.is_universe() && ps.space_dimension() == 0); + + return ok; +} + +bool +test02() { + Variable A(0); + Variable B(1); + + Congruence_System cs; + cs.insert((A %= -1) / 0); + cs.insert((B %= 1) / 0); + Pointset_Powerset<C_Polyhedron> ps(cs); + + bool ok = (ps.OK() && !ps.is_universe() && ps.space_dimension() == 2); + + return ok; +} + +bool +test03() { + Variable A(0); + Variable B(1); + Variable C(2); + + Congruence_System cs; + cs.insert((A %= -1) / 0); + cs.insert((B %= 1)/ 0); + cs.insert((C %= 2) / 0); + cs.insert((C %= 1) / 0); + Pointset_Powerset<C_Polyhedron> ps(cs); + + bool ok = (ps.OK() && ps.is_empty() && ps.space_dimension() == 3); + + return ok; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); +END_MAIN diff --git a/tests/Powerset/fromconstraints1.cc b/tests/Powerset/fromconstraints1.cc new file mode 100644 index 000000000..aa32fe272 --- /dev/null +++ b/tests/Powerset/fromconstraints1.cc @@ -0,0 +1,180 @@ +/* Test Pointset_Powerset<PH>::Pointset_Powerset(Constraint_System). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Construct powerset of polyhedra from a 0 dimension empty constraint system. +bool +test01() { + Constraint_System cs = Constraint_System::zero_dim_empty(); + Pointset_Powerset<C_Polyhedron> ps(cs); + return ps.OK() && ps.is_empty() && ps.space_dimension() == 0; +} + +// Construct powerset of polyhedra from a non-empty constraint system. +bool +test02() { + Variable x(0); + Variable y(1); + Variable z(2); + Constraint_System cs; + + cs.insert(x + y > 0); + cs.insert(x - 2*y <= 2); + cs.insert(z == 2); + Pointset_Powerset<NNC_Polyhedron> ps(cs); + + return ps.OK() && ps.space_dimension() == 3; +} + +// Construct powerset of bd shapes from a 0 dimension empty constraint system. +bool +test03() { + Constraint_System cs = Constraint_System::zero_dim_empty(); + Pointset_Powerset<TBD_Shape> ps(cs); + return ps.OK() && ps.is_empty() && ps.space_dimension() == 0; +} + +// Construct powerset of bd shapes from non-empty constraint system. +bool +test04() { + Variable x(0); + Variable y(1); + Variable z(2); + Constraint_System cs; + + cs.insert(x - y <= 2); + cs.insert(z == 2); + Pointset_Powerset<TBD_Shape> ps(cs); + + return ps.OK() && ps.space_dimension() == 3; +} + +// Construct powerset of octagonal shapes from a 0 dimension empty constraint system. +bool +test05() { + Constraint_System cs = Constraint_System::zero_dim_empty(); + Pointset_Powerset<TOctagonal_Shape> ps(cs); + return ps.OK() && ps.is_empty() && ps.space_dimension() == 0; +} + +// Construct powerset of octagonal shapes from non-empty constraint system. +bool +test06() { + Variable x(0); + Variable y(1); + Variable z(2); + Constraint_System cs; + + cs.insert(x + y >= -2); + cs.insert(x - y <= 2); + cs.insert(z == 2); + Pointset_Powerset<TOctagonal_Shape> ps(cs); + + return ps.OK() && ps.space_dimension() == 3; +} + +// Construct powerset of boxes from a 0 dimension empty constraint system. +bool +test07() { + Constraint_System cs = Constraint_System::zero_dim_empty(); + Pointset_Powerset<TBox> ps(cs); + + print_constraints(ps, "*** ps ***"); + + return ps.OK() && ps.is_empty() && ps.space_dimension() == 0; +} + +// Construct powerset of boxes from a non-empty constraint system. +bool +test08() { + Variable x(0); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + Pointset_Powerset<TBox> ps(cs); + + return ps.OK() && ps.space_dimension() == 1; +} + +// Construct powerset of grids from a 0 dimension empty constraint system. +bool +test09() { + Constraint_System cs = Constraint_System::zero_dim_empty(); + Pointset_Powerset<Grid> ps(cs); + + print_constraints(ps, "*** ps ***"); + + return ps.OK() && ps.is_empty() && ps.space_dimension() == 0; +} + +// Construct powerset of grids from non-empty constraint system. +bool +test10() { + Variable x(0); + Constraint_System cs; + + cs.insert(x == 0); + Pointset_Powerset<Grid> ps(cs); + + return ps.OK() && ps.space_dimension() == 1; +} + +// Construct powerset of products from a 0-dim inconsistent constraint system. + typedef Domain_Product<NNC_Polyhedron, Grid>::Constraints_Product CProduct; +bool +test11() { + Constraint_System cs = Constraint_System::zero_dim_empty(); + Pointset_Powerset<CProduct> pscp(cs); + return pscp.OK(); +} + +// Construct powerset of products from a 1-dim constraint system. +bool +test12() { + Variable A(0); + + CProduct cp(1); + cp.add_constraint(A == 0); + Pointset_Powerset<CProduct> pscp(1); + pscp.add_disjunct(cp); + return pscp.OK(); +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); + DO_TEST(test04); + DO_TEST(test05); + DO_TEST(test06); + DO_TEST(test07); + DO_TEST(test08); + DO_TEST(test09); + DO_TEST(test10); +END_MAIN diff --git a/tests/Powerset/fromgrid1.cc b/tests/Powerset/fromgrid1.cc new file mode 100644 index 000000000..3be7e3c54 --- /dev/null +++ b/tests/Powerset/fromgrid1.cc @@ -0,0 +1,435 @@ +/* Test Pointset_Powerset<PH>::Pointset_Powerset(Grid), + Pointset_Powerset<PH>::Pointset_Powerset(Pointset_Powerset(Grid)). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Constructs the powerset of polyhedra from a grid. +bool +test01() { + Variable x(0); + Variable y(1); + + Grid grid(2); + grid.add_congruence((2*x %= 1) / 0); + grid.add_congruence(y %= 0); + + Pointset_Powerset<C_Polyhedron> pps(grid); + + Pointset_Powerset<C_Polyhedron> known_pps(2); + + known_pps.add_constraint(2*x == 1); + + bool ok = (pps == known_pps); + + Pointset_Powerset<C_Polyhedron>::const_iterator i = pps.begin(); + C_Polyhedron phi = i->pointset(); + print_constraints(phi, "*** phi ***"); + + return ok; +} + +// Constructs the powerset of polyhedra from an empty grid. +bool +test02() { + Variable x(0); + Variable y(1); + + Grid grid(2, EMPTY); + + Pointset_Powerset<C_Polyhedron> pps(grid); + + Pointset_Powerset<C_Polyhedron> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of polyhedra from a powerset of grids. +bool +test03() { + Variable x(0); + Variable y(1); + + Grid grid(2); + grid.add_congruence((2*x %= 1) / 0); + grid.add_congruence(y %= 0); + + Pointset_Powerset<Grid> pps_gr(grid); + + Pointset_Powerset<C_Polyhedron> pps(pps_gr); + + Pointset_Powerset<C_Polyhedron> known_pps(2); + + known_pps.add_constraint(2*x == 1); + + bool ok = (pps == known_pps); + + Pointset_Powerset<C_Polyhedron>::const_iterator i = pps.begin(); + C_Polyhedron phi = i->pointset(); + print_constraints(phi, "*** phi ***"); + + return ok; +} + +// Constructs the powerset of bd shapes from a grid. +bool +test04() { + Variable x(0); + Variable y(1); + + Grid gr(2); + gr.add_congruence((2*x %= 1) / 0); + gr.add_congruence(y %= 0); + + Pointset_Powerset<TBD_Shape> pps(gr); + + Pointset_Powerset<TBD_Shape> known_pps(2); + known_pps.add_constraint(2*x == 1); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TBD_Shape>::const_iterator i = pps.begin(); + TBD_Shape bdsi = i->pointset(); + print_constraints(bdsi, "*** bdsi ***"); + + return ok; +} + +// Constructs the powerset of bd shapes from an empty grid. +bool +test05() { + Variable x(0); + Variable y(1); + + Grid gr(2, EMPTY); + + Pointset_Powerset<TBD_Shape> pps(gr); + + Pointset_Powerset<TBD_Shape> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of bd shapes from a powerset of grids. +bool +test06() { + Variable x(0); + Variable y(1); + + Grid gr(2); + gr.add_congruence((2*x %= 1) / 0); + gr.add_congruence(y %= 0); + + Pointset_Powerset<Grid> pps_gr(gr); + + Pointset_Powerset<TBD_Shape> pps(pps_gr); + + Pointset_Powerset<TBD_Shape> known_pps(2); + + known_pps.add_constraint(2*x == 1); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TBD_Shape>::const_iterator i = pps.begin(); + TBD_Shape bdsi = i->pointset(); + print_constraints(bdsi, "*** bdsi ***"); + + return ok; +} + +// Constructs the powerset of octagonal_shapes from a grid. +bool +test07() { + Variable x(0); + Variable y(1); + + Grid gr(2); + gr.add_congruence((2*x %= 1) / 0); + gr.add_congruence(y %= 0); + + Pointset_Powerset<TOctagonal_Shape> pps(gr); + + Pointset_Powerset<TOctagonal_Shape> known_pps(2); + known_pps.add_constraint(2*x == 1); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TOctagonal_Shape>::const_iterator i = pps.begin(); + TOctagonal_Shape osi = i->pointset(); + print_constraints(osi, "*** osi ***"); + + return ok; +} + +// Constructs the powerset of octagonal_shapes from an empty grid. +bool +test08() { + Variable x(0); + Variable y(1); + + Grid gr(2, EMPTY); + + Pointset_Powerset<TOctagonal_Shape> pps(gr); + + Pointset_Powerset<TOctagonal_Shape> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of octagonal_shapes from a powerset of grids. +bool +test09() { + Variable x(0); + Variable y(1); + + Grid gr(2); + gr.add_congruence((2*x %= 1) / 0); + gr.add_congruence(y %= 0); + + Pointset_Powerset<Grid> pps_gr(gr); + + Pointset_Powerset<TOctagonal_Shape> pps(pps_gr); + + Pointset_Powerset<TOctagonal_Shape> known_pps(2); + + known_pps.add_constraint(2*x == 1); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TOctagonal_Shape>::const_iterator i = pps.begin(); + TOctagonal_Shape osi = i->pointset(); + print_constraints(osi, "*** osi ***"); + + return ok; +} + +// Constructs the powerset of boxes from a grid. +bool +test10() { + Variable x(0); + Variable y(1); + + Grid gr(2); + gr.add_congruence((2*x %= 1) / 0); + gr.add_congruence(y %= 0); + + Pointset_Powerset<TBox> pps(gr); + + Pointset_Powerset<TBox> known_pps(2); + known_pps.add_constraint(2*x == 1); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TBox>::const_iterator i = pps.begin(); + TBox phi = i->pointset(); + print_constraints(phi, "*** phi ***"); + + return ok; +} + +// Constructs the powerset of boxes from an empty grid. +bool +test11() { + Variable x(0); + Variable y(1); + + Grid gr(2, EMPTY); + + Pointset_Powerset<TBox> pps(gr); + + Pointset_Powerset<TBox> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of boxes from a powerset of grids. +bool +test12() { + Variable x(0); + Variable y(1); + + Grid gr(2); + gr.add_congruence((2*x %= 1) / 0); + gr.add_congruence(y %= 0); + + Pointset_Powerset<Grid> pps_gr(gr); + + Pointset_Powerset<TBox> pps(pps_gr); + + Pointset_Powerset<TBox> known_pps(2); + + known_pps.add_constraint(2*x == 1); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TBox>::const_iterator i = pps.begin(); + TBox boxi = i->pointset(); + print_constraints(boxi, "*** boxi ***"); + + return ok; +} + +// Constructs the powerset of grids from a grid. +bool +test13() { + Variable x(0); + Variable y(1); + Variable z(2); + Variable w(3); + + Grid gr(4); + gr.add_congruence(x %= 2); + gr.add_constraint(z == 1); + + Pointset_Powerset<Grid> pps1(gr); + Pointset_Powerset<Grid> pps2(4, EMPTY); + pps2.add_disjunct(gr); + + bool ok = (pps1 == pps2); + + print_congruences(gr, "*** gr ***"); + Pointset_Powerset<Grid>::const_iterator i = pps1.begin(); + Grid gri = i->pointset(); + print_congruences(gri, "*** gri ***"); + Pointset_Powerset<Grid>::const_iterator i2 = pps2.begin(); + Grid gri2 = i2->pointset(); + print_congruences(gri2, "*** gri2 ***"); + + return ok && pps1.OK(); +} + +// Constructs the powerset of boxes from an empty grid. +bool +test14() { + Variable x(0); + Variable y(1); + + Grid gr(2, EMPTY); + + Pointset_Powerset<TBox> pps(gr); + + Pointset_Powerset<TBox> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of grids from a powerset of grids. +bool +test15() { + Variable x(0); + Variable y(1); + + Grid grid(2); + grid.add_congruence((2*x %= 1) / 0); + grid.add_congruence(y %= 0); + + Pointset_Powerset<Grid> pps_gr(grid); + + Pointset_Powerset<Grid> pps(pps_gr); + + Pointset_Powerset<Grid> known_pps(2); + + known_pps.add_constraint(2*x == 1); + known_pps.add_congruence(y %= 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<Grid>::const_iterator i = pps.begin(); + Grid gri = i->pointset(); + print_congruences(gri, "*** gri ***"); + + return ok; +} + +// Constructs the powerset of NNC polyhedra from a powerset of grids +// where set of grids is omega reduced but the constructed set +// of NNC polyhedra is not omega reduced. +bool +test16() { + Variable x(0); + Variable y(1); + + Grid grid1(2); + grid1.add_congruence((x %= 0) / 2); + grid1.add_congruence((y %= 0) / 2); + Grid grid2(2); + grid2.add_congruence((x %= 1) / 2); + grid2.add_congruence((y %= 1) / 0); + + Pointset_Powerset<Grid> pps_gr(grid1); + pps_gr.add_disjunct(grid2); + + // At this stage, pps_gr is omega reduced but pps_gr.reduced flag will + // be set to false. + // So we add this test to set the omega reduction pps_gr.reduced + // flag to true. + pps_gr.is_topologically_closed(); + + Pointset_Powerset<NNC_Polyhedron> pps(pps_gr); + + // pps is not omega reduced. + bool ok = (pps.size() == 2); + + Pointset_Powerset<NNC_Polyhedron> known_pps(2); + + ok = ok && (pps == known_pps) && pps.OK(); + + Pointset_Powerset<NNC_Polyhedron>::const_iterator i = pps.begin(); + NNC_Polyhedron phi = i->pointset(); + print_constraints(phi, "*** phi ***"); + + return ok; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); + DO_TEST(test04); + DO_TEST(test05); + DO_TEST(test06); + DO_TEST(test07); + DO_TEST(test08); + DO_TEST(test09); + DO_TEST(test10); + DO_TEST(test11); + DO_TEST(test12); + DO_TEST(test13); + DO_TEST(test14); + DO_TEST(test15); + DO_TEST(test16); +END_MAIN diff --git a/tests/Powerset/fromoctagonalshape1.cc b/tests/Powerset/fromoctagonalshape1.cc new file mode 100644 index 000000000..ac3fd92e9 --- /dev/null +++ b/tests/Powerset/fromoctagonalshape1.cc @@ -0,0 +1,432 @@ +/* Test Pointset_Powerset<PH>::Pointset_Powerset(BD_Shape<T>), + Pointset_Powerset<PH>::Pointset_Powerset(Pointset_Powerset(BD_Shape<T>)). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Constructs the powerset of polyhedra from an octagonal shape. +bool +test01() { + Variable x(0); + Variable y(1); + + TOctagonal_Shape os(2); + os.add_constraint(x >= 0); + os.add_constraint(x - y <= 1); + os.add_constraint(y >= 0); + + Pointset_Powerset<C_Polyhedron> pps(os); + + Pointset_Powerset<C_Polyhedron> known_pps(2); + known_pps.add_constraint(x >= 0); + known_pps.add_constraint(x - y <= 1); + known_pps.add_constraint(y >= 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<C_Polyhedron>::const_iterator i = pps.begin(); + C_Polyhedron phi = i->pointset(); + print_constraints(phi, "*** phi ***"); + + return ok; +} + +// Constructs the powerset of polyhedra from an empty octagonal shape. +bool +test02() { + Variable x(0); + Variable y(1); + + TOctagonal_Shape os(2, EMPTY); + + Pointset_Powerset<C_Polyhedron> pps(os); + + Pointset_Powerset<C_Polyhedron> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of polyhedra from a powerset of octagonal shapes. +bool +test03() { + Variable x(0); + Variable y(1); + + Constraint_System cs; + cs.insert(x >= 1); + cs.insert(x <= 1); + cs.insert(y <= 0); + TOctagonal_Shape os(cs); + + // The complexity should be ignored. + Pointset_Powerset<TOctagonal_Shape> pps_os(os, POLYNOMIAL_COMPLEXITY); + + // The complexity should be ignored. + Pointset_Powerset<C_Polyhedron> pps(pps_os, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<C_Polyhedron> known_pps(2); + known_pps.add_constraint(x == 1); + known_pps.add_constraint(y <= 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<C_Polyhedron>::const_iterator j = pps.begin(); + C_Polyhedron phj = j->pointset(); + print_constraints(phj, "*** pps disjunct ***"); + + return ok; +} + +// Constructs the powerset of bd shapes from an octagonal shape. +bool +test04() { + Variable x(0); + Variable y(1); + + TOctagonal_Shape os(2); + os.add_constraint(x == 0); + os.add_constraint(x + y <= 3); + os.add_constraint(y >= 1); + + Pointset_Powerset<TBD_Shape> pps(os); + + Pointset_Powerset<TBD_Shape> known_pps(2); + known_pps.add_constraint(x == 0); + known_pps.add_constraint(y >= 1); + known_pps.add_constraint(y <= 3); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TBD_Shape>::const_iterator i = pps.begin(); + TBD_Shape bdsi = i->pointset(); + print_constraints(bdsi, "*** bdsi ***"); + + return ok; +} + +// Constructs the powerset of bd shapes from an empty octagonal shape. +bool +test05() { + Variable x(0); + Variable y(1); + + TOctagonal_Shape os(2, EMPTY); + + Pointset_Powerset<TBD_Shape> pps(os); + + Pointset_Powerset<TBD_Shape> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of bd shapes from a powerset of octagonal shapes. +bool +test06() { + Variable x(0); + Variable y(1); + + Constraint_System cs; + cs.insert(x >= 1); + cs.insert(x - y <= 1); + cs.insert(y <= 0); + TOctagonal_Shape os(cs); + + // The complexity should be ignored. + Pointset_Powerset<TOctagonal_Shape> pps_os(os, POLYNOMIAL_COMPLEXITY); + + // The complexity should be ignored. + Pointset_Powerset<TBD_Shape> pps(pps_os, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<TBD_Shape> known_pps(2); + known_pps.add_constraint(x == 1); + known_pps.add_constraint(y == 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TBD_Shape>::const_iterator i_bds = pps.begin(); + TBD_Shape bdsi = i_bds->pointset(); + print_constraints(bdsi, "*** bdsi ***"); + + return ok; +} + +// Constructs the powerset of octagonal_shapes from an octagonal shape. +bool +test07() { + Variable x(0); + Variable y(1); + Variable z(2); + Variable w(3); + + TOctagonal_Shape os(4); + os.add_constraint(x >= 2); + os.add_constraint(x + y <= 4); + os.add_constraint(z == 1); + + Pointset_Powerset<TOctagonal_Shape> pps1(os); + Pointset_Powerset<TOctagonal_Shape> pps2(4, EMPTY); + pps2.add_disjunct(os); + + bool ok = (pps1 == pps2); + + Pointset_Powerset<TOctagonal_Shape>::const_iterator i = pps1.begin(); + TOctagonal_Shape osi = i->pointset(); + print_constraints(osi, "*** osi ***"); + Pointset_Powerset<TOctagonal_Shape>::const_iterator i2 = pps2.begin(); + TOctagonal_Shape osi2 = i2->pointset(); + print_constraints(osi2, "*** osi2 ***"); + + return ok && pps1.OK(); +} + +// Constructs the powerset of octagonal_shapes from an empty octagonal shape. +bool +test08() { + Variable x(0); + Variable y(1); + + TOctagonal_Shape os(2, EMPTY); + + Pointset_Powerset<TOctagonal_Shape> pps(os); + + Pointset_Powerset<TOctagonal_Shape> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of octagonal_shapes from a powerset of +// octagonal_shapes. +bool +test09() { + Variable x(0); + Variable y(1); + + Constraint_System cs; + cs.insert(x >= 1); + cs.insert(x <= 1); + cs.insert(y <= 0); + TOctagonal_Shape os(cs); + + // The complexity should be ignored. + Pointset_Powerset<TOctagonal_Shape> pps_os(os, POLYNOMIAL_COMPLEXITY); + + // The complexity should be ignored. + Pointset_Powerset<TOctagonal_Shape> pps(pps_os, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<TOctagonal_Shape> known_pps(2); + known_pps.add_constraint(x == 1); + known_pps.add_constraint(y <= 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TOctagonal_Shape>::const_iterator j = pps.begin(); + TOctagonal_Shape osj = j->pointset(); + print_constraints(osj, "*** pps disjunct ***"); + + return ok; +} + +// Constructs the powerset of boxes from an octagonal shape. +bool +test10() { + Variable x(0); + Variable y(1); + + TOctagonal_Shape os(2); + os.add_constraint(x >= 0); + os.add_constraint(x + y <= 4); + os.add_constraint(x - y == 3); + os.add_constraint(y >= 0); + + // Complexity should be ignored. + Pointset_Powerset<TBox> pps(os, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<TBox> known_pps(2); + known_pps.add_constraint(x >= 3); + known_pps.add_constraint(2*x <= 7); + known_pps.add_constraint(y >= 0); + known_pps.add_constraint(2*y <= 1); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TBox>::const_iterator i = pps.begin(); + TBox phi = i->pointset(); + print_constraints(phi, "*** phi ***"); + + return ok; +} + +// Constructs the powerset of boxes from an empty octagonal shape. +bool +test11() { + Variable x(0); + Variable y(1); + + TOctagonal_Shape os(2, EMPTY); + + Pointset_Powerset<TBox> pps(os); + + Pointset_Powerset<TBox> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of boxes from a powerset of octagonal shapes. +bool +test12() { + Variable x(0); + Variable y(1); + + Constraint_System cs; + cs.insert(x >= 1); + cs.insert(x - y <= 1); + cs.insert(y <= 0); + TOctagonal_Shape os(cs); + + // The complexity should be ignored. + Pointset_Powerset<TOctagonal_Shape> pps_os(os, POLYNOMIAL_COMPLEXITY); + + // The complexity should be ignored. + Pointset_Powerset<TBox> pps(pps_os, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<TBox> known_pps(2); + known_pps.add_constraint(x == 1); + known_pps.add_constraint(y == 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<TBox>::const_iterator i_box = pps.begin(); + TBox boxi = i_box->pointset(); + print_constraints(boxi, "*** boxi ***"); + + return ok; +} + +// Constructs the powerset of grids from an octagonal shape. +bool +test13() { + Variable x(0); + Variable y(1); + + TOctagonal_Shape os(2); + os.add_constraint(x >= 0); + os.add_constraint(x + y <= 4); + os.add_constraint(x - y == 3); + os.add_constraint(y >= 0); + + // Complexity should be ignored. + Pointset_Powerset<Grid> pps(os, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<Grid> known_pps(2); + known_pps.add_constraint(x - y == 3); + + bool ok = (pps == known_pps); + + Pointset_Powerset<Grid>::const_iterator i = pps.begin(); + Grid phi = i->pointset(); + print_congruences(phi, "*** phi ***"); + + return ok; +} + +// Constructs the powerset of grids from an empty octagonal shape. +bool +test14() { + Variable x(0); + Variable y(1); + + TOctagonal_Shape os(2, EMPTY); + + Pointset_Powerset<Grid> pps(os); + + Pointset_Powerset<Grid> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of grids from a powerset of octagonal shapes. +bool +test15() { + Variable x(0); + Variable y(1); + + Constraint_System cs; + cs.insert(x >= 1); + cs.insert(x - y <= 1); + cs.insert(y <= 0); + TOctagonal_Shape os(cs); + + // The complexity should be ignored. + Pointset_Powerset<TOctagonal_Shape> pps_os(os, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<TOctagonal_Shape>::const_iterator i_os = pps_os.begin(); + TOctagonal_Shape osi = i_os->pointset(); + print_constraints(osi, "*** osi ***"); + + // The complexity should be ignored. + Pointset_Powerset<Grid> pps(pps_os, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<Grid> known_pps(2); + known_pps.add_constraint(x == 1); + known_pps.add_constraint(y == 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<Grid>::const_iterator i_gr = pps.begin(); + Grid gri = i_gr->pointset(); + print_congruences(gri, "*** gri ***"); + + return ok; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); + DO_TEST(test04); + DO_TEST(test05); + DO_TEST(test06); + DO_TEST(test07); + DO_TEST(test08); + DO_TEST(test09); + DO_TEST(test10); + DO_TEST(test11); + DO_TEST(test12); + DO_TEST(test13); + DO_TEST(test14); + DO_TEST(test15); +END_MAIN diff --git a/tests/Powerset/frompolyhedron1.cc b/tests/Powerset/frompolyhedron1.cc new file mode 100644 index 000000000..0a0335865 --- /dev/null +++ b/tests/Powerset/frompolyhedron1.cc @@ -0,0 +1,741 @@ +/* Test Pointset_Powerset<PH>::Pointset_Powerset(C_Polyhedron), + Pointset_Powerset<PH>::Pointset_Powerset(NNC_Polyhedron). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Constructs the powerset of polyhedra from an empty polyhedron. +bool +test01() { + C_Polyhedron c_ph(0, EMPTY); + Pointset_Powerset<C_Polyhedron> c_ps(c_ph); + + bool ok = (c_ps.OK() && c_ps.is_empty() && c_ps.space_dimension() == 0); + + NNC_Polyhedron nnc_ph(0, EMPTY); + Pointset_Powerset<NNC_Polyhedron> nnc_ps(nnc_ph); + + ok = ok + && (nnc_ps.OK() && nnc_ps.is_empty() && nnc_ps.space_dimension() == 0); + + return ok; +} + +// Constructs the powerset of polyhedra from a closed polyhedron. +bool +test02() { + Variable x(0); + Variable y(1); + Variable z(2); + Variable w(3); + + C_Polyhedron c_ph(4); + c_ph.add_constraint(x <= 2); + c_ph.add_constraint(z == 1); + NNC_Polyhedron nnc_ph(c_ph); + + Pointset_Powerset<C_Polyhedron> c_pps1(c_ph); + Pointset_Powerset<C_Polyhedron> c_pps2(4, EMPTY); + c_pps2.add_disjunct(c_ph); + + Pointset_Powerset<NNC_Polyhedron> nnc_pps1(c_ph); + Pointset_Powerset<NNC_Polyhedron> nnc_pps2(4, EMPTY); + nnc_pps2.add_disjunct(nnc_ph); + + bool ok = (c_pps1 == c_pps2 && nnc_pps1 == nnc_pps2); + + Pointset_Powerset<C_Polyhedron>::const_iterator c_i = c_pps1.begin(); + C_Polyhedron c_phi = c_i->pointset(); + print_constraints(c_phi, "*** c_phi ***"); + Pointset_Powerset<NNC_Polyhedron>::const_iterator nnc_i = nnc_pps1.begin(); + NNC_Polyhedron nnc_phi = nnc_i->pointset(); + print_constraints(nnc_phi, "*** nnc_phi ***"); + + return ok && c_pps1.OK() && nnc_pps1.OK(); +} + +// Constructs the powerset of polyhedra from an nnc polyhedron. +bool +test03() { + Variable x(0); + Variable y(1); + Variable z(2); + Variable w(3); + + NNC_Polyhedron nnc_ph(4); + nnc_ph.add_constraint(x <= 2); + nnc_ph.add_constraint(z == 1); + C_Polyhedron c_ph(nnc_ph); + + Pointset_Powerset<C_Polyhedron> c_pps1(nnc_ph); + Pointset_Powerset<C_Polyhedron> c_pps2(4, EMPTY); + c_pps2.add_disjunct(c_ph); + + Pointset_Powerset<NNC_Polyhedron> nnc_pps1(nnc_ph); + Pointset_Powerset<NNC_Polyhedron> nnc_pps2(4, EMPTY); + nnc_pps2.add_disjunct(nnc_ph); + + bool ok = (c_pps1 == c_pps2 && nnc_pps1 == nnc_pps2); + + Pointset_Powerset<C_Polyhedron>::const_iterator c_i = c_pps1.begin(); + C_Polyhedron c_phi = c_i->pointset(); + print_constraints(c_phi, "*** c_phi ***"); + Pointset_Powerset<NNC_Polyhedron>::const_iterator nnc_i = nnc_pps1.begin(); + NNC_Polyhedron nnc_phi = nnc_i->pointset(); + print_constraints(nnc_phi, "*** nnc_phi ***"); + + return ok && c_pps1.OK() && nnc_pps1.OK(); +} + +// Constructs the powerset of nnc polyhedra from a powerset of +// closed polyhedra. +bool +test04() { + Variable x(0); + Variable y(1); + + C_Polyhedron ph(2); + ph.add_constraint(2*x == 1); + ph.add_constraint(y >= 0); + + Pointset_Powerset<C_Polyhedron> pps_c(ph); + + Pointset_Powerset<NNC_Polyhedron> pps(pps_c); + + Pointset_Powerset<NNC_Polyhedron> known_pps(2); + + known_pps.add_constraint(2*x == 1); + known_pps.add_constraint(y >= 0); + + bool ok = (pps == known_pps); + + Pointset_Powerset<NNC_Polyhedron>::const_iterator i = pps.begin(); + NNC_Polyhedron phi = i->pointset(); + print_constraints(phi, "*** phi ***"); + + return ok; +} + +// Constructs the powerset of nnc polyhedra from a powerset of +// closed polyhedra. +bool +test05() { + Variable x(0); + Variable y(1); + + Pointset_Powerset<C_Polyhedron> pps(2); + + pps.add_constraint(x >= 1); + pps.add_constraint(x <= 1); + pps.add_constraint(y >= 0); + + Pointset_Powerset<C_Polyhedron> pps1(pps, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<C_Polyhedron>::const_iterator i1 = pps.begin(); + C_Polyhedron phi1 = i1->pointset(); + print_constraints(phi1, "*** phi1 ***"); + + pps.OK(); + + Pointset_Powerset<C_Polyhedron>::const_iterator i = pps.begin(); + C_Polyhedron phi = i->pointset(); + phi.OK(); + print_constraints(phi, "*** phi after ok check ***"); + + bool ok = true; + + return ok; +} + +// Constructs the powerset of bd shapes from a polyhedron. +bool +test06() { + Variable x(0); + Variable y(1); + Variable z(2); + Variable w(3); + + C_Polyhedron ph(4); + ph.add_constraint(3*x >= 2); + ph.add_constraint(z >= 1); + ph.add_constraint(3*x + z <= 3); + C_Polyhedron ph1(ph); + + // With the default complexity, the implied equalities 4*x = 2 and z = 1. + // are found + Pointset_Powerset<TBD_Shape> pps(ph); + Pointset_Powerset<TBD_Shape>::const_iterator i = pps.begin(); + TBD_Shape bdsi = i->pointset(); + + BD_Shape<mpq_class> known_bdsi(4); + known_bdsi.add_constraint(3*x == 2); + known_bdsi.add_constraint(z == 1); + + bool ok = check_result(bdsi, known_bdsi, "5.97e-8", "3.15e-8", "1.99e-8"); + + print_constraints(bdsi, "*** bdsi ***"); + print_constraints(known_bdsi, "*** known_bdsi ***"); + + // With the polynomial complexity, implied equalities are not found. + Pointset_Powerset<TBD_Shape> pps1(ph1, POLYNOMIAL_COMPLEXITY); + Pointset_Powerset<TBD_Shape>::const_iterator i1 = pps1.begin(); + TBD_Shape bdsi1 = i1->pointset(); + + BD_Shape<mpq_class> known_bdsi1(4); + known_bdsi1.add_constraint(3*x >= 2); + known_bdsi1.add_constraint(z >= 1); + + ok = check_result(bdsi1, known_bdsi1, "3.98e-8", "3.98e-8", "3.98e-8") && ok; + + print_constraints(bdsi1, "*** bdsi1 ***"); + print_constraints(known_bdsi1, "*** known_bds1i ***"); + + ok = ok && pps.OK() && pps1.OK(); + + Pointset_Powerset<TBD_Shape>::const_iterator i_ok = pps.begin(); + TBD_Shape bdsi_ok = i_ok->pointset(); + Pointset_Powerset<TBD_Shape>::const_iterator i1_ok = pps1.begin(); + TBD_Shape bdsi1_ok = i1_ok->pointset(); + + print_constraints(bdsi_ok, "*** bdsi after OK() ***"); + print_constraints(bdsi1_ok, "*** bdsi1 after OK() ***"); + + return ok; +} + +// Constructs the powerset of bd shapes from a polyhedron whose +// constraints are inconsistent (i.e., is empty but not marked as +// empty). +bool +test07() { + Variable x(0); + Variable y(1); + Variable z(2); + Variable w(3); + + C_Polyhedron ph(4); + ph.add_constraint(3*x >= 2); + ph.add_constraint(z >= 1); + ph.add_constraint(3*x + z <= 2); + C_Polyhedron ph1(ph); + + // With the default complexity, the built powerset is empty. + Pointset_Powerset<TBD_Shape> pps(ph); + // With the polynomial complexity, the built powerset is non-empty. + Pointset_Powerset<TBD_Shape> pps1(ph1, POLYNOMIAL_COMPLEXITY); + + BD_Shape<mpq_class> known_bds1(4); + known_bds1.add_constraint(3*x >= 2); + known_bds1.add_constraint(z >= 1); + + Pointset_Powerset<TBD_Shape>::const_iterator i1 = pps1.begin(); + TBD_Shape bdsi1 = i1->pointset(); + + bool ok = check_result(bdsi1, known_bds1, "1.92e-7", "8.89e-8", "7.95e-8") + && pps.is_empty(); + + print_constraints(bdsi1, "*** bdsi1 ***"); + + return ok && pps.OK() && pps1.OK(); +} + +// Constructs the powerset of bd shapes from an empty polyhedron. +bool +test08() { + Variable x(0); + Variable y(1); + + NNC_Polyhedron ph(2, EMPTY); + + Pointset_Powerset<TBD_Shape> pps(ph); + + Pointset_Powerset<TBD_Shape> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of bd shapes from a powerset of polyhedra. +bool +test09() { + Variable x(0); + Variable y(1); + + Constraint_System cs; + cs.insert(2*x >= 1); + cs.insert(2*x + y <= 1); + cs.insert(y >= 0); + C_Polyhedron ph1(cs); + C_Polyhedron ph2(cs); + + Pointset_Powerset<C_Polyhedron> pps1_c(ph1, POLYNOMIAL_COMPLEXITY); + Pointset_Powerset<C_Polyhedron> pps2_c(ph2); + + Pointset_Powerset<TBD_Shape> pps1(pps1_c, POLYNOMIAL_COMPLEXITY); + Pointset_Powerset<TBD_Shape> pps2(pps2_c); + + Pointset_Powerset<TBD_Shape> known_pps1(2); + known_pps1.add_constraint(2*x >= 1); + known_pps1.add_constraint(y >= 0); + Pointset_Powerset<TBD_Shape> known_pps2(2); + known_pps2.add_constraint(2*x == 1); + known_pps2.add_constraint(y == 0); + + bool ok = (pps1 == known_pps1 && pps2 == known_pps2); + + Pointset_Powerset<TBD_Shape>::const_iterator i1 = pps1.begin(); + TBD_Shape bdsi1 = i1->pointset(); + print_constraints(bdsi1, "*** bdsi1 ***"); + + Pointset_Powerset<TBD_Shape>::const_iterator i2 = pps2.begin(); + TBD_Shape bdsi2 = i2->pointset(); + print_constraints(bdsi2, "*** bdsi2 ***"); + + return ok; +} + +// Constructs the powerset of octagonal_shapes from a polyhedron. +bool +test10() { + Variable x(0); + Variable y(1); + Variable z(2); + Variable w(3); + + C_Polyhedron ph(4); + ph.add_constraint(3*x >= 2); + ph.add_constraint(z >= 1); + ph.add_constraint(3*x + z <= 3); + C_Polyhedron ph1(ph); + + // With the default complexity, the implied equalities 4*x = 2 and z = 1. + // are found + Pointset_Powerset<TOctagonal_Shape> pps(ph); + Pointset_Powerset<TOctagonal_Shape>::const_iterator i = pps.begin(); + TOctagonal_Shape osi = i->pointset(); + + Octagonal_Shape<mpq_class> known_osi(4); + known_osi.add_constraint(3*x == 2); + known_osi.add_constraint(z == 1); + + bool ok = check_result(osi, known_osi, "1.193e-7", "5.45e-8", "3.98e-8"); + + print_constraints(osi, "*** osi ***"); + print_constraints(known_osi, "*** known_osi ***"); + + // With the polynomial complexity, implied equalities are not found. + Pointset_Powerset<TOctagonal_Shape> pps1(ph1, POLYNOMIAL_COMPLEXITY); + Pointset_Powerset<TOctagonal_Shape>::const_iterator i1 = pps1.begin(); + TOctagonal_Shape osi1 = i1->pointset(); + + Octagonal_Shape<mpq_class> known_osi1(4); + known_osi1.add_constraint(3*x >= 2); + known_osi1.add_constraint(z >= 1); + + ok = check_result(osi1, known_osi1, "1.193e-7", "8.89e-8", "7.95e-8") && ok; + + print_constraints(osi1, "*** osi1 ***"); + print_constraints(known_osi1, "*** known_osi1 ***"); + + ok = ok && pps.OK() && pps1.OK(); + + Pointset_Powerset<TOctagonal_Shape>::const_iterator i_ok = pps.begin(); + TOctagonal_Shape osi_ok = i_ok->pointset(); + Pointset_Powerset<TOctagonal_Shape>::const_iterator i1_ok = pps1.begin(); + TOctagonal_Shape osi1_ok = i1_ok->pointset(); + + print_constraints(osi_ok, "*** osi after OK() ***"); + print_constraints(osi1_ok, "*** osi1 after OK() ***"); + + return ok; +} + +// Constructs the powerset of octagonal_shapes from a polyhedron whose +// constraints are inconsistent (i.e., is empty but not marked as +// empty). +bool +test11() { + Variable x(0); + Variable y(1); + Variable z(2); + Variable w(3); + + C_Polyhedron ph(4); + ph.add_constraint(3*x >= 2); + ph.add_constraint(z >= 1); + ph.add_constraint(3*x + z <= 2); + C_Polyhedron ph1(ph); + + // With the default complexity, the built powerset is empty. + Pointset_Powerset<TOctagonal_Shape> pps(ph); + // With the polynomial complexity, the built powerset is non-empty. + Pointset_Powerset<TOctagonal_Shape> pps1(ph1, POLYNOMIAL_COMPLEXITY); + + Octagonal_Shape<mpq_class> known_os1(4); + known_os1.add_constraint(3*x >= 2); + known_os1.add_constraint(z >= 1); + + Pointset_Powerset<TOctagonal_Shape>::const_iterator i1 = pps1.begin(); + TOctagonal_Shape osi1 = i1->pointset(); + + bool ok = check_result(osi1, known_os1, "1.92e-7", "8.89e-8", "7.95e-8") + && pps.is_empty(); + + print_constraints(osi1, "*** osi1 ***"); + + return ok && pps.OK() && pps1.OK(); +} + +// Constructs the powerset of octagonal_shapes from an empty polyhedron. +bool +test12() { + Variable x(0); + Variable y(1); + + NNC_Polyhedron ph(2, EMPTY); + + Pointset_Powerset<TOctagonal_Shape> pps(ph); + + Pointset_Powerset<TOctagonal_Shape> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of octagonal_shapes from a powerset of polyhedra. +bool +test13() { + Variable x(0); + Variable y(1); + + Constraint_System cs; + cs.insert(2*x >= 1); + cs.insert(2*x + y <= 1); + cs.insert(y >= 0); + C_Polyhedron ph1(cs); + C_Polyhedron ph2(cs); + + Pointset_Powerset<C_Polyhedron> pps1_c(ph1, POLYNOMIAL_COMPLEXITY); + Pointset_Powerset<C_Polyhedron> pps2_c(ph2); + + Pointset_Powerset<TOctagonal_Shape> pps1(pps1_c, POLYNOMIAL_COMPLEXITY); + Pointset_Powerset<TOctagonal_Shape> pps2(pps2_c); + + Pointset_Powerset<TOctagonal_Shape> known_pps1(2); + known_pps1.add_constraint(2*x >= 1); + known_pps1.add_constraint(y >= 0); + Pointset_Powerset<TOctagonal_Shape> known_pps2(2); + known_pps2.add_constraint(2*x == 1); + known_pps2.add_constraint(y == 0); + + bool ok = (pps1 == known_pps1 && pps2 == known_pps2); + + Pointset_Powerset<TOctagonal_Shape>::const_iterator i1 = pps1.begin(); + TOctagonal_Shape osi1 = i1->pointset(); + print_constraints(osi1, "*** osi1 ***"); + + Pointset_Powerset<TOctagonal_Shape>::const_iterator i2 = pps2.begin(); + TOctagonal_Shape osi2 = i2->pointset(); + print_constraints(osi2, "*** osi2 ***"); + + return ok; +} + +// Constructs the powerset of boxes from a polyhedron. +bool +test14() { + Variable x(0); + Variable y(1); + Variable z(2); + Variable w(3); + + C_Polyhedron ph(4); + ph.add_constraint(x >= 2); + ph.add_constraint(y >= 5); + ph.add_constraint(z >= 1); + ph.add_constraint(x + y + z <= 8); + + C_Polyhedron ph1(ph); + + // With both the default and polynomial complexities, + // the implied equalities x = 2, y = 5 and z = 1 are found. + Pointset_Powerset<TBox> pps(ph); + Pointset_Powerset<TBox> pps1(ph1, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<TBox> known_pps(4); + known_pps.add_constraint(x == 2); + known_pps.add_constraint(y == 5); + known_pps.add_constraint(z == 1); + + bool ok = (pps == known_pps && pps1 == known_pps); + + if (pps.size() > 0) + print_constraints(pps.begin()->pointset(), "*** box ***"); + + if (pps1.size() > 0) + print_constraints(pps1.begin()->pointset(), "*** box1 ***"); + + return ok && pps.OK() && pps1.OK(); +} + +// Constructs the powerset of boxes from a polyhedron whose constraints +// are inconsistent (i.e., is empty but not marked as empty). +bool +test15() { + Variable x(0); + Variable y(1); + Variable z(2); + Variable w(3); + + C_Polyhedron ph(4); + ph.add_constraint(x >= 2); + ph.add_constraint(y >= 5); + ph.add_constraint(z >= 1); + ph.add_constraint(x + y + z <= 7); + + C_Polyhedron ph1(ph); + + // With both the default and polynomial complexity, + // the built powerset is detected to be empty. + Pointset_Powerset<TBox> pps(ph); + Pointset_Powerset<TBox> pps1(ph1, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<TBox> known_pps(4, EMPTY); + + bool ok = (pps == known_pps && pps1 == known_pps); + + // These will print something only if test is going to fail. + if (pps.size() > 0) + print_constraints(pps.begin()->pointset(), "*** box ***"); + if (pps1.size() > 0) + print_constraints(pps1.begin()->pointset(), "*** box1 ***"); + + return ok && pps.OK() && pps1.OK(); +} + +// Constructs the powerset of boxes from an empty polyhedron. +bool +test16() { + Variable x(0); + Variable y(1); + + NNC_Polyhedron ph(2, EMPTY); + + Pointset_Powerset<TBox> pps(ph); + + Pointset_Powerset<TBox> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of boxes from a powerset of polyhedra. +bool +test17() { + Variable x(0); + Variable y(1); + + Constraint_System cs; + cs.insert(2*x >= 1); + cs.insert(2*x + y <= 1); + cs.insert(y >= 0); + C_Polyhedron ph1(cs); + C_Polyhedron ph2(cs); + + Pointset_Powerset<C_Polyhedron> pps1_c(ph1, POLYNOMIAL_COMPLEXITY); + Pointset_Powerset<C_Polyhedron> pps2_c(ph2); + + Pointset_Powerset<TBox> pps1(pps1_c, POLYNOMIAL_COMPLEXITY); + Pointset_Powerset<TBox> pps2(pps2_c); + + Pointset_Powerset<TBox> known_pps(2); + known_pps.add_constraint(2*x == 1); + known_pps.add_constraint(y == 0); + + bool ok = (pps1 == known_pps && pps2 == known_pps); + + if (pps1.size() > 0) + print_constraints(pps1.begin()->pointset(), "*** box1 ***"); + if (pps2.size() > 0) + print_constraints(pps2.begin()->pointset(), "*** box2 ***"); + + return ok; +} + +// Constructs the powerset of grids from a polyhedron. +bool +test18() { + Variable x(0); + Variable y(1); + Variable z(2); + Variable w(3); + + C_Polyhedron ph(4); + ph.add_constraint(x >= 2); + ph.add_constraint(z >= 1); + ph.add_constraint(x + z <= 3); + C_Polyhedron ph1(4); + ph1.add_constraint(x >= 2); + ph1.add_constraint(z >= 1); + ph1.add_constraint(x + z <= 3); + + // With the default complexity, the implied equalities x = 2 and z = 1. + // are found + Pointset_Powerset<Grid> pps(ph); + // With the polynomial complexity, no implied equalities are found. + Pointset_Powerset<Grid> pps1(ph1, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<Grid> known_pps(4); + known_pps.add_congruence((x %= 2) / 0); + known_pps.add_congruence((z %= 1) / 0); + Pointset_Powerset<Grid> known_pps1(4); + + bool ok = (pps == known_pps && pps1 == known_pps1); + + Pointset_Powerset<Grid>::const_iterator i = pps.begin(); + Grid gri = i->pointset(); + print_congruences(gri, "*** gri ***"); + Pointset_Powerset<Grid>::const_iterator i1 = pps1.begin(); + Grid gri1 = i1->pointset(); + print_congruences(gri1, "*** gri1 ***"); + + return ok && pps.OK() && pps1.OK(); +} + +// Constructs the powerset of grids from a polyhedron whose constraints +// are inconsistent (i.e., is empty but not marked as empty). +bool +test19() { + Variable x(0); + Variable y(1); + Variable z(2); + Variable w(3); + + C_Polyhedron ph(4); + ph.add_constraint(x >= 2); + ph.add_constraint(z >= 1); + ph.add_constraint(x + z <= 2); + + C_Polyhedron ph1(ph); + + // With the default complexity, the built powerset is empty. + Pointset_Powerset<Grid> pps(ph); + // With the polynomial complexity, the built powerset is the universe. + Pointset_Powerset<Grid> pps1(ph1, POLYNOMIAL_COMPLEXITY); + + Pointset_Powerset<Grid> known_pps(4, EMPTY); + Pointset_Powerset<Grid> known_pps1(4); + + bool ok = (pps == known_pps && pps1 == known_pps1); + + Pointset_Powerset<Grid>::const_iterator i1 = pps1.begin(); + Grid gri1 = i1->pointset(); + print_congruences(gri1, "*** gri1 ***"); + + return ok && pps.OK() && pps1.OK(); +} + +// Constructs the powerset of grids from an empty polyhedron. +bool +test20() { + Variable x(0); + Variable y(1); + + NNC_Polyhedron ph(2, EMPTY); + + Pointset_Powerset<Grid> pps(ph); + + Pointset_Powerset<Grid> known_pps(2, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Constructs the powerset of grids from a powerset of polyhedra. +bool +test21() { + Variable x(0); + Variable y(1); + + Constraint_System cs; + cs.insert(2*x >= 1); + cs.insert(2*x + y <= 1); + cs.insert(y >= 0); + C_Polyhedron ph1(cs); + C_Polyhedron ph2(cs); + + Pointset_Powerset<C_Polyhedron> pps1_c(ph1, POLYNOMIAL_COMPLEXITY); + Pointset_Powerset<C_Polyhedron> pps2_c(ph2); + + Pointset_Powerset<Grid> pps1(pps1_c, POLYNOMIAL_COMPLEXITY); + Pointset_Powerset<Grid> pps2(pps2_c); + + Pointset_Powerset<Grid> known_pps1(2); + Pointset_Powerset<Grid> known_pps2(2); + known_pps2.add_constraint(2*x == 1); + known_pps2.add_constraint(y == 0); + + bool ok = (pps1 == known_pps1 && pps2 == known_pps2); + + Pointset_Powerset<Grid>::const_iterator i1 = pps1.begin(); + Grid gri1 = i1->pointset(); + print_congruences(gri1, "*** gri1 ***"); + + Pointset_Powerset<Grid>::const_iterator i2 = pps2.begin(); + Grid gri2 = i2->pointset(); + print_congruences(gri2, "*** gri2 ***"); + + return ok; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); + DO_TEST(test04); + DO_TEST(test05); + DO_TEST(test06); + DO_TEST(test07); + DO_TEST(test08); + DO_TEST(test09); + DO_TEST(test10); + DO_TEST(test11); + DO_TEST(test12); + DO_TEST(test13); + DO_TEST(test14); + DO_TEST(test15); + DO_TEST(test16); + DO_TEST(test17); + DO_TEST(test18); + DO_TEST(test19); + DO_TEST(test20); + DO_TEST(test21); +END_MAIN diff --git a/tests/Powerset/fromspacedimension1.cc b/tests/Powerset/fromspacedimension1.cc new file mode 100644 index 000000000..5a061bce9 --- /dev/null +++ b/tests/Powerset/fromspacedimension1.cc @@ -0,0 +1,102 @@ +/* Test Pointset_Powerset<PH>:: + Pointset_Powerset(dimension_type, Degenerate_Element). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +bool +test01() { + Pointset_Powerset<C_Polyhedron> ps(0, EMPTY); + + bool ok = (ps.OK() && ps.is_empty() && ps.space_dimension() == 0); + + return ok; +} + +bool +test02() { + Pointset_Powerset<C_Polyhedron> ps(0, UNIVERSE); + + bool ok = (ps.OK() && ps.is_universe() && ps.space_dimension() == 0); + + return ok; +} + +bool +test03() { + Pointset_Powerset<C_Polyhedron> ps(4, EMPTY); + + bool ok = (ps.OK() && ps.is_empty() && ps.space_dimension() == 4); + + return ok; +} + +bool +test04() { + Pointset_Powerset<C_Polyhedron> ps(4, UNIVERSE); + + bool ok = (ps.OK() && ps.is_universe() && ps.space_dimension() == 4); + + return ok; +} + +bool +test05() { + Pointset_Powerset<C_Polyhedron> ps(4); + + bool ok = (ps.OK() && ps.is_universe() && ps.space_dimension() == 4); + + return ok; +} + +// Construct powerset from zero dimension empty constraint system. +bool +test06() { + Constraint_System cs = Constraint_System::zero_dim_empty(); + Pointset_Powerset<TBox> ps(cs); + + print_constraints(ps, "*** ps ***"); + + return ps.OK(); +} + +bool +test07() { + Pointset_Powerset<TBox> pps_box(1, EMPTY); + bool ok = (pps_box.space_dimension() == 1); + return ok; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); + DO_TEST(test04); + DO_TEST(test05); + DO_TEST(test06); + DO_TEST(test07); +END_MAIN diff --git a/tests/Powerset/intersection1.cc b/tests/Powerset/intersection1.cc new file mode 100644 index 000000000..f7f2ab1e7 --- /dev/null +++ b/tests/Powerset/intersection1.cc @@ -0,0 +1,106 @@ +/* Test Pointset_Powerset<PH>::intersection_assign(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: intersection_assign(). +bool +test01() { + Variable x(0); + Pointset_Powerset<C_Polyhedron> c_ps(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + c_ps.add_disjunct(C_Polyhedron(cs)); + + Pointset_Powerset<C_Polyhedron> c_ps1(1, EMPTY); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 3); + c_ps1.add_disjunct(C_Polyhedron(cs)); + + c_ps.intersection_assign(c_ps1); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 2); + Pointset_Powerset<C_Polyhedron> c_ps_expected(1, EMPTY); + c_ps_expected.add_disjunct(C_Polyhedron(cs)); + + bool ok = c_ps.definitely_entails(c_ps_expected); + bool ok1 = c_ps_expected.definitely_entails(c_ps); + + return ok && ok1 && c_ps.OK() && c_ps1.OK(); +} + +// Powerset of C polyhedra: intersection_assign(). +bool +test02() { + Variable x(0); + Pointset_Powerset<C_Polyhedron> c_ps(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + c_ps.add_disjunct(C_Polyhedron(cs)); + + Pointset_Powerset<C_Polyhedron> c_ps1(1, EMPTY); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 3); + c_ps1.add_disjunct(C_Polyhedron(cs)); + + c_ps.intersection_assign(c_ps1); + bool ok = !c_ps.empty(); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 2); + Pointset_Powerset<C_Polyhedron> c_ps_expected(1, EMPTY); + c_ps_expected.add_disjunct(C_Polyhedron(cs)); + + bool ok1 = c_ps.definitely_entails(c_ps_expected); + bool ok2 = c_ps_expected.definitely_entails(c_ps); + + Pointset_Powerset<C_Polyhedron> c_ps2(1, EMPTY); + cs.clear(); + cs.insert(x == 4); + c_ps2.add_disjunct(C_Polyhedron(cs)); + + c_ps2.intersection_assign(c_ps1); + bool ok3 = c_ps2.empty(); + + return ok && ok1 && ok2 && ok3 && c_ps.OK() && c_ps1.OK() && c_ps2.OK(); +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); +END_MAIN diff --git a/tests/Powerset/maxmin1.cc b/tests/Powerset/maxmin1.cc new file mode 100644 index 000000000..d3671228c --- /dev/null +++ b/tests/Powerset/maxmin1.cc @@ -0,0 +1,400 @@ +/* Test Pointset_Powerset<PH>::maximize(). + Pointset_Powerset<PH>::minimize(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: maximize(). +bool +test01() { + Pointset_Powerset<C_Polyhedron> ps(0, EMPTY); + Coefficient num = 0; + Coefficient den = 0; + bool included = false; + Generator g(point()); + Linear_Expression LE; + bool ok = !ps.maximize(LE, num, den, included) + && num == 0 && den == 0 && !included; + ok = ok && !ps.maximize(LE, num, den, included, g) + && num == 0 && den == 0 && !included + && g.is_point() + && g.divisor() == 1; + + if (!ok) + return false; + + ps.add_disjunct(C_Polyhedron(0)); + bool ok1 = ps.maximize(LE, num, den, included) + && num == 0 && den == 1 && included; + ok1 = ok1 && ps.maximize(LE, num, den, included, g) + && num == 0 && den == 1 && included + && g.is_point() + && g.divisor() == 1; + + nout << (included ? "maximum" : "supremum") << " = " << num; + if (den != 1) + nout << "/" << den; + nout << " @ "; + print_generator(g); + nout << endl; + + return ok1; +} + +// Powerset of NNC polyhedra: maximize(). +bool +test02() { + Variable x(0); + Constraint_System cs; + Linear_Expression LE = x; + + Coefficient max_n = 0; + Coefficient max_d = 0; + bool max_included = false; + Generator max_g(point()); + Pointset_Powerset<NNC_Polyhedron> ps(1, EMPTY); + + cs.clear(); + cs.insert(x >= 3); + cs.insert(x < 14); + ps.add_disjunct(NNC_Polyhedron(cs)); + + bool ok = ps.maximize(LE, max_n, max_d, max_included) + && max_n == 14 && max_d == 1 && !max_included; + ok = ok && ps.maximize(LE, max_n, max_d, max_included, max_g) + && max_n == 14 && max_d == 1 && !max_included + && max_g.is_closure_point() + && max_g.divisor() == 1; + + nout << max_n << "/" << max_d; + nout << " @ "; + print_generator(max_g); + nout << endl; + + if (!ok) + return false; + + cs.clear(); + cs.insert(x >= 3); + cs.insert(x <= 14); + ps.add_disjunct(NNC_Polyhedron(cs)); + + ok = ps.maximize(LE, max_n, max_d, max_included) + && max_n == 14 && max_d == 1 && max_included; + ok = ok && ps.maximize(LE, max_n, max_d, max_included, max_g) + && max_n == 14 && max_d == 1 && max_included + && max_g.is_point() + && max_g.divisor() == 1; + + nout << max_n << "/" << max_d; + nout << " @ "; + print_generator(max_g); + nout << endl; + + return ok; +} + +// Powerset of C polyhedra: maximize(). +bool +test03() { + Variable x(0); + Variable y(1); + Constraint_System cs; + Linear_Expression LE = 9*x + y; + + Coefficient num = 0; + Coefficient den = 0; + bool included = false; + Generator g(point()); + Pointset_Powerset<C_Polyhedron> ps(2, EMPTY); + + cs.clear(); + cs.insert(x >= 3); + cs.insert(3*x <= 14); + cs.insert(y >= 5); + cs.insert(11*y <= 87); + ps.add_disjunct(C_Polyhedron(cs)); + + bool ok = ps.maximize(LE, num, den, included) + && num == 549 && den == 11 && included; + ok = ok && ps.maximize(LE, num, den, included, g) + && num == 549 && den == 11 && included + && g.is_point() + && g.divisor() == 33; + + nout << num << "/" << den; + nout << " @ "; + print_generator(g); + nout << endl; + + if (!ok) + return false; + + cs.clear(); + cs.insert(x - 3*y >= 5); + cs.insert(x <= 28); + cs.insert(y >= 5); + cs.insert(4*y <= 85); + ps.add_disjunct(C_Polyhedron(cs)); + + ok = ps.maximize(LE, num, den, included) + && num == 779 && den == 3 && included; + ok = ok && ps.maximize(LE, num, den, included, g) + && num == 779 && den == 3 && included + && g.is_point() + && g.divisor() == 3; + + nout << num << "/" << den; + nout << " @ "; + print_generator(g); + nout << endl; + + return ok; +} + +// Powerset of C polyhedra: maximize(). +bool +test04() { + Variable x(0); + Linear_Expression LE = x; + + Coefficient num = 0; + Coefficient den = 0; + bool included = false; + Generator g(point()); + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + + bool ok = !ps.maximize(LE, num, den, included) + && num == 0 && den == 0 && !included; + ok = ok && !ps.maximize(LE, num, den, included, g) + && num == 0 && den == 0 && !included + && g.is_point() + && g.divisor() == 1; + + if (!ok) + return false; + + ps.add_disjunct(C_Polyhedron(1)); + ok = !ps.maximize(LE, num, den, included, g) + && num == 0 && den == 0 && !included + && g.is_point() + && g.divisor() == 1; + + return ok; +} + +// Powerset of C polyhedra: minimize(). +bool +test05() { + Linear_Expression LE; + Coefficient num = 0; + Coefficient den = 0; + bool included = false; + Generator g(point()); + Pointset_Powerset<C_Polyhedron> ps(0, EMPTY); + + bool ok = !ps.minimize(LE, num, den, included) + && num == 0 && den == 0 && !included; + ok = ok && !ps.minimize(LE, num, den, included, g) + && num == 0 && den == 0 && !included + && g.is_point() + && g.divisor() == 1; + + if (!ok) + return false; + + ps.add_disjunct(C_Polyhedron(0)); + ok = ps.minimize(LE, num, den, included) + && num == 0 && den == 1 && included; + ok = ok && ps.minimize(LE, num, den, included, g) + && num == 0 && den == 1 && included + && g.is_point() + && g.divisor() == 1; + + nout << (included ? "minimum" : "supremum") << " = " << num; + if (den != 1) + nout << "/" << den; + nout << " @ "; + print_generator(g); + nout << endl; + + return ok; +} + +// Powerset of NNC polyhedra: minimize(). +bool +test06() { + Variable x(0); + Constraint_System cs; + Linear_Expression LE = x; + + Coefficient min_n = 0; + Coefficient min_d = 0; + bool min_included = false; + Generator min_g(point()); + + Pointset_Powerset<NNC_Polyhedron> ps(1, EMPTY); + + cs.clear(); + cs.insert(2*x > 3); + cs.insert(x < 14); + ps.add_disjunct(NNC_Polyhedron(cs)); + + bool ok = ps.minimize(LE, min_n, min_d, min_included) + && min_n == 3 && min_d == 2 && !min_included; + ok = ok && ps.minimize(LE, min_n, min_d, min_included, min_g) + && min_n == 3 && min_d == 2 && !min_included + && min_g.is_closure_point() + && min_g.divisor() == 2; + + nout << min_n << "/" << min_d; + nout << " @ "; + print_generator(min_g); + nout << endl; + + if (!ok) + return false; + + cs.clear(); + cs.insert(2*x >= 3); + cs.insert(x < 14); + ps.add_disjunct(NNC_Polyhedron(cs)); + + ok = ps.minimize(LE, min_n, min_d, min_included) + && min_n == 3 && min_d == 2 && min_included; + ok = ok && ps.minimize(LE, min_n, min_d, min_included, min_g) + && min_n == 3 && min_d == 2 && min_included + && min_g.is_point() + && min_g.divisor() == 2; + + nout << min_n << "/" << min_d; + nout << " @ "; + print_generator(min_g); + nout << endl; + + return ok; +} + +// Powerset of C polyhedra: minimize(). +bool +test07() { + Variable x(0); + Variable y(1); + Constraint_System cs; + Linear_Expression LE = x + y; + + Coefficient num = 0; + Coefficient den = 0; + bool included = false; + Generator g(point()); + Pointset_Powerset<C_Polyhedron> ps(2, EMPTY); + + cs.clear(); + cs.insert(x >= 3); + cs.insert(x <= 4); + cs.insert(y >= 5); + cs.insert(y <= 8); + ps.add_disjunct(C_Polyhedron(cs)); + + bool ok = ps.minimize(LE, num, den, included) + && num == 8 && den == 1 && included; + ok = ok && ps.minimize(LE, num, den, included, g) + && num == 8 && den == 1 && included + && g.is_point() + && g.divisor() == 1; + + nout << num << "/" << den; + nout << " @ "; + print_generator(g); + nout << endl; + + if (!ok) + return false; + + cs.clear(); + cs.insert(x - y >= 1); + cs.insert(x <= 8); + cs.insert(y >= 2); + cs.insert(y <= 10); + ps.add_disjunct(C_Polyhedron(cs)); + + ok = ps.minimize(LE, num, den, included) + && num == 5 && den == 1 && included; + ok = ok && ps.minimize(LE, num, den, included, g) + && num == 5 && den == 1 && included + && g.is_point() + && g.divisor() == 1; + + nout << num << "/" << den; + nout << " @ "; + print_generator(g); + nout << endl; + + return ok; +} + +// Powerset of C polyhedra: minimize(). +bool +test08() { + Variable x(0); + Linear_Expression LE = x; + + Coefficient num = 0; + Coefficient den = 0; + bool included = false; + Generator g(point()); + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + + bool ok = !ps.minimize(LE, num, den, included) + && num == 0 && den == 0 && !included; + ok = ok && !ps.minimize(LE, num, den, included, g) + && num == 0 && den == 0 && !included + && g.is_point() + && g.divisor() == 1; + + if (!ok) + return false; + + ps.add_disjunct(C_Polyhedron(1)); + ok = !ps.minimize(LE, num, den, included, g) + && num == 0 && den == 0 && !included + && g.is_point() + && g.divisor() == 1; + + return ok; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST_F8(test02); + DO_TEST_F8(test03); + DO_TEST(test04); + DO_TEST(test05); + DO_TEST_F8(test06); + DO_TEST(test07); + DO_TEST(test08); +END_MAIN diff --git a/tests/Powerset/meet1.cc b/tests/Powerset/meet1.cc new file mode 100644 index 000000000..855e0062f --- /dev/null +++ b/tests/Powerset/meet1.cc @@ -0,0 +1,95 @@ +/* Test Pointset_Powerset<PH>::meet_assign(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: meet_assign(). +bool +test01() { + Variable x(0); + Pointset_Powerset<C_Polyhedron> c_ps(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + c_ps.add_disjunct(C_Polyhedron(cs)); + + Pointset_Powerset<C_Polyhedron> c_ps1(1, EMPTY); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 3); + + c_ps.meet_assign(c_ps1); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 2); + Pointset_Powerset<C_Polyhedron> c_ps_expected(1, EMPTY); + c_ps_expected.add_disjunct(C_Polyhedron(cs)); + + bool ok = c_ps.definitely_entails(c_ps_expected); + bool ok1 = !c_ps_expected.definitely_entails(c_ps); + + return ok && ok1; +} + +// Powerset of boxes: meet_assign(). +bool +test02() { + Variable x(0); + Pointset_Powerset<TBox> pps_box(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + pps_box.add_disjunct(TBox(cs)); + + Pointset_Powerset<TBox> pps_box1(1, EMPTY); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 3); + + pps_box.meet_assign(pps_box1); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 2); + Pointset_Powerset<TBox> pps_box_expected(1, EMPTY); + pps_box_expected.add_disjunct(TBox(cs)); + + bool ok = pps_box.definitely_entails(pps_box_expected); + bool ok1 = !pps_box_expected.definitely_entails(pps_box); + + return ok && ok1; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); +END_MAIN diff --git a/tests/Powerset/membytes1.cc b/tests/Powerset/membytes1.cc new file mode 100644 index 000000000..241fefddb --- /dev/null +++ b/tests/Powerset/membytes1.cc @@ -0,0 +1,69 @@ +/* Test Pointset_Powerset<PH>::total_memory_in_bytes(). + Pointset_Powerset<PH>::external_memory_in_bytes(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: total_memory_in_bytes() and +// external_memory_in_bytes(). +bool +test01() { + Pointset_Powerset<C_Polyhedron> c_ps(1, EMPTY); + + bool ok = c_ps.is_bottom(); + + c_ps.add_disjunct(C_Polyhedron(1, UNIVERSE)); + + bool ok1 = c_ps.is_top(); + + c_ps.total_memory_in_bytes(); + c_ps.external_memory_in_bytes(); + + return ok && ok1; +} + +// Powerset of boxes: total_memory_in_bytes() and external_memory_in_bytes(). +bool +test02() { + Pointset_Powerset<TBox> pps_box(1, EMPTY); + + bool ok = pps_box.is_bottom(); + + pps_box.add_disjunct(TBox(1, UNIVERSE)); + + bool ok1 = pps_box.is_top(); + + pps_box.total_memory_in_bytes(); + pps_box.external_memory_in_bytes(); + + return ok && ok1; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); +END_MAIN diff --git a/tests/Powerset/powerset1.cc b/tests/Powerset/powerset1.cc new file mode 100644 index 000000000..58db48aca --- /dev/null +++ b/tests/Powerset/powerset1.cc @@ -0,0 +1,178 @@ +/* Test Powerset<D>. + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Uses every public Powerset method. +bool +test01() { + typedef Powerset<FCAIBVP> PSET; + + Variable A(0); + + PSET ps1; + ps1.add_disjunct(FCAIBVP(A)); + + PSET ps2 = ps1; + + if (ps2 != ps1 || !(ps2 == ps1)) + return false; + + using IO_Operators::operator<<; + nout << "ps1:" << endl << ps1 << endl; + + FCAIBVP d(A); + PSET ps3(d); + + if (!ps1.definitely_entails(ps3)) + return false; + + if (ps3.is_top()) + return false; + + if (ps1.is_bottom()) + return false; + + nout << "Total memory: " << ps3.total_memory_in_bytes() << endl + << "External memory: " << ps3.external_memory_in_bytes() << endl; + + ps3.omega_reduce(); + + if (ps3.size() == 0) + return false; + + if (ps3.empty()) + return false; + + // Iterator. + dimension_type count = 0; + for (PSET::iterator i = ps3.begin(); i != ps3.end(); ++i) + ++count; + if (count != 1) + return false; + + // Constant iterator. + count = 0; + for (PSET::const_iterator i = ps3.begin(); i != ps3.end(); ++i) + ++count; + if (count != 1) + return false; + + // Reverse iterator. + count = 0; + for (PSET::reverse_iterator i = ps3.rbegin(); i != ps3.rend(); ++i) + ++count; + if (count != 1) + return false; + + // Constant reverse iterator. + count = 0; + for (PSET::const_reverse_iterator i = ps3.rbegin(), + ps3_rend = ps3.rend(); i != ps3_rend; ++i) + ++count; + if (count != 1) + return false; + + ps2 = ps3; + PSET ps_empty; + ps2.drop_disjunct(ps2.begin()); + if (ps2 != ps_empty) + return false; + + ps2 = ps3; + ps2.drop_disjuncts(ps2.begin(),ps2.end()); + if (ps2 != ps_empty) + return false; + + ps2 = ps3; + ps2.clear(); + if (ps2 != ps_empty) + return false; + + ps3.swap(ps2); + ps3.swap(ps2); + if (ps3 != ps1 || ps2 != ps_empty) + return false; + + ps2 = ps_empty; + ps2.least_upper_bound_assign(ps3); + if (ps2 != ps3) + return false; + + ps2 = ps_empty; + ps2.upper_bound_assign(ps3); + if (ps2 != ps3) + return false; + + Variable B(1); + ps2 = ps1; + ps2.meet_assign(ps3); + if (ps2 != ps3) + return false; + + ps3.collapse(); + if (ps3.size() != 1) + return false; + + return true; +} + +bool +test02() { + Variable X(0); + Variable Y(1); + + FCAIBVP XY(X); + XY.meet_assign(FCAIBVP(Y)); + + Powerset<FCAIBVP> ps; + + ps.add_disjunct(FCAIBVP(X)); + ps.add_disjunct(XY); + return ps.OK(); +} + +bool +test03() { + Variable X(0); + Variable Y(1); + + FCAIBVP XY(X); + XY.meet_assign(FCAIBVP(Y)); + + Powerset<FCAIBVP> ps; + + ps.add_disjunct(XY); + ps.add_disjunct(FCAIBVP(X)); + return ps.OK(); +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); +END_MAIN diff --git a/tests/Powerset/reduce1.cc b/tests/Powerset/reduce1.cc new file mode 100644 index 000000000..e703e7ba8 --- /dev/null +++ b/tests/Powerset/reduce1.cc @@ -0,0 +1,81 @@ +/* Test Pointset_Powerset<PH>::omega_reduce(). + Pointset_Powerset<PH>::pairwise_reduce(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of polyhedra: omega_reduce(). +bool +test01() { + Variable x(0); + Pointset_Powerset<C_Polyhedron> c_ps(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + c_ps.add_disjunct(C_Polyhedron(cs)); + + cs.clear(); + cs.insert(x >= 0); + cs.insert(x <= 3); + c_ps.add_disjunct(C_Polyhedron(cs)); + c_ps.omega_reduce(); + + bool ok = (c_ps.size() == 1); + + return ok; +} + +// Powerset of boxes: omega_reduce(). +bool +test02() { + Variable x(0); + Pointset_Powerset<TBox> pps_box(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + pps_box.add_disjunct(TBox(cs)); + + cs.clear(); + cs.insert(x >= 0); + cs.insert(x <= 3); + pps_box.add_disjunct(TBox(cs)); + pps_box.omega_reduce(); + + bool ok = (pps_box.size() == 1); + + return ok; +} + +/* test07() in difference1.cc includes a use of pairwise_reduce + for C polyhedra. */ + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); +END_MAIN diff --git a/tests/Powerset/refinewith1.cc b/tests/Powerset/refinewith1.cc new file mode 100644 index 000000000..e8b6ce30b --- /dev/null +++ b/tests/Powerset/refinewith1.cc @@ -0,0 +1,225 @@ +/* Test Pointset_Powerset<PH>::refine_with_constraint(). + Pointset_Powerset<PH>::refine_with_constraints(). + Pointset_Powerset<PH>::refine_with_congruence(). + Pointset_Powerset<PH>::refine_with_congruences(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: refine_with_constraint(), refine_with_congruence(). +bool +test01() { + Variable A(0); + Variable B(1); + Variable C(2); + Variable D(3); + + C_Polyhedron ph1(4); + ph1.add_constraint(A == 1); + ph1.add_constraint(C >= 0); + ph1.add_constraint(B >= 0); + + C_Polyhedron ph2(4); + ph2.add_constraint(A <= 2); + ph2.add_constraint(B >= 2); + Pointset_Powerset<C_Polyhedron> pps(4, EMPTY); + + pps.add_disjunct(ph1); + pps.add_disjunct(ph2); + + Pointset_Powerset<C_Polyhedron> known_pps(pps); + + pps.refine_with_constraint(C == 0); + pps.refine_with_constraint(D < 0); + pps.refine_with_congruence(B + D %= 2); + pps.refine_with_congruence((B - D %= 2) / 0); + + + known_pps.add_constraint(C == 0); + known_pps.add_constraint(A <= 2); + known_pps.add_constraint(B <= 2); + known_pps.add_constraint(B - D == 2); + + + bool ok = (pps == known_pps); + + Pointset_Powerset<C_Polyhedron>::const_iterator i = pps.begin(); + C_Polyhedron phi = i->pointset(); + print_constraints(phi, "*** phi ***"); + i++; + C_Polyhedron phi1 = i->pointset(); + print_constraints(phi1, "*** phi1 ***"); + + return ok; +} + +// Powerset of C polyhedra: refine_with_constraints(), +// refine_with_congruences(). +bool +test02() { + Variable A(0); + Variable B(1); + Variable C(2); + Variable D(3); + + C_Polyhedron ph1(4); + ph1.add_constraint(A == 1); + ph1.add_constraint(C >= 0); + + C_Polyhedron ph2(4); + ph2.add_constraint(A <= 2); + Pointset_Powerset<C_Polyhedron> pps(4, EMPTY); + + pps.add_disjunct(ph1); + pps.add_disjunct(ph2); + + Pointset_Powerset<C_Polyhedron> known_pps(pps); + + Constraint_System cs; + cs.insert(A + 2*B >= 0); + cs.insert(B - C < 3); + cs.insert(D == 1); + + Congruence_System cgs; + cgs.insert(A + B %= 0); + cgs.insert((C %= 2) / 0); + + pps.refine_with_constraints(cs); + pps.refine_with_congruences(cgs); + + known_pps.add_constraint(C == 2); + known_pps.add_constraint(D == 1); + known_pps.add_constraint(A + 2*B >= 0); + known_pps.add_constraint(B - C <= 3); + + bool ok = (pps == known_pps); + + Pointset_Powerset<C_Polyhedron>::const_iterator i = pps.begin(); + C_Polyhedron phi = i->pointset(); + print_constraints(phi, "*** phi ***"); + + return ok; +} + +// Powerset of C polyhedra: refine_with_constraints(), +// refine_with_congruences() make the powerset empty. +bool +test03() { + Variable A(0); + Variable B(1); + Variable C(2); + Variable D(3); + + C_Polyhedron ph1(4); + ph1.add_constraint(A == 1); + ph1.add_constraint(C >= 0); + + C_Polyhedron ph2(4); + ph2.add_constraint(A <= 2); + Pointset_Powerset<C_Polyhedron> pps(4, EMPTY); + + pps.add_disjunct(ph1); + pps.add_disjunct(ph2); + + Constraint_System cs; + cs.insert(A + 2*B >= 0); + cs.insert(B - C < 3); + cs.insert(A > 1); + + Congruence_System cgs; + cgs.insert(A + B %= 0); + cgs.insert((B - C %= 4) / 0); + + pps.refine_with_constraints(cs); + pps.refine_with_congruences(cgs); + + Pointset_Powerset<C_Polyhedron> known_pps(4, EMPTY); + + bool ok = (pps == known_pps); + + return ok; +} + +// Powerset of NNC polyhedra: refine_with_constraints(), +// refine_with_congruences(). +bool +test04() { + Variable A(0); + Variable B(1); + Variable C(2); + Variable D(3); + + NNC_Polyhedron ph1(4); + ph1.add_constraint(A == 1); + ph1.add_constraint(C >= 0); + ph1.add_constraint(B >= 0); + + NNC_Polyhedron ph2(4); + ph2.add_constraint(A <= 2); + ph2.add_constraint(B >= 2); + Pointset_Powerset<NNC_Polyhedron> pps(4, EMPTY); + + pps.add_disjunct(ph1); + pps.add_disjunct(ph2); + + Pointset_Powerset<NNC_Polyhedron> known_pps(pps); + + Constraint_System cs; + cs.insert(A + 2*B >= 0); + cs.insert(B - C < 3); + cs.insert(D == 1); + + Congruence_System cgs; + cgs.insert(A + B %= 0); + cgs.insert((C %= 2) / 0); + + pps.refine_with_constraints(cs); + pps.refine_with_congruences(cgs); + + known_pps.add_constraint(C == 2); + known_pps.add_constraint(D == 1); + known_pps.add_constraint(A + 2*B >= 0); + known_pps.add_constraint(B - C < 3); + + bool ok = (pps == known_pps); + + Pointset_Powerset<NNC_Polyhedron>::const_iterator i = pps.begin(); + NNC_Polyhedron phi = i->pointset(); + print_constraints(phi, "*** phi ***"); + i++; + NNC_Polyhedron phi1 = i->pointset(); + print_constraints(phi1, "*** phi1 ***"); + + return ok; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); + DO_TEST(test04); +END_MAIN diff --git a/tests/Powerset/relationwith1.cc b/tests/Powerset/relationwith1.cc new file mode 100644 index 000000000..c879ad456 --- /dev/null +++ b/tests/Powerset/relationwith1.cc @@ -0,0 +1,278 @@ +/* Test Pointset_Powerset<PH>::relation_with(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: relation_with(). +bool +test01() { + Variable x(0); + Constraint c = (x == 0); + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + ps.add_disjunct(C_Polyhedron(1)); + ps.add_constraint(c); + Congruence cg((x %= 0) / 0); + Poly_Con_Relation rel = ps.relation_with(cg); + + Poly_Con_Relation known_rel = Poly_Con_Relation::saturates() + && Poly_Con_Relation::is_included(); + + bool ok = (rel == known_rel);; + + return ok && ps.OK(); +} + +// Powerset of C polyhedra: relation_with(). +bool +test02() { + Variable x(0); + + C_Polyhedron ph1(1); + ph1.add_constraint(x == 1); + + C_Polyhedron ph2(1); + ph2.add_constraint(x == 2); + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + + ps.add_disjunct(ph1); + ps.add_disjunct(ph2); + + Congruence cg((x %= 1) / 0); + Poly_Con_Relation rel = ps.relation_with(cg); + + Poly_Con_Relation known_rel = Poly_Con_Relation::saturates(); + + bool ok = (rel == known_rel); + + return ok && ps.OK(); +} + +// Powerset of C polyhedra: relation_with(). +bool +test03() { + Variable x(0); + + C_Polyhedron ph1(1); + ph1.add_constraint(x == 1); + + C_Polyhedron ph2(1); + ph2.add_constraint(x == 2); + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + + ps.add_disjunct(ph1); + ps.add_disjunct(ph2); + + Congruence cg((x %= 3) / 4); + Poly_Con_Relation rel = ps.relation_with(cg); + + Poly_Con_Relation known_rel = Poly_Con_Relation::is_disjoint(); + + bool ok = (rel == known_rel); + + return ok && ps.OK(); +} + +// Powerset of C polyhedra: relation_with(). +bool +test04() { + Variable x(0); + + C_Polyhedron ph1(1); + ph1.add_constraint(x >= 1); + + C_Polyhedron ph2(1); + ph2.add_constraint(x <= 2); + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + + ps.add_disjunct(ph1); + ps.add_disjunct(ph2); + + Congruence cg((x %= 3) / 4); + Poly_Con_Relation rel = ps.relation_with(cg); + + Poly_Con_Relation known_rel = Poly_Con_Relation::strictly_intersects(); + + bool ok = (rel == known_rel); + + return ok && ps.OK(); +} + +// Powerset of C polyhedra: relation_with(). +bool +test05() { + Variable x(0); + Constraint c = (x == 0); + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + ps.add_disjunct(C_Polyhedron(1)); + ps.add_constraint(c); + Poly_Con_Relation rel = ps.relation_with(c); + + Poly_Con_Relation known_rel = Poly_Con_Relation::saturates() + && Poly_Con_Relation::is_included(); + + bool ok = (rel == known_rel);; + + return ok && ps.OK(); +} + +// Powerset of C polyhedra: relation_with(). +bool +test06() { + Variable x(0); + + C_Polyhedron ph1(1); + ph1.add_constraint(x == 1); + + C_Polyhedron ph2(1); + ph2.add_constraint(x == 2); + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + + ps.add_disjunct(ph1); + ps.add_disjunct(ph2); + + Constraint c(x == 1); + Poly_Con_Relation rel = ps.relation_with(c); + + Poly_Con_Relation known_rel = Poly_Con_Relation::saturates(); + + bool ok = (rel == known_rel); + + return ok && ps.OK(); +} + +// Powerset of C polyhedra: relation_with(). +bool +test07() { + Variable x(0); + + C_Polyhedron ph1(1); + ph1.add_constraint(x == 1); + + C_Polyhedron ph2(1); + ph2.add_constraint(x == 2); + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + + ps.add_disjunct(ph1); + ps.add_disjunct(ph2); + + Constraint c(x >= 3); + Poly_Con_Relation rel = ps.relation_with(c); + + Poly_Con_Relation known_rel = Poly_Con_Relation::is_disjoint(); + + bool ok = (rel == known_rel); + + return ok && ps.OK(); +} + +// Powerset of C polyhedra: relation_with(). +bool +test08() { + Variable x(0); + + C_Polyhedron ph1(1); + ph1.add_constraint(x >= 1); + + C_Polyhedron ph2(1); + ph2.add_constraint(x <= 2); + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + + ps.add_disjunct(ph1); + ps.add_disjunct(ph2); + + Constraint c(x >= 3); + Poly_Con_Relation rel = ps.relation_with(c); + + Poly_Con_Relation known_rel = Poly_Con_Relation::strictly_intersects(); + + bool ok = (rel == known_rel); + + return ok && ps.OK(); +} + +// Powerset of C polyhedra: relation_with(). +bool +test09() { + Variable x(0); + + C_Polyhedron ph1(1); + ph1.add_constraint(x == 1); + + C_Polyhedron ph2(1); + ph2.add_constraint(x == 2); + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + + ps.add_disjunct(ph1); + ps.add_disjunct(ph2); + + Generator g(point(x)); + Poly_Gen_Relation rel = ps.relation_with(g); + + Poly_Gen_Relation known_rel = Poly_Gen_Relation::subsumes(); + + bool ok = (rel == known_rel); + + return ok && ps.OK(); +} + +// Powerset of C polyhedra: relation_with(). +bool +test10() { + Variable x(0); + + C_Polyhedron ph1(1); + ph1.add_constraint(x == 1); + + C_Polyhedron ph2(1); + ph2.add_constraint(x <= 2); + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + + ps.add_disjunct(ph1); + ps.add_disjunct(ph2); + + Generator g(line(3*x)); + Poly_Gen_Relation rel = ps.relation_with(g); + + Poly_Gen_Relation known_rel = Poly_Gen_Relation::nothing(); + + bool ok = (rel == known_rel); + + return ok && ps.OK(); +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); + DO_TEST(test04); + DO_TEST(test05); + DO_TEST(test06); + DO_TEST(test07); + DO_TEST(test08); + DO_TEST(test09); + DO_TEST(test10); +END_MAIN diff --git a/tests/Powerset/simplifyusingcontext1.cc b/tests/Powerset/simplifyusingcontext1.cc new file mode 100644 index 000000000..3e6855c07 --- /dev/null +++ b/tests/Powerset/simplifyusingcontext1.cc @@ -0,0 +1,459 @@ +/* Test Pointset_Powerset::simplify_using_context_assign(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +bool +test01() { + Variable i(0); + Variable j(1); + Variable k(2); + + C_Polyhedron ph(3, EMPTY); + Pointset_Powerset<C_Polyhedron> ps1(3, EMPTY); + Pointset_Powerset<C_Polyhedron> ps2(3, EMPTY); + + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(i >= 1); + ph.add_constraint(i <= 10); + ph.add_constraint(j >= 1); + ph.add_constraint(j <= 10); + ph.add_constraint(k == 0); + + ps1.add_disjunct(ph); + ps2.add_disjunct(ph); + + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(i >= 1); + ph.add_constraint(i <= 10); + ph.add_constraint(j >= 1); + ph.add_constraint(j <= 10); + ph.add_constraint(k >= 1); + ph.add_constraint(k <= 10); + + ps2.add_disjunct(ph); + + Pointset_Powerset<C_Polyhedron> known_result(3, EMPTY); + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(k == 0); + known_result.add_disjunct(ph); + + ps1.simplify_using_context_assign(ps2); + + bool ok = (ps1 == known_result); + + return ok; +} + +bool +test02() { + Variable i(0); + Variable j(1); + Variable k(2); + + C_Polyhedron ph(3, EMPTY); + Pointset_Powerset<C_Polyhedron> ps1(3, EMPTY); + Pointset_Powerset<C_Polyhedron> ps2(3, EMPTY); + + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(i >= 1); + ph.add_constraint(i <= 10); + ph.add_constraint(j >= 1); + ph.add_constraint(j <= 10); + ph.add_constraint(k >= 1); + ph.add_constraint(k <= 10); + + ps1.add_disjunct(ph); + ps2.add_disjunct(ph); + + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(i >= 1); + ph.add_constraint(i <= 10); + ph.add_constraint(j >= 1); + ph.add_constraint(j <= 10); + ph.add_constraint(k == 0); + + ps2.add_disjunct(ph); + + Pointset_Powerset<C_Polyhedron> known_result(3, EMPTY); + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(k >= 1); + known_result.add_disjunct(ph); + + ps1.simplify_using_context_assign(ps2); + + bool ok = (ps1 == known_result); + + return ok; +} + +bool +test03() { + Variable i(0); + Variable j(1); + Variable k(2); + + C_Polyhedron ph(3, EMPTY); + Pointset_Powerset<C_Polyhedron> ps1(3, EMPTY); + Pointset_Powerset<C_Polyhedron> ps2(3, EMPTY); + + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(i >= 1); + ph.add_constraint(i <= 10); + ph.add_constraint(j >= 1); + ph.add_constraint(j <= 10); + ph.add_constraint(k == 0); + + ps1.add_disjunct(ph); + + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(i <= 25); + ph.add_constraint(j <= 25); + ph.add_constraint(i + j >= 25); + ph.add_constraint(k == 0); + + ps2.add_disjunct(ph); + + Pointset_Powerset<C_Polyhedron> known_result(3, EMPTY); + + ps1.simplify_using_context_assign(ps2); + + bool ok = (ps1 == known_result); + + for (Pointset_Powerset<C_Polyhedron>::const_iterator it = ps1.begin(), + ps1_end = ps1.end(); it != ps1_end; ++it) + print_constraints(it->pointset()); + + return ok; +} + +bool +test04() { + Variable i(0); + Variable j(1); + Variable k(2); + + C_Polyhedron ph(3, EMPTY); + Pointset_Powerset<C_Polyhedron> ps1(3, EMPTY); + Pointset_Powerset<C_Polyhedron> ps2(3, EMPTY); + + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(i >= 1); + ph.add_constraint(i <= 10); + ph.add_constraint(j >= 1); + ph.add_constraint(j <= 10); + ph.add_constraint(k == 0); + + ps1.add_disjunct(ph); + + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(i <= 25); + ph.add_constraint(j <= 25); + ph.add_constraint(i + j >= 25); + ph.add_constraint(k == 0); + + ps2.add_disjunct(ph); + + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(i >= 0); + ph.add_constraint(i <= 2); + ph.add_constraint(j >= 2); + ph.add_constraint(j <= 9); + ph.add_constraint(k == 0); + + ps2.add_disjunct(ph); + + Pointset_Powerset<C_Polyhedron> known_result(3, EMPTY); + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(i >= 1); + ph.add_constraint(i <= 10); + ph.add_constraint(j <= 10); + known_result.add_disjunct(ph); + + ps1.simplify_using_context_assign(ps2); + + bool ok = (ps1 == known_result); + + for (Pointset_Powerset<C_Polyhedron>::const_iterator it = ps1.begin(), + ps1_end = ps1.end(); it != ps1_end; ++it) + print_constraints(it->pointset()); + + return ok; +} + +bool +test05() { + Variable i(0); + Variable j(1); + Variable k(2); + + C_Polyhedron ph(3, EMPTY); + Pointset_Powerset<C_Polyhedron> ps1(3, EMPTY); + Pointset_Powerset<C_Polyhedron> ps2(3, EMPTY); + + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(i >= 1); + ph.add_constraint(i <= 10); + ph.add_constraint(j >= 1); + ph.add_constraint(j <= 10); + ph.add_constraint(k == 0); + + ps1.add_disjunct(ph); + + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(i >= 28); + ph.add_constraint(i <= 31); + ph.add_constraint(j >= 1); + ph.add_constraint(j <= 10); + ph.add_constraint(k == 0); + + ps1.add_disjunct(ph); + + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(i <= 25); + ph.add_constraint(j <= 25); + ph.add_constraint(i + j >= 25); + ph.add_constraint(k == 0); + + ps2.add_disjunct(ph); + + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(i >= 30); + ph.add_constraint(i <= 32); + ph.add_constraint(j >= 2); + ph.add_constraint(j <= 9); + ph.add_constraint(k == 0); + + ps2.add_disjunct(ph); + + Pointset_Powerset<C_Polyhedron> known_result(3, EMPTY); + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(i >= 28); + ph.add_constraint(i <= 31); + known_result.add_disjunct(ph); + + ps1.simplify_using_context_assign(ps2); + + bool ok = (ps1 == known_result); + + for (Pointset_Powerset<C_Polyhedron>::const_iterator it = ps1.begin(), + ps1_end = ps1.end(); it != ps1_end; ++it) + print_constraints(it->pointset()); + + return ok; +} + +bool +test06() { + Variable i(0); + Variable j(1); + Variable k(2); + + C_Polyhedron ph(3, EMPTY); + Pointset_Powerset<C_Polyhedron> ps1(3, EMPTY); + Pointset_Powerset<C_Polyhedron> ps2(3, EMPTY); + + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(i == 1); + ph.add_constraint(j + 1 == 0); + ph.add_constraint(k == 3); + + ps1.add_disjunct(ph); + + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(i == 1); + ph.add_constraint(j + k == 2); + ph.add_constraint(k >= 0); + ph.add_constraint(k <= 3); + + ps2.add_disjunct(ph); + + Pointset_Powerset<C_Polyhedron> known_result(3, EMPTY); + ph = C_Polyhedron(3, UNIVERSE); + ph.add_constraint(k == 3); + // ph.add_constraint(j + 1 == 0); + known_result.add_disjunct(ph); + + ps1.simplify_using_context_assign(ps2); + + bool ok = (ps1 == known_result); + + for (Pointset_Powerset<C_Polyhedron>::const_iterator it = ps1.begin(), + ps1_end = ps1.end(); it != ps1_end; ++it) + print_constraints(it->pointset()); + + return ok; +} + +bool +test07() { + Variable i(0); + Variable j(1); + + C_Polyhedron ph(2, EMPTY); + Pointset_Powerset<C_Polyhedron> ps1(2, EMPTY); + Pointset_Powerset<C_Polyhedron> ps2(2, EMPTY); + + ph = C_Polyhedron(2, UNIVERSE); + ph.add_constraint(i <= j); + + ps1.add_disjunct(ph); + + ph = C_Polyhedron(2, UNIVERSE); + ph.add_constraint(i == j); + + ps2.add_disjunct(ph); + + Pointset_Powerset<C_Polyhedron> known_result(2, UNIVERSE); + + ps1.simplify_using_context_assign(ps2); + + bool ok = (ps1 == known_result); + + for (Pointset_Powerset<C_Polyhedron>::const_iterator it = ps1.begin(), + ps1_end = ps1.end(); it != ps1_end; ++it) + print_constraints(it->pointset()); + + return ok; +} + +bool +test08() { + Variable A(0); + Variable B(1); + + C_Polyhedron ph(2, EMPTY); + Pointset_Powerset<C_Polyhedron> ps1(2, EMPTY); + Pointset_Powerset<C_Polyhedron> ps2(2, EMPTY); + + ph = C_Polyhedron(2, UNIVERSE); + ph.add_constraint(A >= 0); + + ps1.add_disjunct(ph); + + ph = C_Polyhedron(2, UNIVERSE); + ph.add_constraint(A <= 0); + + ps2.add_disjunct(ph); + + ph = C_Polyhedron(2, UNIVERSE); + ph.add_constraint(B >= 0); + + ps2.add_disjunct(ph); + + Pointset_Powerset<C_Polyhedron> known_result(2, EMPTY); + ph = C_Polyhedron(2, UNIVERSE); + ph.add_constraint(A >= 0); + known_result.add_disjunct(ph); + + ps1.simplify_using_context_assign(ps2); + + bool ok = (ps1 == known_result); + + for (Pointset_Powerset<C_Polyhedron>::const_iterator i = ps1.begin(), + iend = ps1.end(); i != iend; ++i) + print_constraints(i->pointset()); + + return ok; +} + +bool +test09() { + Variable A(0); + Variable B(1); + + C_Polyhedron ph(2, EMPTY); + Pointset_Powerset<C_Polyhedron> ps1(2, EMPTY); + Pointset_Powerset<C_Polyhedron> ps2(2, EMPTY); + + // Populate ps1 with a single square. + ph = C_Polyhedron(2, UNIVERSE); + ph.add_constraint(A >= 10); + ph.add_constraint(A <= 40); + ph.add_constraint(B >= 10); + ph.add_constraint(B <= 40); + + ps1.add_disjunct(ph); + + nout << "Pointset_Powerset to be simplified:\n"; + for (Pointset_Powerset<C_Polyhedron>::const_iterator i = ps1.begin(), + iend = ps1.end(); i != iend; ++i) { + print_constraints(i->pointset()); + nout << "\n"; + } + + // Populate ps2 with four squares intersecting the single square above. + ph = C_Polyhedron(2, UNIVERSE); + ph.add_constraint(A >= 0); + ph.add_constraint(A <= 20); + ph.add_constraint(B >= 0); + ph.add_constraint(B <= 20); + + ps2.add_disjunct(ph); + + ph.affine_image(B, B + 30); + ps2.add_disjunct(ph); + + ph.affine_image(A, A + 30); + ps2.add_disjunct(ph); + + ph.affine_image(B, B - 30); + ps2.add_disjunct(ph); + + nout << "\nPointset_Powerset to be used as context:\n"; + for (Pointset_Powerset<C_Polyhedron>::const_iterator i = ps2.begin(), + iend = ps2.end(); i != iend; ++i) { + print_constraints(i->pointset()); + nout << "\n"; + } + + Pointset_Powerset<C_Polyhedron> known_result(ps1); + + ps1.simplify_using_context_assign(ps2); + + bool ok = (ps1 == known_result); + + for (Pointset_Powerset<C_Polyhedron>::const_iterator i = ps1.begin(), + iend = ps1.end(); i != iend; ++i) { + print_constraints(i->pointset()); + nout << "\n"; + } + + return ok; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); + DO_TEST(test04); + DO_TEST_F8A(test05); + DO_TEST(test06); + DO_TEST(test07); + DO_TEST(test08); + DO_TEST_F8A(test09); +END_MAIN diff --git a/tests/Powerset/size1.cc b/tests/Powerset/size1.cc new file mode 100644 index 000000000..78d5b0f1d --- /dev/null +++ b/tests/Powerset/size1.cc @@ -0,0 +1,75 @@ +/* Test Pointset_Powerset<PH>::size(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: size(). +bool +test01() { + Variable x(0); + Pointset_Powerset<C_Polyhedron> c_ps(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + c_ps.add_disjunct(C_Polyhedron(cs)); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 3); + c_ps.add_disjunct(C_Polyhedron(cs)); + + bool ok = (c_ps.size() == 2); + + return ok; +} + +// Powerset of boxes: size(). +bool +test02() { + Variable x(0); + Pointset_Powerset<TBox> pps_box(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + pps_box.add_disjunct(TBox(cs)); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 3); + pps_box.add_disjunct(TBox(cs)); + + bool ok = (pps_box.size() == 2); + + return ok; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); +END_MAIN diff --git a/tests/Powerset/spacedims1.cc b/tests/Powerset/spacedims1.cc new file mode 100644 index 000000000..340ec77b3 --- /dev/null +++ b/tests/Powerset/spacedims1.cc @@ -0,0 +1,213 @@ +/* Test Pointset_Powerset<PH>::add_space_dimensions(), + Pointset_Powerset<PH>::remove_higher_space_dimensions(), + Pointset_Powerset<PH>::remove_space_dimensions(), + Pointset_Powerset<PH>::expand_space_dimensions(), + Pointset_Powerset<PH>::fold_space_dimensions(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: add_space_dimensions_and_embed(), +// add_space_dimensions_and_project(). +bool +test01() { + Variable x(0); + + C_Polyhedron ph1(1); + ph1.add_constraint(x == 1); + + C_Polyhedron ph2(1); + ph2.add_constraint(x <= 2); + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + + ps.add_disjunct(ph1); + ps.add_disjunct(ph2); + + dimension_type m = 2; + + ps.add_space_dimensions_and_embed(m); + bool ok = (ps.space_dimension() == 3 && ps.affine_dimension() == 3); + + ps.add_space_dimensions_and_project(m); + bool ok1 = (ps.space_dimension() == 5 && ps.affine_dimension() == 3); + + ps.remove_higher_space_dimensions(4); + bool ok2 = (ps.space_dimension() == 4 && ps.affine_dimension() == 3); + + Pointset_Powerset<Rational_Box> psb(7, EMPTY); + Rational_Box b(7); + b.add_constraint(x >= 1); + b.add_constraint(x <= 0); + psb.add_disjunct(b); + bool ok3 = (psb.space_dimension() == 7 && psb.affine_dimension() == 0); + + Pointset_Powerset<Grid> psg(7, EMPTY); + Grid g(7); + g.add_congruence((x %= 0) / 2); + g.add_congruence((x %= 1) / 2); + psg.add_disjunct(g); + bool ok4 = (psg.space_dimension() == 7 && psg.affine_dimension() == 0); + + return ok && ok1 && ok2 && ok3 && ok4 && ps.OK(); +} + +// Powerset of C polyhedra: remove_higher_space_dimensions(). +bool +test02() { + Variable x(0); + + C_Polyhedron ph1(1); + ph1.add_constraint(x == 1); + + C_Polyhedron ph2(1); + ph2.add_constraint(x <= 2); + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + + ps.add_disjunct(ph1); + ps.add_disjunct(ph2); + + dimension_type m = 2; + + ps.add_space_dimensions_and_embed(m); + bool ok = (ps.space_dimension() == 3 && ps.affine_dimension() == 3); + + ps.add_space_dimensions_and_project(m); + bool ok1 = (ps.space_dimension() == 5 && ps.affine_dimension() == 3); + + ps.remove_higher_space_dimensions(4); + bool ok2 = (ps.space_dimension() == 4 && ps.affine_dimension() == 3); + + Pointset_Powerset<Rational_Box> psb(7, EMPTY); + Rational_Box b(7); + b.add_constraint(x >= 1); + b.add_constraint(x <= 0); + psb.add_disjunct(b); + bool ok3 = (psb.space_dimension() == 7 && psb.affine_dimension() == 0); + + Pointset_Powerset<Grid> psg(7, EMPTY); + Grid g(7); + g.add_congruence((x %= 0) / 2); + g.add_congruence((x %= 1) / 2); + psg.add_disjunct(g); + bool ok4 = (psg.space_dimension() == 7 && psg.affine_dimension() == 0); + + return ok && ok1 && ok2 && ok3 && ok4 && ps.OK(); +} + +// Powerset of C polyhedra: remove_space_dimensions(). +bool +test03() { + Variable x(0); + Variable y(1); + Variable z(2); + Variable w(3); + + C_Polyhedron ph1(4); + ph1.add_constraint(x == 1); + ph1.add_constraint(z == 1); + + C_Polyhedron ph2(4); + ph2.add_constraint(x <= 2); + ph2.add_constraint(z == 1); + Pointset_Powerset<C_Polyhedron> ps(4, EMPTY); + + ps.add_disjunct(ph1); + ps.add_disjunct(ph2); + + Variables_Set to_be_removed; + to_be_removed.insert(y); + to_be_removed.insert(w); + + ps.remove_space_dimensions(to_be_removed); + bool ok = (ps.space_dimension() == 2 && ps.affine_dimension() == 1); + + return ok && ps.OK(); +} + +// Powerset of C polyhedra: expand_space_dimension(). +bool +test04() { + Variable x(0); + Variable y(1); + Variable z(2); + Variable w(3); + + C_Polyhedron ph1(4); + ph1.add_constraint(x == 1); + ph1.add_constraint(z == 1); + + C_Polyhedron ph2(4); + ph2.add_constraint(x <= 2); + ph2.add_constraint(z == 1); + Pointset_Powerset<C_Polyhedron> ps(4, EMPTY); + + ps.add_disjunct(ph1); + ps.add_disjunct(ph2); + + ps.expand_space_dimension(y, 2); + bool ok = (ps.space_dimension() == 6 && ps.affine_dimension() == 5); + + return ok && ps.OK(); +} + +// Powerset of C polyhedra: fold_space_dimensions(). +bool +test05() { + Variable x(0); + Variable y(1); + Variable z(2); + Variable w(3); + + C_Polyhedron ph1(4); + ph1.add_constraint(x == 1); + ph1.add_constraint(z == 1); + + C_Polyhedron ph2(4); + ph2.add_constraint(x <= 2); + ph2.add_constraint(z == 1); + Pointset_Powerset<C_Polyhedron> ps(4, EMPTY); + + ps.add_disjunct(ph1); + ps.add_disjunct(ph2); + + Variables_Set to_be_folded; + to_be_folded.insert(y); + to_be_folded.insert(w); + + ps.fold_space_dimensions(to_be_folded, z); + bool ok = (ps.space_dimension() == 2 && ps.affine_dimension() == 2); + + return ok && ps.OK(); +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); + DO_TEST(test04); + DO_TEST(test05); +END_MAIN diff --git a/tests/Powerset/universe1.cc b/tests/Powerset/universe1.cc new file mode 100644 index 000000000..cab2b8cc4 --- /dev/null +++ b/tests/Powerset/universe1.cc @@ -0,0 +1,104 @@ +/* Test Pointset_Powerset<PH>::is_universe(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: is_universe(). +bool +test01() { + Pointset_Powerset<C_Polyhedron> ps(0, EMPTY); + bool b = !ps.is_universe(); + + ps.add_disjunct(C_Polyhedron(0)); + bool b1 = ps.is_universe(); + return b && b1; +} + +// Powerset of NNC polyhedra: is_universe(). +bool +test02() { + Variable x(0); + Constraint_System cs; + Pointset_Powerset<NNC_Polyhedron> ps(1, EMPTY); + + cs.clear(); + cs.insert(x > 0); + cs.insert(x <= 1); + ps.add_disjunct(NNC_Polyhedron(cs)); + + cs.clear(); + cs.insert(x >= 0); + cs.insert(x < 1); + ps.add_disjunct(NNC_Polyhedron(cs)); + + bool b = !ps.is_universe(); + return b; +} + +// Powerset of C polyhedra: is_universe(). +bool +test03() { + Pointset_Powerset<C_Polyhedron> ps(1, EMPTY); + bool b = !ps.is_universe(); + + ps.add_disjunct(C_Polyhedron(1)); + + bool b1 = ps.is_universe(); + return b && b1; +} + +// Powerset of grids: is_universe(). +bool +test04() { + Variable A(0); + Variable B(1); + Pointset_Powerset<Grid> ps(2, EMPTY); + bool b0 = !ps.is_universe(); + + Grid g(2); + g.add_congruence((A %= 0) / 2); + ps.add_disjunct(g); + bool b1 = !ps.is_universe(); + + g = Grid(2); + g.add_congruence((A + B %= 0) / 2); + ps.add_disjunct(g); + bool b2 = !ps.is_universe(); + + g = Grid(2); + ps.add_disjunct(g); + bool b3 = ps.is_universe(); + + return b0 && b1 && b2 && b3; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); + DO_TEST(test04); +END_MAIN diff --git a/tests/Powerset/upperbound1.cc b/tests/Powerset/upperbound1.cc new file mode 100644 index 000000000..4ec961f5e --- /dev/null +++ b/tests/Powerset/upperbound1.cc @@ -0,0 +1,164 @@ +/* Test Pointset_Powerset<PH>::upper_bound_assign(), + Pointset_Powerset<PH>::least_upper_bound_assign(). + Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> + Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com) + +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 { + +// Powerset of C polyhedra: least_upper_bound_assign(). +bool +test01() { + Variable x(0); + Pointset_Powerset<C_Polyhedron> c_ps(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + c_ps.add_disjunct(C_Polyhedron(cs)); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 3); + + Pointset_Powerset<C_Polyhedron> c_ps1(1, EMPTY); + c_ps1.add_disjunct(C_Polyhedron(cs)); + c_ps.least_upper_bound_assign(c_ps1); + + cs.clear(); + cs.insert(x >= 0); + cs.insert(x <= 3); + + Pointset_Powerset<C_Polyhedron> c_ps2(1, EMPTY); + c_ps2.add_disjunct(C_Polyhedron(cs)); + + bool ok = c_ps.definitely_entails(c_ps2); + bool ok1 = !c_ps2.definitely_entails(c_ps); + + return ok && ok1; +} + +// Powerset of C polyhedra: upper_bound_assign(). +bool +test02() { + Variable x(0); + Pointset_Powerset<C_Polyhedron> c_ps(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + c_ps.add_disjunct(C_Polyhedron(cs)); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 3); + + Pointset_Powerset<C_Polyhedron> c_ps1(1, EMPTY); + c_ps1.add_disjunct(C_Polyhedron(cs)); + c_ps.upper_bound_assign(c_ps1); + + cs.clear(); + cs.insert(x >= 0); + cs.insert(x <= 3); + + Pointset_Powerset<C_Polyhedron> c_ps2(1, EMPTY); + c_ps2.add_disjunct(C_Polyhedron(cs)); + + bool ok = c_ps.definitely_entails(c_ps2); + bool ok1 = !c_ps2.definitely_entails(c_ps); + + return ok && ok1; +} + +// Powerset of boxes: upper_bound_assign(). +bool +test03() { + Variable x(0); + Pointset_Powerset<TBox> pps_box(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + pps_box.add_disjunct(TBox(cs)); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 3); + + Pointset_Powerset<TBox> pps_box1(1, EMPTY); + pps_box1.add_disjunct(TBox(cs)); + pps_box.upper_bound_assign(pps_box1); + + cs.clear(); + cs.insert(x >= 0); + cs.insert(x <= 3); + + Pointset_Powerset<TBox> pps_box2(1, EMPTY); + pps_box2.add_disjunct(TBox(cs)); + + bool ok = pps_box.definitely_entails(pps_box2); + bool ok1 = !pps_box2.definitely_entails(pps_box); + + return ok && ok1; +} + +// Powerset of boxes: least_upper_bound_assign(). +bool +test04() { + Variable x(0); + Pointset_Powerset<TBox> pps_box(1, EMPTY); + Constraint_System cs; + + cs.insert(x >= 0); + cs.insert(x <= 2); + pps_box.add_disjunct(TBox(cs)); + + cs.clear(); + cs.insert(x >= 1); + cs.insert(x <= 3); + + Pointset_Powerset<TBox> pps_box1(1, EMPTY); + pps_box1.add_disjunct(TBox(cs)); + pps_box.least_upper_bound_assign(pps_box1); + + cs.clear(); + cs.insert(x >= 0); + cs.insert(x <= 3); + + Pointset_Powerset<TBox> pps_box2(1, EMPTY); + pps_box2.add_disjunct(TBox(cs)); + + bool ok = pps_box.definitely_entails(pps_box2); + bool ok1 = !pps_box2.definitely_entails(pps_box); + + return ok && ok1; +} + +} // namespace + +BEGIN_MAIN + DO_TEST(test01); + DO_TEST(test02); + DO_TEST(test03); + DO_TEST(test04); +END_MAIN |