1 /* Test Pointset_Powerset<PH>::is_topologically_closed().
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 // Powerset of C polyhedra: is_topologically_closed().
29 bool
test01()30 test01() {
31   Pointset_Powerset<C_Polyhedron> ps(0, EMPTY);
32   bool b = ps.is_topologically_closed();
33 
34   ps.add_disjunct(C_Polyhedron(0));
35   bool b1 = ps.is_topologically_closed();
36   return b && b1;
37 }
38 
39 // Powerset of NNC polyhedra: is_topologically_closed().
40 bool
test02()41 test02() {
42   Variable x(0);
43   Constraint_System cs;
44   Pointset_Powerset<NNC_Polyhedron> ps(1, EMPTY);
45 
46   cs.clear();
47   cs.insert(x > 0);
48   cs.insert(x <= 1);
49   ps.add_disjunct(NNC_Polyhedron(cs));
50 
51   cs.clear();
52   cs.insert(x >= 0);
53   cs.insert(x <= 2);
54   ps.add_disjunct(NNC_Polyhedron(cs));
55 
56   bool b = ps.is_topologically_closed();
57   return b;
58 }
59 
60 // Powerset of NNC polyhedra: is_topologically_closed().
61 bool
test03()62 test03() {
63   Variable x(0);
64   Constraint_System cs;
65   Pointset_Powerset<NNC_Polyhedron> ps(1, EMPTY);
66 
67   cs.clear();
68   cs.insert(x >= 0);
69   cs.insert(x <= 1);
70   ps.add_disjunct(NNC_Polyhedron(cs));
71 
72   cs.clear();
73   cs.insert(x > 0);
74   cs.insert(x < 2);
75   ps.add_disjunct(NNC_Polyhedron(cs));
76 
77   bool b = !ps.is_topologically_closed();
78   return b;
79 }
80 
81 // Powerset of C polyhedra: is_topologically_closed().
82 bool
test04()83 test04() {
84   Pointset_Powerset<C_Polyhedron> ps(1, EMPTY);
85   bool b = ps.is_topologically_closed();
86 
87   ps.add_disjunct(C_Polyhedron(1));
88 
89   bool b1 = ps.is_topologically_closed();
90   return b && b1;
91 }
92 
93 } // namespace
94 
95 BEGIN_MAIN
96   DO_TEST(test01);
97   DO_TEST(test02);
98   DO_TEST(test03);
99   DO_TEST(test04);
100 END_MAIN
101