예제 #1
0
 def test_five_rectangles_with_shared_parts(self):
     lines = ['  +-+',
              '  | |',
              '+-+-+',
              '| | |',
              '+-+-+']
     self.assertEqual(count(lines), 5)
예제 #2
0
 def test_not_so_complicated(self):
     lines = ["+------+----+",
              "|      |    |",
              "+------+    |",
              "|   |       |",
              "+---+-------+"]
     self.assertEqual(2, count(lines))
예제 #3
0
 def test_incomplete_rectangles(self):
     lines = ["  +-+",
              "    |",
              "+-+-+",
              "| | -",
              "+-+-+"]
     self.assertEqual(1, count(lines))
예제 #4
0
 def test_two_rectangles_without_shared_parts(self):
     lines = ['  +-+',
              '  | |',
              '+-+-+',
              '| |  ',
              '+-+  ']
     self.assertEqual(count(lines), 2)
예제 #5
0
 def test_rectangles_can_be_of_different_sizes(self):
     lines = ['+------+----+',
              '|      |    |',
              '+---+--+    |',
              '|   |       |',
              '+---+-------+']
     self.assertEqual(count(lines), 3)
예제 #6
0
 def test_only_complete_rectangles_are_counted(self):
     lines = ['  +-+',
              '    |',
              '+-+-+',
              '| | -',
              '+-+-+']
     self.assertEqual(count(lines), 1)
예제 #7
0
 def test_corner_is_required_for_a_rectangle_to_be_complete(self):
     lines = ['+------+----+',
              '|      |    |',
              '+------+    |',
              '|   |       |',
              '+---+-------+']
     self.assertEqual(count(lines), 2)
예제 #8
0
 def test_two_rectangles_no_shared_parts(self):
     lines = ["  +-+",
              "  | |",
              "+-+-+",
              "| |  ",
              "+-+  "]
     self.assertEqual(2, count(lines))
예제 #9
0
 def test_one_rectangle(self):
     lines = [
         "+-+",
         "| |",
         "+-+",
     ]
     assert 1 == count(lines)
예제 #10
0
 def test_five_rectangles_three_regions(self):
     lines = ["  +-+",
              "  | |",
              "+-+-+",
              "| | |",
              "+-+-+"]
     self.assertEqual(5, count(lines))
예제 #11
0
 def test_not_so_complicated(self):
     lines = ["+------+----+",
              "|      |    |",
              "+------+    |",
              "|   |       |",
              "+---+-------+"
              ]
     assert 2 == count(lines)
예제 #12
0
 def test_five_rectangles_three_regions(self):
     lines = ["  +-+",
              "  | |",
              "+-+-+",
              "| | |",
              "+-+-+"
              ]
     assert 5 == count(lines)
예제 #13
0
 def test_two_rectangles_no_shared_parts(self):
     lines = ["  +-+",
              "  | |",
              "+-+-+",
              "| |  ",
              "+-+  "
              ]
     assert 2 == count(lines)
 def test_incomplete_rectangles(self):
     lines = ["  +-+",
              "    |",
              "+-+-+",
              "| | -",
              "+-+-+"
              ]
     assert 1 == count(lines)
 def test_not_so_complicated(self):
     lines = ["+------+----+",
              "|      |    |",
              "+------+    |",
              "|   |       |",
              "+---+-------+"
              ]
     assert 2 == count(lines)
 def test_two_rectangles_no_shared_parts(self):
     lines = ["  +-+",
              "  | |",
              "+-+-+",
              "| |  ",
              "+-+  "
              ]
     assert 2 == count(lines)
예제 #17
0
 def test_customized_0(self):
     lines = ["+-+-+-+-+-+-+-+-+-+-+-+-+-+",
              "+-+   +-+-+-+-+-+-+-+-+-+-+",
              "+-+-+-+-+-+-+-+   +-+-+-+-+",
              "+-+-+     +-+-+-+-+-+-+-+-+",
              "+-+-+-+-+-+-+-+-+-+-+-+-+-+"
              ]
     self.assertEqual(320, count(lines))
 def test_five_rectangles_three_regions(self):
     lines = ["  +-+",
              "  | |",
              "+-+-+",
              "| | |",
              "+-+-+"
              ]
     assert 5 == count(lines)
