Exemple #1
0
        public static Node Decode(this BitArray b)
        {
            bool innerNode = !b[0];

            BitArray weight = new BitArray(55);

            weight.Copy(b, 1, 55);
            ulong value = weight.ToUlong();

            BitArray character = new BitArray(8);

            character.Copy(b, 56, 63);
            byte key = character.GetByteArray()[0];

            return(new Node(key, value, innerNode));
        }
Exemple #2
0
        public void CopyTest()
        {
            // Arrange
            var input = new BitArray(128);

            for (int i = 0; i < input.Length; i++)
            {
                input[i] = true;
            }

            // Act
            var copy = input.Copy();

            // Assert
            Assert.AreEqual(128, copy.Length);
            foreach (bool bit in copy)
            {
                Assert.IsTrue(bit);
            }
        }