Example #1
0
        public static void Get_InvalidIndex_ThrowsArgumentOutOfRangeException()
        {
            WireReadyBitArray bitArray = new WireReadyBitArray(16);

            Assert.Throws <ArgumentOutOfRangeException>(() => bitArray.Get(-1));
            Assert.Throws <ArgumentOutOfRangeException>(() => bitArray.Get(bitArray.Length));

            Assert.Throws <ArgumentOutOfRangeException>(() =>
            {
                var l = bitArray[-1];
            });
            Assert.Throws <ArgumentOutOfRangeException>(() =>
            {
                var l = bitArray[bitArray.Length];
            });
        }
Example #2
0
        public static void SetAll(int size, bool defaultValue)
        {
            WireReadyBitArray WireReadyBitArray = new WireReadyBitArray(size, defaultValue);

            WireReadyBitArray.SetAll(!defaultValue);
            for (int i = 0; i < WireReadyBitArray.Length; i++)
            {
                Assert.AreEqual(!defaultValue, WireReadyBitArray[i]);
                Assert.AreEqual(!defaultValue, WireReadyBitArray.Get(i));
            }

            WireReadyBitArray.SetAll(defaultValue);
            for (int i = 0; i < WireReadyBitArray.Length; i++)
            {
                Assert.AreEqual(defaultValue, WireReadyBitArray[i]);
                Assert.AreEqual(defaultValue, WireReadyBitArray.Get(i));
            }
        }
Example #3
0
        public static void Get_Set(bool def, bool[] newValues)
        {
            WireReadyBitArray WireReadyBitArray = new WireReadyBitArray(newValues.Length, def);

            for (int i = 0; i < newValues.Length; i++)
            {
                WireReadyBitArray.Set(i, newValues[i]);
                Assert.AreEqual(newValues[i], WireReadyBitArray[i]);
                Assert.AreEqual(newValues[i], WireReadyBitArray.Get(i));
            }
        }