예제 #19
0
 def test_incomplete_rectangles(self):
     lines = ["  +-+",
              "    |",
              "+-+-+",
              "| | -",
              "+-+-+"
              ]
     assert 1 == count(lines)
예제 #20
0
 def test_large_input_with_many_rectangles(self):
     lines = ['+---+--+----+',
              '|   +--+----+',
              '+---+--+    |',
              '|   +--+----+',
              '+---+--+--+-+',
              '+---+--+--+-+',
              '+------+  | |',
              '          +-+']
     self.assertEqual(count(lines), 60)
 def test_empty_area(self):
     lines = " "
     assert 0 == count(lines)
 def test_zero_area_2(self):
     lines = ""
     assert 0 == count(lines)
예제 #23
0
 def test_no_rows(self):
     self.assertEqual(count([]), 0)
예제 #24
0
 def test_one_rectangle(self):
     lines = ["+-+", "| |", "+-+"]
     self.assertEqual(count(lines), 1)
예제 #25
0
 def test_zero_area_2(self):
     lines = ""
     assert 0 == count(lines)
예제 #26
0
 def test_no_columns(self):
     self.assertEqual(count(['']), 0)
예제 #27
0
 def test_incomplete_rectangles(self):
     lines = ["  +-+", "    |", "+-+-+", "| | -", "+-+-+"]
     self.assertEqual(count(lines), 1)
예제 #28
0
 def test_not_so_complicated(self):
     lines = [
         "+------+----+", "|      |    |", "+------+    |", "|   |       |",
         "+---+-------+"
     ]
     self.assertEqual(count(lines), 2)
예제 #29
0
 def test_one_rectangle(self):
     lines = ['+-+',
              '| |',
              '+-+']
     self.assertEqual(count(lines), 1)
예제 #30
0
 def test_no_rectangles(self):
     self.assertEqual(count([' ']), 0)
 def test_one_rectangle(self):
     lines = ["+-+",
              "| |",
              "+-+",
              ]
     assert 1 == count(lines)
예제 #32
0
 def test_zero_area_1(self):
     self.assertEqual(count(), 0)
예제 #33
0
 def test_empty_area(self):
     lines = " "
     self.assertEqual(count(lines), 0)
예제 #34
0
 def test_zero_area_1(self):
     assert 0 == count()
예제 #35
0
 def test_five_rectangles_three_regions(self):
     lines = ["  +-+", "  | |", "+-+-+", "| | |", "+-+-+"]
     self.assertEqual(count(lines), 5)
예제 #36
0
 def test_empty_area(self):
     lines = " "
     assert 0 == count(lines)
 def test_zero_area_1(self):
     assert 0 == count()
예제 #38
0
 def test_two_rectangles_no_shared_parts(self):
     lines = ["  +-+", "  | |", "+-+-+", "| |  ", "+-+  "]
     self.assertEqual(count(lines), 2)
예제 #39
0
 def test_zero_area_2(self):
     lines = ""
     self.assertEqual(0, count(lines))
예제 #40
0
 def test_zero_area_2(self):
     lines = ""
     self.assertEqual(count(lines), 0)
예제 #41
0
 def test_rectangle_of_height_1_is_counted(self):
     lines = ['+--+',
              '+--+']
     self.assertEqual(count(lines), 1)
예제 #42
0
 def test_one_rectangle(self):
     lines = ["+-+",
              "| |",
              "+-+",
              ]
     self.assertEqual(1, count(lines))
예제 #43
0
 def test_empty_area(self):
     lines = " "
     self.assertEqual(0, count(lines))
예제 #44
0
 def test_rectangle_of_width_1_is_counted(self):
     lines = ['++',
              '||',
              '++']
     self.assertEqual(count(lines), 1)
예제 #45
0
 def test_zero_area_1(self):
     self.assertEqual(0, count())
예제 #46
0
 def test_1x1_square_is_counted(self):
     lines = ['++',
              '++']
     self.assertEqual(count(lines), 1)
예제 #47
0
 def test_customized_1(self):
     lines = ["+-+-+",
              "+-+-+",
              "+-+-+",
              ]
     self.assertEqual(9, count(lines))
 def test_complicated(self):
     lines = [
         "+------+----+", "|      |    |", "+---+--+    |", "|   |       |",
         "+---+-------+"
     ]
     self.assertEqual(3, count(lines))