コード例 #1
0
ファイル: gol03_test.py プロジェクト: hemmerling/codingdojo
 def testDoWeNeedAnotherPeriod(self):
     field = Field()
     cell = Cell()
     cell2 = Cell()
     field.append(Cell)
     field.append(cell2)
     assert field.number_of_neighbours() == 2, 'Field cant count its neighbours'
コード例 #2
0
ファイル: gol03_test.py プロジェクト: hemmerling/codingdojo
class Gol03Test(unittest.TestCase):

    field = None
    cell = None

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def testIsCellCreated(self):
        self.cell = Cell()
        assert self.cell.exist() == True, 'Cell was not created'

    def testIsCellAlive(self):
        self.field = Field()
        self.coordinate = [0,0]
        self.field.is_cell_alive(self.coordinate) == False, 'Cell is not alive'

    def testSetACellAlive(self):
        self.field = Field()
        self.coordinate = [0,0]
        self.field.append(self.coordinate)
        self.field.is_cell_alive(self.coordinate) == True, 'Cell is not alive'

    def testDoWeNeedAnotherPeriod(self):
        field = Field()
        cell = Cell()
        cell2 = Cell()
        field.append(Cell)
        field.append(cell2)
        assert field.number_of_neighbours() == 2, 'Field cant count its neighbours'