Esempio n. 1
0
        public void Bunch8_EnumerationTest()
        {
            var bunch = new Bunch8<Int32>();

            bunch[0] = 2147483647;
            bunch[1] = 1073741823;
            bunch[2] = 715827882;
            bunch[3] = 536870911;
            bunch[4] = 429496729;
            bunch[5] = 357913941;
            bunch[6] = 306783378;
            bunch[7] = 268435455;

            var index = -1;
            foreach (var item in bunch)
            {
                ++index;
                switch(index)
                {
                    case 0:
                        Assert.AreEqual(2147483647, item);
                        break;
                    case 1:
                        Assert.AreEqual(1073741823, item);
                        break;
                    case 2:
                        Assert.AreEqual(715827882, item);
                        break;
                    case 3:
                        Assert.AreEqual(536870911, item);
                        break;
                    case 4:
                        Assert.AreEqual(429496729, item);
                        break;
                    case 5:
                        Assert.AreEqual(357913941, item);
                        break;
                    case 6:
                        Assert.AreEqual(306783378, item);
                        break;
                    case 7:
                        Assert.AreEqual(268435455, item);
                        break;

                    default:
                        Assert.Fail("Out of range enumeration");
                        break;
                }
            }
        }
Esempio n. 2
0
        public void Bunch8_IndexerTest()
        {
            var bunch = new Bunch8<Int32>();

            bunch[0] = 2147483647;
            bunch[1] = 1073741823;
            bunch[2] = 715827882;
            bunch[3] = 536870911;
            bunch[4] = 429496729;
            bunch[5] = 357913941;
            bunch[6] = 306783378;
            bunch[7] = 268435455;

            Assert.AreEqual(2147483647, bunch[0]);
            Assert.AreEqual(1073741823, bunch[1]);
            Assert.AreEqual(715827882, bunch[2]);
            Assert.AreEqual(536870911, bunch[3]);
            Assert.AreEqual(429496729, bunch[4]);
            Assert.AreEqual(357913941, bunch[5]);
            Assert.AreEqual(306783378, bunch[6]);
            Assert.AreEqual(268435455, bunch[7]);
        }
Esempio n. 3
0
        public void Bunch8_SetWithOutOfRangeIndexTest()
        {
            var bunch = new Bunch8<Int32>();

            Assert.Throws<IndexOutOfRangeException>(() => bunch[8] = 1);
        }
Esempio n. 4
0
        public void Bunch8_GetWithOutOfRangeIndexTest()
        {
            var bunch = new Bunch8<Int32>();

            Assert.Throws<IndexOutOfRangeException>(() => { var temp = bunch[8]; });
        }