Example #1
0
 public void TestByteHexLEConsistency()
 {
     Assert.AreEqual(BitString.FromHexLE("616263").Bits(), BitString.FromBytesLE(new byte[] { 0x61, 0x62, 0x63 }).Bits(), "LE hex-bytes conversion is incosistent");
 }
Example #2
0
        public void TestHexLEKnownVectors()
        {
            Assert.AreEqual(new bool[] { false, true, false, true, false, false, false, true }, BitString.FromHexLE("8A").Bits(), "BS From hex string failed");
            Assert.AreEqual(new bool[] { false, true, false, true, false, false, false, true, false, false, false, false, true, true, true, true }, BitString.FromHexLE("8AF0").Bits(), "BS From hex string failed");
            Assert.AreEqual(new bool[] { false, false, false, false, true, true, true, true }, BitString.FromHexLE("F0").Bits(), "BS From hex string failed");

            Assert.AreEqual("E5", new BitString(new bool[] { true, false, true, false, false, true, true, true }).ToHexLE(), "BS to Hex string failed");
            Assert.AreEqual("D4", new BitString(new bool[] { false, false, true, false, true, false, true, true }).ToHexLE(), "BS to Hex string failed");
            Assert.AreEqual("E5D4", new BitString(new bool[] { true, false, true, false, false, true, true, true, false, false, true, false, true, false, true, true }).ToHexLE(), "BS to Hex sstring failed");
        }