コード例 #1
0
 def testIsDead(self):
     matrix = GameOfLife.matrixUniverse(5, 5)
     matrix[1, 1] = 0
     matrix[1, 2] = 1
     dead = GameOfLife.isDead(1, 1)
     self.assertEqual(dead, True)
     notDead = GameOfLife.isDead(1, 2)
     self.assertFalse(notDead, False)
コード例 #2
0
 def testMatrixSize(self):
     matrix = GameOfLife.matrixUniverse(4, 4)
     matrix[3, 3] = 5
     self.assertEqual(matrix[0, 0], 0)
     self.assertEqual(matrix[3, 3], 5)
コード例 #3
0
 def testSetACell(self):
     matrix = GameOfLife.matrixUniverse(5, 5)
     isSet = GameOfLife.setACell(1, 2, 1)
     self.assertEqual(GameOfLife.matrix[2, 1], 1)
コード例 #4
0
 def testIsAlive(self):
     matrix = GameOfLife.matrixUniverse(5, 5)
     matrix[2, 4] = 1
     alive = GameOfLife.isAlive(2, 4)
     self.assertEqual(alive, True)