Пример #1
0
 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);
 }
Пример #2
0
 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));
 }
Пример #3
0
 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);
 }
Пример #4
0
 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);
 }