コード例 #1
0
 def test_contained_within(self):
     first = parse_cube_defn("on x=0..10,y=0..10,z=0..10")
     second = parse_cube_defn("on x=1..2,y=1..2,z=1..2")
     expected = [
         parse_cube_defn("on x=0..10,y=0..10,z=0..10"),
     ]
     self.assertListEqual(expected, split_composite_to_cubes(first, second))
     self.assertListEqual(expected, split_composite_to_cubes(second, first))
コード例 #2
0
 def test_sticking_out_top(self):
     first = parse_cube_defn("on x=0..10,y=0..10,z=0..10")
     second = parse_cube_defn("on x=1..2,y=1..2,z=1..12")
     expected = [
         parse_cube_defn("on x=0..10,y=0..10,z=0..10"),
         parse_cube_defn("on x=1..2,y=1..2,z=11..12"),
     ]
     self.assertListEqual(expected, split_composite_to_cubes(first, second))
     self.assertListEqual(expected, split_composite_to_cubes(second, first))
コード例 #3
0
 def test_corner_top_front_right(self):
     first = parse_cube_defn("on x=0..10,y=0..10,z=0..10")
     second = parse_cube_defn("on x=9..12,y=9..12,z=9..12")
     expected = [
         parse_cube_defn("on x=0..10,y=0..10,z=0..10"),
         parse_cube_defn("on x=9..10,y=9..10,z=11..12"),
         parse_cube_defn("on x=9..10,y=11..12,z=9..12"),
         parse_cube_defn("on x=11..12,y=9..12,z=9..12"),
     ]
     self.assertListEqual(expected, split_composite_to_cubes(first, second))
     self.assertListEqual(expected, split_composite_to_cubes(second, first))
コード例 #4
0
 def test_corners_bottom(self):
     first = parse_cube_defn("on x=0..10,y=0..10,z=0..10")
     second = parse_cube_defn("on x=-2..12,y=-2..12,z=-2..1")
     expected = [
         parse_cube_defn("on x=0..10,y=0..10,z=0..10"),
         parse_cube_defn("on x=0..10,y=0..10,z=-2..-1"),
         parse_cube_defn("on x=0..10,y=11..12,z=-2..1"),
         parse_cube_defn("on x=0..10,y=-2..-1,z=-2..1"),
         parse_cube_defn("on x=11..12,y=-2..12,z=-2..1"),
         parse_cube_defn("on x=-2..-1,y=-2..12,z=-2..1"),
     ]
     self.assertListEqual(expected, split_composite_to_cubes(first, second))
     self.assertListEqual(expected, split_composite_to_cubes(second, first))
コード例 #5
0
 def test_not_overlapping(self):
     first = parse_cube_defn("on x=0..10,y=0..10,z=0..10")
     second = parse_cube_defn("on x=11..20,y=11..20,z=11..20")
     expected = [
         parse_cube_defn("on x=0..10,y=0..10,z=0..10"),
         parse_cube_defn("on x=11..20,y=11..20,z=11..20")
     ]
     self.assertListEqual(expected, split_composite_to_cubes(first, second))