public void TestGetBytes()
 {
     var vector = new BitVector(7);
     Assert.AreEqual(1, vector.Bytes.Length);
     vector = new BitVector(8);
     Assert.AreEqual(2, vector.Bytes.Length);
 }
 public void TestEquals()
 {
     var expected = new BitVector(new byte[] { 0xf0 });
     var actual = new BitVector(7);
     actual.set_Renamed(0);
     actual.set_Renamed(1);
     actual.set_Renamed(2);
     Assert.AreEqual(expected, actual);
 }
        public void TestGetTruncatedBytes()
        {
            var vector = new BitVector(new byte[] { 0x00, 0x00 });
            Assert.IsTrue(vector.Overlong);
            TestUtil.AssertByteArrayEquals(new byte[] { 0x80 } ,
                vector.TruncatedBytes);

            vector = new BitVector(new byte[] { 0x00 });
            Assert.IsFalse(vector.Overlong);
            TestUtil.AssertByteArrayEquals(new byte[] { 0x80 },
                vector.TruncatedBytes);

            vector = new BitVector(new byte[] { 0x60, 0x00, 0x04, 0x00 });
            Assert.IsTrue(vector.Overlong);
            TestUtil.AssertByteArrayEquals(new byte[] { 0x60, 0x00, 0x84 },
                vector.TruncatedBytes);
        }
 internal NullBitVectorReader(BitVector vector)
     : base(vector)
 {
 }
Example #5
0
        public bool Equals(BitVector other)
        {
            if (other.size != size)
            {
                return false;
            }

            for (int i = 0; i < bytes.Length; i++)
            {
                if (bytes[i] != other.bytes[i])
                {
                    return false;
                }
            }

            return true;
        }
Example #6
0
 public void SetBitVector(int fieldIndex, BitVector vector)
 {
     _values[fieldIndex] = new BitVectorValue(vector);
 }
 public BitVectorValue(BitVector value_Renamed)
 {
     this.value_Renamed = value_Renamed;
 }
 public void TestIsSet()
 {
     var vector = new BitVector(7);
     Assert.IsFalse(vector.IsSet(1));
     vector.set_Renamed(1);
     Assert.IsTrue(vector.IsSet(1));
     Assert.IsFalse(vector.IsSet(6));
     vector.set_Renamed(6);
     Assert.IsTrue(vector.IsSet(6));
     Assert.IsFalse(vector.IsSet(7));
     Assert.IsFalse(vector.IsSet(8));
 }
 public void TestIndexLastSet()
 {
     var bv = new BitVector(new byte[] { 0x70, 0x00, 0x04 });
     Assert.AreEqual(18, bv.IndexOfLastSet());
 }
Example #10
0
 public BitVectorValue(BitVector value_Renamed)
 {
     this.value_Renamed = value_Renamed;
 }
 public void TestSetWithOneByte()
 {
     var vector = new BitVector(7);
     vector.set_Renamed(0);
     TestUtil.AssertBitVectorEquals("11000000", vector.Bytes);
     vector.set_Renamed(3);
     TestUtil.AssertBitVectorEquals("11001000", vector.Bytes);
     vector.set_Renamed(6);
     TestUtil.AssertBitVectorEquals("11001001", vector.Bytes);
 }
 public void TestSetWithMultipleBytes()
 {
     var vector = new BitVector(15);
     vector.set_Renamed(0);
     TestUtil.AssertBitVectorEquals("01000000 00000000 10000000",
         vector.Bytes);
     vector.set_Renamed(4);
     TestUtil.AssertBitVectorEquals("01000100 00000000 10000000",
         vector.Bytes);
     vector.set_Renamed(9);
     TestUtil.AssertBitVectorEquals("01000100 00010000 10000000",
         vector.Bytes);
     vector.set_Renamed(14);
     TestUtil.AssertBitVectorEquals("01000100 00010000 11000000",
         vector.Bytes);
 }
Example #13
0
 public virtual void  SetBitVector(int fieldIndex, BitVector vector)
 {
     values[fieldIndex] = new BitVectorValue(vector);
 }
 public BitVectorBuilder(int size)
 {
     vector = new BitVector(size);
 }
 public BitVectorReader(BitVector vector)
 {
     _vector = vector;
 }
 internal InfiniteBitVectorReader(BitVector vector)
     : base(vector)
 {
 }
Example #17
0
 public BitVectorBuilder(int size)
 {
     vector = new BitVector(size);
 }