def testchangedeath(self): self.testgame = GOL8.game() self.testcell = self.testgame.grid[(0,0)] = GOL8.cell() self.testcell.state = 'alive' self.testcell.fate = 'death' self.testgame.change() assert self.testcell.state == 'potential' , "State should have changed to potential"
def testLookaroundyou(self): self.testgame = GOL8.game() self.testgame.grid[(0,0)] = GOL8.cell() self.testgame.grid[(1,1)] = GOL8.cell() self.testgame.grid[(0,1)] = GOL8.cell() self.testgame.lookaroundyou() assert self.testgame.grid[(0,0)].count == 2 , "Should count 2 live neighbours"
def testtidyup(self): self.testgame = GOL8.game() self.testcell = self.testgame.grid[(0,0)] = GOL8.cell() self.testcell.state = 'potential' self.testgame.tidyup() assert len(self.testgame.grid) == 0 , "Potential cell should have been deleted"
def testSurround(self): self.testgame = GOL8.game() self.testcell = self.testgame.grid[(0,0)] = GOL8.cell() self.testgame.surround() assert len(self.testgame.grid) == 9 , "for one lone cell surround should create 8 more potential ones"
def testAssessBirth(self): self.testcell = GOL8.cell() self.testcell.state = 'potential' self.testcell.count = 3 self.testcell.assess() assert self.testcell.fate == 'birth' , "cell fate should be birth"
def testAssessLoneDeath(self): self.testcell = GOL8.cell() self.testcell.state = 'alive' self.testcell.count = 1 self.testcell.assess() assert self.testcell.fate == 'death' , "cell fate should be death"