예제 #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)