Exemple #1
0
 def test_dead(self):
     """Test dead"""
     board = a.Life()
     board.add(0, 0)
     board.add(1, 1)
     board.new_generation()
     self.assertEqual(board.get_cell(0, 0)[0], 0)
Exemple #2
0
 def test_list(self):
     """Test list"""
     board = a.Life()
     board.cells = [[(0, 0), (0, 0)], [(0, 0), (0, 0)]]
     for line in board.cells:
         for cell in line:
             self.assertEqual((0, 0), cell)
Exemple #3
0
 def test_four(self):
     """Four livers"""
     board = a.Life()
     board.add(0, 1)
     board.add(1, 0)
     board.add(1, 2)
     board.add(2, 1)
     self.assertEqual(board.count_of_livers(1, 1), 4)
Exemple #4
0
 def test_living(self):
     """Test living"""
     board = a.Life()
     board.add(1, 0)
     board.add(0, 0)
     board.add(1, 1)
     board.new_generation()
     self.assertEqual(board.get_cell(1, 0)[0], 1)
Exemple #5
0
 def test_alive(self):
     """Test alive"""
     board = a.Life()
     board.add(1, 0)
     board.add(0, 0)
     board.add(1, 1)
     board.new_generation()
     self.assertEqual(board.get_cell(0, 1), (1, 1))
Exemple #6
0
 def test_titan(self):
     """Test living"""
     board = a.Life()
     board.add(0, 0)
     board.add(0, 1)
     board.add(1, 0)
     board.add(1, 1)
     start = copy.copy(board)
     board.new_generation()
     self.assertEqual(board, start)
Exemple #7
0
 def test_not_exist(self):
     """Test list"""
     board = a.Life()
     self.assertEqual(board.get_cell(0, 0), (0, 0))
Exemple #8
0
 def test_exist(self):
     """Test iter of Life"""
     board = a.Life()
     board.add(0, 0)
     self.assertEqual(board.get_cell(0, 0), (1, 1))
Exemple #9
0
 def test_iterable(self):
     """Test iter of Life"""
     board = a.Life()
     self.assertTrue(iter(board))
Exemple #10
0
 def test_zero(self):
     """Zero livers"""
     board = a.Life()
     self.assertEqual(board.count_of_livers(1, 1), 0)
Exemple #11
0
 def test_negative(self):
     """Test living"""
     board = a.Life()
     board.add(-100, -100)
     self.assertEqual(board.get_cell(-100, -100)[0], 1)