Beispiel #1
0
        public void Insert07()
        {
            BinaryHeap <int, int> binaryHeap;

            binaryHeap = BinaryHeapFactory.Create(3);
            KeyValuePair <int, int>[] keyValuePairs = new KeyValuePair <int, int> [3];
            KeyValuePair <int, int>   s0            = new KeyValuePair <int, int>(1074003968, default(int))
            ;

            keyValuePairs[0] = s0;
            KeyValuePair <int, int> s1
                = new KeyValuePair <int, int>(-1463177872, default(int));

            keyValuePairs[1] = s1;
            KeyValuePair <int, int> s2
                = new KeyValuePair <int, int>(-1463177872, default(int));

            keyValuePairs[2] = s2;
            this.Insert <int, int>(binaryHeap, keyValuePairs);
        }
        public void InsertManyAndMoveNextAndReset07()
        {
            BinaryHeap <int, int> binaryHeap;

            binaryHeap = BinaryHeapFactory.Create(3);
            KeyValuePair <int, int>[] keyValuePairs = new KeyValuePair <int, int> [3];
            KeyValuePair <int, int>   s0            = new KeyValuePair <int, int>(2119361876, default(int))
            ;

            keyValuePairs[0] = s0;
            KeyValuePair <int, int> s1 = new KeyValuePair <int, int>(2119361876, default(int))
            ;

            keyValuePairs[1] = s1;
            KeyValuePair <int, int> s2 = new KeyValuePair <int, int>(2119361876, default(int))
            ;

            keyValuePairs[2] = s2;
            this.InsertManyAndMoveNextAndReset <int, int>(binaryHeap, keyValuePairs);
        }
Beispiel #3
0
        public void InsertAndMinimum128()
        {
            BinaryHeap <int, int> binaryHeap;

            binaryHeap = BinaryHeapFactory.Create(3);
            KeyValuePair <int, int>[] keyValuePairs = new KeyValuePair <int, int> [3];
            KeyValuePair <int, int>   s0
                = new KeyValuePair <int, int>(int.MinValue, default(int));

            keyValuePairs[0] = s0;
            KeyValuePair <int, int> s1
                = new KeyValuePair <int, int>(-2147483647, default(int));

            keyValuePairs[2] = s1;
            this.InsertAndMinimum <int, int>(binaryHeap, keyValuePairs);
            Assert.IsNotNull((object)binaryHeap);
            Assert.IsNotNull(binaryHeap.PriorityComparison);
            Assert.AreEqual <int>(3, binaryHeap.Capacity);
            Assert.AreEqual <int>(3, binaryHeap.Count);
        }
