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)
def testMatrixSize(self): matrix = GameOfLife.matrixUniverse(4, 4) matrix[3, 3] = 5 self.assertEqual(matrix[0, 0], 0) self.assertEqual(matrix[3, 3], 5)
def testSetACell(self): matrix = GameOfLife.matrixUniverse(5, 5) isSet = GameOfLife.setACell(1, 2, 1) self.assertEqual(GameOfLife.matrix[2, 1], 1)
def testIsAlive(self): matrix = GameOfLife.matrixUniverse(5, 5) matrix[2, 4] = 1 alive = GameOfLife.isAlive(2, 4) self.assertEqual(alive, True)