Beispiel #1
0
 public CarData(CarLocalization localization, double speed,
                PlaceLocalization startingPoint, PlaceLocalization endingPoint)
 {
     StartingPoint = startingPoint;
     EndingPoint   = endingPoint;
     Localization  = localization;
     Speed         = speed;
 }
        public void Localization_GetBigDistance_Correct()
        {
            CarLocalization locOne = new CarLocalization(
                new Coordinate(51.77828, 19.45139)
                );
            CarLocalization locTwo = new CarLocalization(
                new Coordinate(51.75884, 19.45569)
                );
            double expectedDistance = 2181.79;
            double errorBound       = 3;

            Assert.InRange(
                Distance.LocalizationDistance(locOne, locTwo),
                expectedDistance - errorBound,
                expectedDistance + errorBound);
        }
        public void Localization_GetDistance_Correct()
        {
            CarLocalization locOne = new CarLocalization(
                new Coordinate(19.45509, 51.77469)
                );
            CarLocalization locTwo = new CarLocalization(
                new Coordinate(19.45556, 51.77263)
                );
            double expectedDistance = 222.22;
            double errorBound       = 1;

            Assert.InRange(
                Distance.LocalizationDistance(locOne, locTwo),
                expectedDistance - errorBound,
                expectedDistance + errorBound);
        }
Beispiel #4
0
        public void AiT_GetCarsWithAccuracy_CorrectCarsReturned()
        {
            List <CarData> cars = new List <CarData> {
                new CarData(
                    new CarLocalization(new Coordinate(34.43422, 45.12132)),
                    21.92f,
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312)),
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312))),
                new CarData(
                    new CarLocalization(new Coordinate(34.42852, 45.12312)),
                    30.56f,
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312)),
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312))),
                new CarData(
                    new CarLocalization(new Coordinate(34.53452, 45.15682)),
                    26.34f,
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312)),
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312)))
            };
            List <CarData> carsExpected = new List <CarData> {
                new CarData(
                    new CarLocalization(new Coordinate(34.43422, 45.12132)),
                    21.92f,
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312)),
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312))),
                new CarData(
                    new CarLocalization(new Coordinate(34.42852, 45.12312)),
                    30.56f,
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312)),
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312)))
            };

            _Fixture.SaveToFile(cars);

            AiT             ait       = new AiT(_Fixture.DbPath);
            CarLocalization seedPoint = new CarLocalization(
                new Coordinate(34.43400, 45.12100)
                );

            Assert.Equal(carsExpected, ait.GetCarsWithAccuracy(seedPoint, 1000));
        }
Beispiel #5
0
        public void AiT_GetCarsAt_CorrectCarsReturned()
        {
            List <CarData> cars = new List <CarData> {
                new CarData(
                    new CarLocalization(new Coordinate(34.43422, 45.12332)),
                    21.92f,
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312)),
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312))),
                new CarData(
                    new CarLocalization(new Coordinate(34.43452, 45.12312)),
                    30.56f,
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312)),
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312))),
                new CarData(
                    new CarLocalization(new Coordinate(21.34391, 32.12902)),
                    26.34f,
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312)),
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312)))
            };
            List <CarData> carsExpected = new List <CarData> {
                new CarData(
                    new CarLocalization(new Coordinate(34.43422, 45.12332)),
                    21.92f,
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312)),
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312))),
                new CarData(
                    new CarLocalization(new Coordinate(34.43452, 45.12312)),
                    30.56f,
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312)),
                    new PlaceLocalization(new Coordinate(34.43422, 45.12312)))
            };

            _Fixture.SaveToFile(cars);

            AiT             ait       = new AiT(_Fixture.DbPath);
            CarLocalization seedPoint = new CarLocalization(
                new Coordinate(34.43412, 45.12342)
                );

            Assert.Equal(carsExpected, ait.GetCarsAt(seedPoint));
        }