1 /* Test Pointset_Powerset<PH>::BGP99_extrapolation_assign().
2    Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3    Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4 
5 This file is part of the Parma Polyhedra Library (PPL).
6 
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20 
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23 
24 #include "ppl_test.hh"
25 
26 namespace {
27 
28 bool
test01()29 test01() {
30   typedef Pointset_Powerset<TBox> Box_Set;
31 
32   Variable A(0);
33   Variable B(1);
34 
35   TBox box1(2);
36   box1.add_constraint(A >= 0);
37   TBox box2(2);
38   box2.add_constraint(A >= 1);
39   TBox box3(2);
40   box3.add_constraint(A >= 2);
41   TBox box4(2);
42   box4.add_constraint(A >= 3);
43 
44   Box_Set box_set1(2, EMPTY);
45   box_set1.add_disjunct(box1);
46   box_set1.add_disjunct(box2);
47   box_set1.add_disjunct(box3);
48 
49   Box_Set box_set2(box_set1);
50   box_set1.add_disjunct(box4);
51 
52   using namespace IO_Operators;
53   nout << "*** box_set1 ***" << endl
54        << box_set1 << endl;
55   nout << "*** box_set2 ***" << endl
56        << box_set2 << endl;
57 
58   TBox box5(2);
59   box5.add_constraint(A >= 2);
60   box5.add_constraint(B >= 6);
61 
62   Box_Set known_result(2, EMPTY);
63   known_result.add_disjunct(box1);
64   known_result.add_disjunct(box2);
65   known_result.add_disjunct(box5);
66 
67   typedef void (TBox::*Widening_Member)(const TBox&, unsigned*);
68   Widening_Member wm = &TBox::CC76_widening_assign;
69   box_set1.BGP99_extrapolation_assign(box_set2, widen_fun_ref(wm), 3);
70 
71   bool ok = box_set1.geometrically_equals(known_result);
72 
73   nout
74     << "*** box_set1.BGP99_extrapolation_assign"
75     << "(box_set2, widen_fun_ref(&CC76_widening_assign), 3) ***"
76     << endl
77     << box_set1 << endl;
78 
79   return ok;
80 }
81 
82 } // namespace
83 
84 BEGIN_MAIN
85   DO_TEST(test01);
86 END_MAIN
87