Index: ppl/src/LinExpression.cc diff -c ppl/src/LinExpression.cc:1.12 ppl/src/LinExpression.cc:1.12.2.1 *** ppl/src/LinExpression.cc:1.12 Mon Jun 17 18:05:47 2002 --- ppl/src/LinExpression.cc Mon Oct 28 08:14:48 2002 *************** *** 189,197 **** for (size_t i = e2_size; i-- > 0; ) e1[i] -= e2[i]; else { ! LinExpression e(e2); ! for (size_t i = e1_size; i-- > 0; ) ! e[i] -= e1[i]; std::swap(e1, e); } return e1; --- 189,197 ---- for (size_t i = e2_size; i-- > 0; ) e1[i] -= e2[i]; else { ! LinExpression e(e1, e2_size); ! for (size_t i = e2_size; i-- > 0; ) ! e[i] -= e2[i]; std::swap(e1, e); } return e1; Index: ppl/tests/Makefile.am diff -c ppl/tests/Makefile.am:1.79.2.4 ppl/tests/Makefile.am:1.79.2.5 *** ppl/tests/Makefile.am:1.79.2.4 Thu Oct 3 10:43:54 2002 --- ppl/tests/Makefile.am Mon Oct 28 08:04:37 2002 *************** *** 58,63 **** --- 58,64 ---- inclusion1 \ inters1 inters2 inters3 inters4 inters5 inters6 inters7 \ limitedh79widening1 limitedh79widening2\ + linexpression1 \ memory1 \ minconstraints1 minconstraints2 minconstraints3 \ mingenerators1 mingenerators2 mingenerators3 \ *************** *** 155,160 **** --- 156,163 ---- limitedh79widening1_SOURCES = limitedh79widening1.cc limitedh79widening2_SOURCES = limitedh79widening2.cc + + linexpression1_SOURCES = linexpression1.cc memory1_SOURCES = memory1.cc Index: ppl/tests/linexpression1.cc diff -c /dev/null ppl/tests/linexpression1.cc:1.1.2.1 *** /dev/null Mon Oct 28 08:19:09 2002 --- ppl/tests/linexpression1.cc Mon Oct 28 08:04:37 2002 *************** *** 0 **** --- 1,61 ---- + /* Test operator-=(LinExpression& e1, const LinExpression& e2): + in this case the dimension of e2 is strictly greater than + the dimension of e1. + Copyright (C) 2001, 2002 Roberto Bagnara + + 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 2 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/ . */ + + #include "ppl_install.hh" + #include "print.hh" + #include "ehandlers.hh" + + using namespace std; + using namespace Parma_Polyhedra_Library; + + #ifndef NOISY + #define NOISY 0 + #endif + + int + main() { + set_handlers(); + + Variable A(0); + Variable B(1); + + LinExpression e1 = A; + LinExpression e2 = B; + e1 -= e2; + + C_Polyhedron ph(2); + ph.add_constraint(e1 >= 0); + + C_Polyhedron known_result(2); + known_result.add_constraint(A - B >= 0); + + int retval = (ph == known_result) ? 0 : 1; + + #if NOISY + print_constraints(ph, "*** ph ***"); + #endif + + return retval; + }