Пример #1
0
 public void LittleEndian0xFE()
 {
     byte b = 0xFE;
     Bytes bytes = new Bytes();
     bytes.Append(b);
     bool[] bits = bytes.GetBits().Values;
     Assert.AreEqual(8, bits.Length, "Bits length");
     Assert.IsFalse(bits[0], "Bit 0 value");
     for (int i = 1; i < 8; i++)
         Assert.IsTrue(bits[i], string.Format("Bit {0} value", i));
 }
Пример #2
0
 public void LittleEndian0x0101()
 {
     byte[] bs = new byte[] { 0x01, 0x01 };
     Bytes bytes = new Bytes();
     bytes.Append(bs);
     bool[] bits = bytes.GetBits().Values;
     Assert.AreEqual(16, bits.Length, "Bits length");
     Assert.IsTrue(bits[0], "Bit 0 value");
     Assert.IsTrue(bits[8], "Bit 8 value");
     for (int i = 1; i < 8; i++)
         Assert.IsFalse(bits[i], string.Format("Bit {0} value", i));
     for (int i = 9; i < 16; i++)
         Assert.IsFalse(bits[i], string.Format("Bit {0} value", i));
 }