Add basic tests for drop_dims
[linpy.git] / pypol / tests / test_domains.py
index 555c331..1beaa85 100644 (file)
@@ -21,6 +21,7 @@ class TestDomain(unittest.TestCase):
         self.disjoint = And(Ge(x, 0), Ge(-x + 2, 0), Ge(y, 0), Ge(-y + 2, 0))
         self.compliment = Or(Ge(-x - 1, 0), Ge(x - 3, 0), And(Ge(x, 0), Ge(-x + 2, 0), Ge(-y - 1, 0)), And(Ge(x, 0), Ge(-x + 2, 0), Ge(y - 3, 0)))
         self.hull = And(Ge(x, 0), Ge(-x + 2, 0), Ge(y, 0), Ge(-y + 2, 0))
         self.disjoint = And(Ge(x, 0), Ge(-x + 2, 0), Ge(y, 0), Ge(-y + 2, 0))
         self.compliment = Or(Ge(-x - 1, 0), Ge(x - 3, 0), And(Ge(x, 0), Ge(-x + 2, 0), Ge(-y - 1, 0)), And(Ge(x, 0), Ge(-x + 2, 0), Ge(y - 3, 0)))
         self.hull = And(Ge(x, 0), Ge(-x + 2, 0), Ge(y, 0), Ge(-y + 2, 0))
+        self.dropped = And(Ge(y, 0), Ge(-y + 2, 0))
         self.sample = And(Eq(y - 3, 0), Eq(x - 1, 0))
         self.intersection = And(Ge(x - 1, 0), Ge(-x + 2, 0), Ge(y - 1, 0), Ge(-y + 2, 0))
         self.union = Or(And(Ge(x, 0), Ge(-x + 2, 0), Ge(y, 0), Ge(-y + 2, 0)), And(Ge(x - 1, 0), Ge(-x + 3, 0), Ge(y - 1, 0), Ge(-y + 3, 0)))
         self.sample = And(Eq(y - 3, 0), Eq(x - 1, 0))
         self.intersection = And(Ge(x - 1, 0), Ge(-x + 2, 0), Ge(y - 1, 0), Ge(-y + 2, 0))
         self.union = Or(And(Ge(x, 0), Ge(-x + 2, 0), Ge(y, 0), Ge(-y + 2, 0)), And(Ge(x - 1, 0), Ge(-x + 3, 0), Ge(y - 1, 0), Ge(-y + 3, 0)))
@@ -75,6 +76,12 @@ class TestDomain(unittest.TestCase):
 
     def test_polyhedral_hull(self):
         self.assertEqual(self.square1.polyhedral_hull(), self.hull)
 
     def test_polyhedral_hull(self):
         self.assertEqual(self.square1.polyhedral_hull(), self.hull)
+    
+    def test_drop_dims(self):
+        self.assertEqual(self.square1.drop_dims('x'), self.dropped)
+        self.assertEqual(self.square1.drop_dims('x y'), self.universe)
+        self.assertEqual(self.universe.drop_dims(' '), self.universe)
+        self.assertEqual(self.empty.drop_dims(' '), Empty)
 
     @unittest.expectedFailure
     def test_simplify(self):
 
     @unittest.expectedFailure
     def test_simplify(self):