Beispiel #1
0
        public void CorrectCount()
        {
            int expected = 5;

            harness = new KdTree2D <int>();
            harness.Put(1, new Point2D(1, 1));
            harness.Put(2, new Point2D(2, 2));
            harness.Put(3, new Point2D(3, 3));
            harness.Put(4, new Point2D(4, 4));
            harness.Put(5, new Point2D(5, 5));
            Assert.AreEqual(expected, harness.Count);
        }
Beispiel #2
0
        public void Nearest3()
        {
            int expected = 3;

            harness = new KdTree2D <int>();
            harness.Put(1, new Point2D(1, 1));
            harness.Put(2, new Point2D(2, 2));
            harness.Put(3, new Point2D(3, 3));
            harness.Put(4, new Point2D(4, 4));
            harness.Put(5, new Point2D(5, 5));
            Assert.AreEqual(expected, harness.Nearest(new Point2D(3, 3)));
        }
Beispiel #3
0
        public void PutNull()
        {
            harness = new KdTree2D <int>();
            var ex = Assert.Throws <ArgumentNullException>(() => harness.Put(0, null));

            Assert.That(ex.Message, Is.EqualTo("Value cannot be null.\r\nParameter name: position"));
        }
Beispiel #4
0
        public void NearestNullPoint()
        {
            harness = new KdTree2D <int>();
            harness.Put(1, new Point2D(1, 1));
            var ex = Assert.Throws <ArgumentNullException>(() => harness.Nearest(null));

            Assert.That(ex.Message, Is.EqualTo("Value cannot be null.\r\nParameter name: point"));
        }