Exemplo n.º 1
0
 def test_project_correct(self):
     cs.init(3, {0:[0,1], 1:[2]})
     c1 = Cuboid([1,2,3],[7,8,9], {0:[0,1], 1:[2]})
     c2 = Cuboid([4,5,6],[7,7,7], {0:[0,1], 1:[2]})
     s = Core([c1, c2],{0:[0,1], 1:[2]})
     c1_res1 = Cuboid([1,2,float("-inf")],[7,8,float("inf")],{0:[0,1]})
     c2_res1 = Cuboid([4,5,float("-inf")],[7,7,float("inf")],{0:[0,1]})
     s_res1 = Core([c1_res1, c2_res1], {0:[0,1]})
     c1_res2 = Cuboid([float("-inf"),float("-inf"),3],[float("inf"),float("inf"),9],{1:[2]})
     c2_res2 = Cuboid([float("-inf"),float("-inf"),6],[float("inf"),float("inf"),7],{1:[2]})
     s_res2 = Core([c1_res2, c2_res2], {1:[2]})
     self.assertEqual(s.project_onto({0:[0,1]}), s_res1)
     self.assertEqual(s.project_onto({1:[2]}), s_res2)
Exemplo n.º 2
0
 def test_project_identical_domains(self):
     cs.init(3, {0: [0, 1, 2]})
     c1 = Cuboid([0, 0, 0], [2, 2, 2], {0: [0, 1, 2]})
     s = Core([c1], {0: [0, 1, 2]})
     self.assertEqual(s.project_onto({0: [0, 1, 2]}), s)
Exemplo n.º 3
0
 def test_project_illegal_domains_other_domain_name(self):
     cs.init(3, {0: [0, 1, 2]})
     c1 = Cuboid([0, 0, 0], [2, 2, 2], {0: [0, 1, 2]})
     s = Core([c1], {0: [0, 1, 2]})
     with self.assertRaises(Exception):
         s.project_onto({1: [0, 1, 2]})