예제 #1
0
 def test_seating_arrangement__select_seat_left_even_length(self):
     sa = SeatingArrangement(first_index=1)
     length = 6
     index = 2
     sa.seats_left = [(-length, index)]
     actual = sa._select_seat(10)
     expectation = (center_left_index(length) + index, index, length)
     self.assertEqual(expectation, actual)
예제 #2
0
 def test_seating_arrangement__select_seat_left_length_longer(self):
     sa = SeatingArrangement(first_index=1)
     length = 7
     index = 4
     sa.seats_left = [(-6, 3), (-5, 2), (-length, index), (-5, 5)]
     heapq.heapify(sa.seats_left)
     actual = sa._select_seat(30)
     expectation = (center_left_index(length) + index, index, length)
     self.assertEqual(expectation, actual)
예제 #3
0
 def test_seating_arrangement__select_seat_left_putting_left_length(self):
     sa = SeatingArrangement(first_index=1)
     length = 3
     index = 2
     sa.seats_left = [(-length, 3), (-length, index), (-length, 4),
                      (-length, 5)]
     heapq.heapify(sa.seats_left)
     actual = sa._select_seat(20)
     expectation = (center_left_index(length) + index, index, length)
     self.assertEqual(expectation, actual)
예제 #4
0
 def test_seating_arrangement_searcht_frist_0_indexes(self):
     max_length = 10
     a = 4
     sa_0 = SeatingArrangement(first_index=0)
     actual = sa_0.search(max_length, a - 1)
     sa_1 = SeatingArrangement(first_index=1)
     expectation = list(map(lambda x: x - 1, sa_1.search(max_length, a)))
     self.assertEqual(expectation, actual)
예제 #5
0
 def test_seating_arrangement_searcht_6_elements_06(self):
     expectation = [6, 1, 3, 4, 2, 5]
     sa = SeatingArrangement(first_index=1)
     actual = sa.search(6, 6)
     self.assertEqual(expectation, actual)
예제 #6
0
 def test_seating_arrangement_searcht_5_elements_05(self):
     expectation = [5, 1, 3, 2, 4]
     sa = SeatingArrangement(first_index=1)
     actual = sa.search(5, 5)
     self.assertEqual(expectation, actual)