Beispiel #4
0
        public void Operations955()
        {
            BinaryHeap <int, int> binaryHeap;

            binaryHeap = BinaryHeapFactory.Create(2);
            KeyValuePair <bool, int>[] keyValuePairs = new KeyValuePair <bool, int> [5];
            KeyValuePair <bool, int>   s0            = new KeyValuePair <bool, int>(true, 1);

            keyValuePairs[0] = s0;
            KeyValuePair <bool, int> s1 = new KeyValuePair <bool, int>(true, default(int));

            keyValuePairs[1] = s1;
            KeyValuePair <bool, int> s2 = new KeyValuePair <bool, int>(true, default(int));

            keyValuePairs[3] = s2;
            this.Operations <int, int>(binaryHeap, keyValuePairs);
            Assert.IsNotNull((object)binaryHeap);
            Assert.IsNotNull(binaryHeap.PriorityComparison);
            Assert.AreEqual <int>(2, binaryHeap.Capacity);
            Assert.AreEqual <int>(1, binaryHeap.Count);
        }
        public void InsertAndRemoveMinimum878()
        {
            BinaryHeap <int, int> binaryHeap;

            binaryHeap = BinaryHeapFactory.Create(0);
            KeyValuePair <int, int>[] keyValuePairs = new KeyValuePair <int, int> [4];
            KeyValuePair <int, int>   s0
                = new KeyValuePair <int, int>(int.MinValue, default(int));

            keyValuePairs[0] = s0;
            KeyValuePair <int, int> s1 = new KeyValuePair <int, int>(2, default(int));

            keyValuePairs[2] = s1;
            KeyValuePair <int, int> s2 = new KeyValuePair <int, int>(1, default(int));

            keyValuePairs[3] = s2;
            this.InsertAndRemoveMinimum <int, int>(binaryHeap, keyValuePairs);
            Assert.IsNotNull((object)binaryHeap);
            Assert.IsNotNull(binaryHeap.PriorityComparison);
            Assert.AreEqual <int>(7, binaryHeap.Capacity);
            Assert.AreEqual <int>(0, binaryHeap.Count);
        }
        public void InsertAndRemoveMinimum09()
        {
            BinaryHeap <int, int> binaryHeap;

            binaryHeap = BinaryHeapFactory.Create(4);
            KeyValuePair <int, int>[] keyValuePairs = new KeyValuePair <int, int> [4];
            KeyValuePair <int, int>   s0            = new KeyValuePair <int, int>(772801092, default(int));

            keyValuePairs[0] = s0;
            KeyValuePair <int, int> s1 = new KeyValuePair <int, int>(1354760200, default(int))
            ;

            keyValuePairs[1] = s1;
            KeyValuePair <int, int> s2 = new KeyValuePair <int, int>(772801092, default(int));

            keyValuePairs[2] = s2;
            KeyValuePair <int, int> s3 = new KeyValuePair <int, int>(1944056222, default(int))
            ;

            keyValuePairs[3] = s3;
            this.InsertAndRemoveMinimum <int, int>(binaryHeap, keyValuePairs);
        }
Beispiel #7
0
        public void InsertAndMinimum07()
        {
            BinaryHeap <int, int> binaryHeap;

            binaryHeap = BinaryHeapFactory.Create(4);
            KeyValuePair <int, int>[] keyValuePairs = new KeyValuePair <int, int> [4];
            KeyValuePair <int, int>   s0
                = new KeyValuePair <int, int>(-1862136912, default(int));

            keyValuePairs[0] = s0;
            KeyValuePair <int, int> s1
                = new KeyValuePair <int, int>(-1862136912, default(int));

            keyValuePairs[1] = s1;
            KeyValuePair <int, int> s2 = new KeyValuePair <int, int>(402653436, default(int));

            keyValuePairs[2] = s2;
            KeyValuePair <int, int> s3
                = new KeyValuePair <int, int>(-1862136912, default(int));

            keyValuePairs[3] = s3;
            this.InsertAndMinimum <int, int>(binaryHeap, keyValuePairs);
        }
Beispiel #8
0
        public void OperationsThrowsInvalidOperationException202()
        {
            BinaryHeap <int, int> binaryHeap;

            binaryHeap = BinaryHeapFactory.Create(0);
            KeyValuePair <bool, int>[] keyValuePairs = new KeyValuePair <bool, int> [5];
            KeyValuePair <bool, int>   s0            = new KeyValuePair <bool, int>(true, default(int));

            keyValuePairs[0] = s0;
            KeyValuePair <bool, int> s1 = new KeyValuePair <bool, int>(default(bool), 1);

            keyValuePairs[1] = s1;
            KeyValuePair <bool, int> s2 = new KeyValuePair <bool, int>(true, 1);

            keyValuePairs[2] = s2;
            KeyValuePair <bool, int> s3 = new KeyValuePair <bool, int>(default(bool), 1);

            keyValuePairs[3] = s3;
            KeyValuePair <bool, int> s4 = new KeyValuePair <bool, int>(default(bool), 1);

            keyValuePairs[4] = s4;
            this.Operations <int, int>(binaryHeap, keyValuePairs);
        }
