Пример #1
0
 def test_flock_true(self):
     self.test_person_3 = person.Person("person 2", [115, 115], 10, 0, 0)
     self.test_person_4 = person.Person("person 2", [90, 90], 10, 0, 0)
     self.test_map.mapData.append(self.test_person_3)
     self.test_map.mapData.append(self.test_person_4)
     self.test_person.map = self.test_map
     self.assertIsNone(self.test_person.flock())
Пример #2
0
 def setUp(self):
     """Creating a map"""
     self.test_map = map_data.map_data(Mock(), 0)
     self.test_person = person.Person("person 1", [100, 100], 10, 0, 0)
     self.test_person_2 = person.Person("person 2", [200, 200], 10, 0, 0)
     self.test_dancefloor = DanceFloor([300, 300], 30, 30, 30)
     self.test_bar = Bar([400, 400], 30, 30, 30)
     self.test_toilet = Toilet([200, 200], "toilet", 200, 100)
     self.test_map.mapData.append(self.test_person)
     self.test_map.mapData.append(self.test_person_2)
     self.test_map.mapData.append(self.test_dancefloor)
Пример #3
0
 def test_check_circle_touch_touching(self):
     test_person = person.Person("person 1", [100, 100], 10, 0, 0)
     test_person2 = person.Person("person 1", [110, 100], 10, 0, 0)
     person1 = {
         "radius": test_person.get_width() / 2,
         "xCoord": test_person.get_coordinates()[0],
         "yCoord": test_person.get_coordinates()[1]
     }
     person2 = {
         "radius": test_person2.get_width() / 2,
         "xCoord": test_person2.get_coordinates()[0],
         "yCoord": test_person2.get_coordinates()[1]
     }
     result = self.test_map.check_circle_touch(person1, person2)
     self.assertEqual(result, 1)
Пример #4
0
 def test_get_objects_within_range_return_object(self):
     test_person = person.Person("person 1", [100, 100], 10, 0, 0)
     test_size = 100
     test_coords = test_person.get_coordinates()
     test_edge = test_person.get_edge_coordinates_array(test_coords, test_size)
     test_bar = bar.Bar([0, 0], "test", 200, 500)
     self.test_map.mapData.append(test_bar)
     result = self.test_map.get_objects_within_range([50, 50], 100, test_edge, test_person)
     self.assertIs(result[0], test_bar)
Пример #5
0
 def test_action(self):
     self.test_person_3 = person.Person("person 2", [115, 115], 10, 0, 0)
     self.test_bar = Bar([120, 120], 30, 30, 30)
     self.test_map.mapData.append(self.test_person_3)
     self.test_map.mapData.append(self.test_bar)
     self.test_map.set_size_screen(500, 500)
     self.test_map.generate_nodes()
     self.test_person.map = self.test_map
     self.test_person.action()
Пример #6
0
 def test_check_person_touching_object_overlap_true(self):
     test_person = person.Person("person 1", [100, 100], 10, 0, 0)
     test_coords = test_person.get_coordinates()
     test_width = round(test_person.width / 2)
     test_edge = test_person.get_edge_coordinates_array(test_coords, test_width)
     test_coordinates = [100, 100]
     test_object_size = 20
     test_coord_range = self.test_map.get_coordinates_range(test_coordinates, test_object_size)
     result = self.test_map.check_person_touching_object(test_edge, test_coord_range)
     self.assertTrue(result)
Пример #7
0
 def test_check_person_touching_object_false(self):
     test_person_2 = person.Person("person 1", [0, 0], 10, 0, 0)
     test_size = 10
     test_coords = test_person_2.get_coordinates()
     test_edge_coordinates = test_person_2.get_edge_coordinates_array(test_coords, test_size)
     test_coordinates = [100, 100]
     test_object_size = 20
     test_range = self.test_map.get_coordinates_range(test_coordinates, test_object_size)
     result = self.test_map.check_circle_overlap_rectangle(test_edge_coordinates, test_range)
     self.assertFalse(result)
Пример #8
0
 def test_serve_drink_drinksQueue_contains(self):
     test_person = person.Person("person 1", [100, 100], 10, 0, 0)
     self.test_bar.drinksQueue = [test_person]
     result = self.test_bar.serve_drink()
     self.assertEqual(result, 1)
Пример #9
0
 def setUp(self):
     self.test_toilet = toilet.Toilet([200, 200], "toilet", 200, 100)
     """Used to test the use of the toilets within the class."""
     self.test_person = person.Person("person", [20, 30], 10, 0, 0)
     self.test_person_2 = person.Person("person 2", [20, 30], 10, 0, 0)
Пример #10
0
 def setUp(self):
     self.test_map = map_data.map_data(None, 0)
     self.test_person = person.Person("person 1", [100, 100], 10, 0, 0)
Пример #11
0
 def test_get_people_within_range_false(self):
     test_person = person.Person("person 1", [100, 100], 10, 0, 0)
     results = self.test_map.get_people_within_range([100, 100], 10, test_person)
     self.assertFalse(results)
Пример #12
0
 def test_what_object_searching_people(self):
     test_person = person.Person("person 1", [100, 100], 10, 0, 0)
     self.test_map.mapData.append(test_person)
     test_person_coords = self.test_person.get_coordinates()
     result = self.test_map.what_object(test_person_coords, True)
     self.assertTrue(result)
Пример #13
0
 def test_flock(self):
     self.test_person_3 = person.Person("person 2", [115, 115], 10, 0, 0)
     self.test_bar = Bar([110, 110], 30, 30, 30)
     self.test_map.mapData.append(self.test_person_3)
     self.test_person.map = self.test_map
     self.test_person.flock()