コード例 #1
0
 def test_condition_one(self):
     test_grid = Grid(size=4)
     game = GameOfLife(grid=test_grid)
     for x in range(0, 4):
         [
             test_grid.set_cell(
                 Cell(live=Life(status=True),
                      position_x=Position(x),
                      position_y=Position(y))) for y in range(0, 4)
         ]
     self.assertEqual(
         False,
         game.apply_rule_one(
             Cell(live=Life(status=True),
                  position_x=Position(2),
                  position_y=Position(2))))
コード例 #2
0
 def test_assign_correct_coordinates(self):
     state = Life(False)
     posX = Position(12)
     posY = Position(2)
     cell = Cell(live=state,position_x= posX, position_y = posY)
     self.assertEqual([12,2], cell.return_position())
コード例 #3
0
 def test_generate_live_cell(self):
     state = Life(True)
     posX = Position(0)
     posY = Position(0)
     cell = Cell(live=state,position_x= posX, position_y = posY)
     self.assertEqual(True, cell.live)
コード例 #4
0
 def test_assign_wrong_coordinates(self):
     state = Life(False)
     posX = Position(-12)
     posY = Position(2)
     cell = Cell(live=state,position_x= posX, position_y = posY)
     self.assertEqual(False, cell.return_position())