コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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))
コード例 #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)
コード例 #7
0
 def test_not_exist(self):
     """Test list"""
     board = a.Life()
     self.assertEqual(board.get_cell(0, 0), (0, 0))
コード例 #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))
コード例 #9
0
 def test_iterable(self):
     """Test iter of Life"""
     board = a.Life()
     self.assertTrue(iter(board))
コード例 #10
0
 def test_zero(self):
     """Zero livers"""
     board = a.Life()
     self.assertEqual(board.count_of_livers(1, 1), 0)
コード例 #11
0
 def test_negative(self):
     """Test living"""
     board = a.Life()
     board.add(-100, -100)
     self.assertEqual(board.get_cell(-100, -100)[0], 1)