Esempio n. 1
0
 def testGenerateRandomFoodPositionOverSnakeFuzzTest(self):
     for i in range(100):
         snake = Snake()
         snakeCoordinatesList = snake.getSnakeCoordinates()
         snake.generateRandomFoodCoordinates(FOOD_STARTING_NUMBER)
         for foodCoordinates in snake.getFoodCoordinates():
             if foodCoordinates in snakeCoordinatesList:
                 raise AssertionError("Generated food coordinates shouldn't overlap snake!!!")
Esempio n. 2
0
 def testCreateNewFoodPositionOverFoodPositionFuzzTest(self):
     snake = Snake()
     for i in range(380):
         snake.generateRandomFoodCoordinates(1)
         seen = list()
         for foodCoordinates in snake.getFoodCoordinates():
             if foodCoordinates in seen:
                 raise AssertionError("Generated food coordinates shouldn't overlap other food coordinates!!!")
             else:
                 seen.append(foodCoordinates)
Esempio n. 3
0
 def testGenerateRandomFoodPositionOverFoodPositionFuzzTest(self):
     for i in range(100):
         snake = Snake()
         snake.generateRandomFoodCoordinates(FOOD_STARTING_NUMBER)
         seen = list()
         for foodCoordinates in snake.getFoodCoordinates():
             if foodCoordinates in seen:
                 raise AssertionError("Generated food coordinates shouldn't overlap other food coordinates!!!")
             else:
                 seen.append(foodCoordinates)
Esempio n. 4
0
 def testGenerateRandomFoodPosition(self):
     snake = Snake()
     snake2 = Snake()
     snake.generateRandomFoodCoordinates(FOOD_STARTING_NUMBER)
     snake2.generateRandomFoodCoordinates(FOOD_STARTING_NUMBER)
     assert_that(snake.getFoodCoordinates(), not equal_to(snake2.getFoodCoordinates()))