def test_count_sameLocation(self): grid = Grid() sensor1 = Sensor(3, 1, 50, 0, 0) sensor2 = Sensor(3, 1, 50, 0, 0) grid.add(sensor1) grid.add(sensor2) self.assertEqual(sensor1.countSensors(grid, -3, -3, 6, 6), 2)
def test_count_boundaries(self): grid = Grid() sensor1 = Sensor(3, 1, 50, 0, 0) sensor2 = Sensor(3, 1, 50, 3, 3) sensor3 = Sensor(3, 1, 50, -3, -3) sensor4 = Sensor(3, 1, 50, -3, 3) sensor5 = Sensor(3, 1, 50, 3, -3) grid.add(sensor1) grid.add(sensor2) grid.add(sensor3) grid.add(sensor4) grid.add(sensor5) self.assertEqual(sensor1.countSensors(grid, -3, -3, 6, 6), 5)
def test_count_basic(self): grid = Grid() sensor1 = Sensor(3, 1, 50, 0, 0) grid.add(sensor1) self.assertEqual(sensor1.countSensors(grid, -3, -3, 6, 6), 1)