Пример #1
0
        public void CheckSplit()
        {
            var _NumberOfSplits = 0L;

            var _Bintree = new Bintree <Double>(0, 10, MaxNumberOfEmbeddedElements: 4);

            _Bintree.OnTreeSplit += (Bintree, Pixel) =>
            {
                Interlocked.Increment(ref _NumberOfSplits);
            };

            _Bintree.Add(1);
            Assert.AreEqual(1UL, _Bintree.EmbeddedCount);
            Assert.AreEqual(1UL, _Bintree.Count);

            _Bintree.Add(2);
            Assert.AreEqual(2, _Bintree.EmbeddedCount);
            Assert.AreEqual(2, _Bintree.Count);

            _Bintree.Add(8);
            Assert.AreEqual(3, _Bintree.EmbeddedCount);
            Assert.AreEqual(3, _Bintree.Count);

            _Bintree.Add(9);
            Assert.AreEqual(4, _Bintree.EmbeddedCount);
            Assert.AreEqual(4, _Bintree.Count);

            // Add the fifth pixel -> Should cause a split!
            _Bintree.Add(5);
            Assert.AreEqual(1L, _NumberOfSplits);

            Assert.AreEqual(0, _Bintree.EmbeddedCount);
            //    Assert.AreEqual(5, _Bintree.Count);
        }
Пример #2
0
        public void CheckSplit()
        {

            var _NumberOfSplits = 0L;

            var _Bintree = new Bintree<Double>(0, 10, MaxNumberOfEmbeddedElements: 4);
            _Bintree.OnTreeSplit += (Bintree, Pixel) =>
            {
                Interlocked.Increment(ref _NumberOfSplits);
            };

            _Bintree.Add(1);
            Assert.AreEqual(1UL, _Bintree.EmbeddedCount);
            Assert.AreEqual(1UL, _Bintree.Count);

            _Bintree.Add(2);
            Assert.AreEqual(2, _Bintree.EmbeddedCount);
            Assert.AreEqual(2, _Bintree.Count);

            _Bintree.Add(8);
            Assert.AreEqual(3, _Bintree.EmbeddedCount);
            Assert.AreEqual(3, _Bintree.Count);

            _Bintree.Add(9);
            Assert.AreEqual(4, _Bintree.EmbeddedCount);
            Assert.AreEqual(4, _Bintree.Count);

            // Add the fifth pixel -> Should cause a split!
            _Bintree.Add(5);
            Assert.AreEqual(1L, _NumberOfSplits);

            Assert.AreEqual(0, _Bintree.EmbeddedCount);
        //    Assert.AreEqual(5, _Bintree.Count);

        }
Пример #3
0
 public void VerifyOutOfBoundsException()
 {
     var _Bintree = new Bintree<Double>(1, 3);
     _Bintree.Add(10);
 }
Пример #4
0
        public void CheckRecursiveSplits()
        {

            var _NumberOfSplits = 0L;

            var _Bintree = new Bintree<Double>(0, 100, MaxNumberOfEmbeddedElements: 4);
            _Bintree.OnTreeSplit += (Bintree, Pixel) =>
            {
                Interlocked.Increment(ref _NumberOfSplits);
            };

            _Bintree.Add(1);
            _Bintree.Add(2);
            _Bintree.Add(3);
            _Bintree.Add(4);
            _Bintree.Add(5);
            _Bintree.Add(6);
            _Bintree.Add(50);
            _Bintree.Add(51);
            _Bintree.Add(52);
            _Bintree.Add(53);
            _Bintree.Add(54);
            _Bintree.Add(55);
            _Bintree.Add(56);
            _Bintree.Add(57);
            _Bintree.Add(58);
            _Bintree.Add(59);
            _Bintree.Add(60);

            Assert.AreEqual(9L, _NumberOfSplits);

        }
Пример #5
0
        public void VerifyOutOfBoundsException()
        {
            var _Bintree = new Bintree <Double>(1, 3);

            _Bintree.Add(10);
        }
Пример #6
0
        public void CheckRecursiveSplits()
        {
            var _NumberOfSplits = 0L;

            var _Bintree = new Bintree <Double>(0, 100, MaxNumberOfEmbeddedElements: 4);

            _Bintree.OnTreeSplit += (Bintree, Pixel) =>
            {
                Interlocked.Increment(ref _NumberOfSplits);
            };

            _Bintree.Add(1);
            _Bintree.Add(2);
            _Bintree.Add(3);
            _Bintree.Add(4);
            _Bintree.Add(5);
            _Bintree.Add(6);
            _Bintree.Add(50);
            _Bintree.Add(51);
            _Bintree.Add(52);
            _Bintree.Add(53);
            _Bintree.Add(54);
            _Bintree.Add(55);
            _Bintree.Add(56);
            _Bintree.Add(57);
            _Bintree.Add(58);
            _Bintree.Add(59);
            _Bintree.Add(60);

            Assert.AreEqual(9L, _NumberOfSplits);
        }