Beispiel #9
0
        public void Operations982()
        {
            BinaryHeap <int, int> binaryHeap;

            binaryHeap = BinaryHeapFactory.Create(3);
            KeyValuePair <bool, int>[] keyValuePairs = new KeyValuePair <bool, int> [4];
            KeyValuePair <bool, int>   s0            = new KeyValuePair <bool, int>(true, -507);

            keyValuePairs[0] = s0;
            KeyValuePair <bool, int> s1 = new KeyValuePair <bool, int>(true, 2147483136);

            keyValuePairs[1] = s1;
            KeyValuePair <bool, int> s2 = new KeyValuePair <bool, int>(true, -507);

            keyValuePairs[2] = s2;
            KeyValuePair <bool, int> s3 = new KeyValuePair <bool, int>(default(bool), 16384);

            keyValuePairs[3] = s3;
            this.Operations <int, int>(binaryHeap, keyValuePairs);
            Assert.IsNotNull((object)binaryHeap);
            Assert.IsNotNull(binaryHeap.PriorityComparison);
            Assert.AreEqual <int>(3, binaryHeap.Capacity);
            Assert.AreEqual <int>(2, binaryHeap.Count);
        }
Beispiel #10
0
        public static BinaryHeap <int, int> ExampleHeapFromTopologicalSortOfDCT8()
        {
            var heap = BinaryHeapFactory.Create(20);

            heap.Add(0, 255);
            heap.Add(0, 256);
            heap.Add(0, 257);
            heap.Add(0, 258);
            heap.Add(0, 259);
            heap.Add(0, 260);
            heap.Add(0, 261);
            heap.Add(0, 262);
            heap.Add(2, 263);
            heap.Add(2, 264);
            heap.Add(2, 265);
            heap.Add(2, 266);
            heap.Add(2, 267);
            heap.Add(2, 268);
            heap.Add(2, 269);
            heap.Add(2, 270);
            heap.Add(1, 271);
            heap.Add(1, 272);
            heap.Add(1, 273);
            heap.Add(1, 274);
            heap.Add(1, 275);
            heap.Add(1, 276);
            heap.Add(1, 277);
            heap.Add(1, 278);
            heap.Add(2, 279);
            heap.Add(2, 280);
            heap.Add(1, 281);
            heap.Add(1, 282);
            heap.Add(1, 283);
            heap.Add(1, 284);
            heap.Add(2, 285);
            heap.Add(2, 286);
            heap.Add(2, 287);
            heap.Add(2, 288);
            heap.Add(1, 289);
            heap.Add(1, 290);
            heap.Add(1, 291);
            heap.Add(1, 292);
            heap.Add(1, 293);
            heap.Add(1, 294);
            heap.Add(1, 295);
            heap.Add(1, 296);
            heap.Add(1, 297);
            heap.Add(1, 298);
            heap.Add(1, 299);
            heap.Add(2, 300);
            heap.Add(2, 301);
            heap.Add(2, 302);
            heap.Add(2, 303);
            heap.Add(1, 304);
            heap.Add(1, 305);
            heap.Add(1, 306);
            heap.Add(1, 307);
            heap.Add(2, 308);
            heap.Add(2, 309);
            heap.Add(2, 310);
            heap.Add(1, 311);
            heap.Add(2, 312);
            heap.Add(2, 313);
            heap.Add(2, 314);
            heap.Add(1, 315);
            heap.Add(1, 316);
            heap.Add(1, 317);
            heap.Add(1, 318);
            heap.Add(2, 319);
            heap.Add(2, 320);
            heap.Add(2, 321);
            heap.Add(2, 322);
            heap.Add(2, 323);
            heap.Add(2, 324);
            heap.Add(1, 325);
            heap.Add(2, 326);
            heap.Add(2, 327);
            heap.Add(2, 328);
            heap.Add(2, 329);
            heap.Add(1, 330);
            heap.Add(1, 331);
            heap.Add(1, 332);
            heap.Add(1, 333);
            heap.Add(0, 334);
            heap.Add(0, 335);
            heap.Add(0, 336);
            heap.Add(0, 337);
            heap.Add(0, 338);
            heap.AssertInvariants();
            return(heap);
        }