Exemplo n.º 1
0
 public void Test1AddAll()
 {
     BitTuple bt = new BitTuple(bits);
     bt.AddAll(bits);
     Assert.AreEqual(2 * bits.Length, bt.Length);
     for (int i = 0; i < bt.Length; i++) { Assert.AreEqual(bits[i % bits.Length], bt[i]); }
 }
Exemplo n.º 2
0
        public void TestToBitArray()
        {
            BitTuple bt = new BitTuple(0);
            bt.AddAll(bits);
            Assert.AreEqual(bits.Length, bt.Length);
            for (int i = 0; i < bits.Length; i++) { Assert.AreEqual(bits[i], bt[i]); }

            BitArray t = bt.ToBitArray();
            for (int i = 0; i < bits.Length; i++) { Assert.AreEqual(bt[i], t[i]); }

            t = new BitArray(bt.ToArray());
            for (int i = 0; i < bits.Length; i++) { Assert.AreEqual(bt[i], t[i]); }

            t = new BitArray(bits);
            bt = new BitTuple(t);
            for (int i = 0; i < bits.Length; i++) { Assert.AreEqual(bt[i], t[i]); }
        }