コード例 #1
0
        public void TestIsPointCloseToEmptyListOfPoints()
        {
            Point        p1         = new Point(0, 0);
            List <Point> points     = new List <Point>();
            Bruteforce   bruteforce = new Bruteforce(points, 2.0);
            bool         actual     = bruteforce.PointIsCloseToOtherPoints(p1);

            Assert.AreEqual(false, actual);
        }
コード例 #2
0
        public void TestIPointProximity()
        {
            double          epsilon                = 2;
            Point           p                      = new Point(0, 0);
            List <Point>    points                 = new List <Point>();
            IPointProximity testGrid               = new Grid(points, epsilon);
            IPointProximity testBruteforce         = new Bruteforce(points, epsilon);
            bool            PointIsCloseGrid       = testGrid.PointIsCloseToOtherPoints(p);
            bool            PointIsCloseBruteforce = testBruteforce.PointIsCloseToOtherPoints(p);

            Assert.IsFalse(PointIsCloseGrid && PointIsCloseBruteforce);
        }
        public void CheckEachPointAndMakeBoolList()
        {
            IPointProximity bruteforce = new Bruteforce(points, epsilon);
            IPointProximity grid       = new Grid(points, epsilon);

            ClosePoints = new List <bool>();
            foreach (Point p in points)
            {
                bool equalBruteforce = bruteforce.PointIsCloseToOtherPoints(p);
                bool equalGrid       = grid.PointIsCloseToOtherPoints(p);
                ClosePoints.Add(equalBruteforce == equalGrid);
            }
        }
コード例 #4
0
        public void TestSamePoints()
        {
            Point        p1        = new Point(0, 0);
            Point        ListPoint = new Point(0, 0);
            List <Point> points    = new List <Point>
            {
                ListPoint
            };
            Bruteforce bruteforce = new Bruteforce(points, 2.0);
            bool       actual     = bruteforce.PointIsCloseToOtherPoints(p1);
            bool       expected   = false;

            Assert.AreEqual(expected, actual);
        }
コード例 #5
0
        public void AddedEpsilon_OtherPointDistanceLargerThanEpsilon()
        {
            Point        p1        = new Point(0, 0);
            Point        ListPoint = new Point(3, 0);
            double       epsilon   = 2;
            List <Point> points    = new List <Point>
            {
                ListPoint
            };
            Bruteforce bruteforce = new Bruteforce(points, epsilon);
            bool       actual     = bruteforce.PointIsCloseToOtherPoints(p1);
            bool       expected   = false;

            Assert.AreEqual(expected, actual);
        }