示例#1
0
        public void ShouldPassThroughRlewBytesWithNoMarker()
        {
            var input    = Enumerable.Repeat <byte>(0xFF, 40).ToArray();
            var expanded = Expander.DecompressRlew(0xABCD, input, input.Length);

            expanded.Should().BeEquivalentTo(input, "array should not have been mutated");
        }
示例#2
0
        public void ShouldExpandRlewWithAppendix()
        {
            var input    = new byte[] { 0xCD, 0xAB, 0x08, 0x00, 0xFF, 0xFF, 0x1A, 0x2B };
            var expected = Enumerable.Repeat <byte>(0xFF, 16).Concat(new byte[] { 0x1A, 0x2B }).ToArray();
            var expanded = Expander.DecompressRlew(0xABCD, input, expected.Length);

            expanded.Should().BeEquivalentTo(expected, "array should have been expanded");
        }
示例#3
0
        public void ShouldExpandASimpleRlewSubstitution()
        {
            var input    = new byte[] { 0xCD, 0xAB, 0x08, 0x00, 0xFF, 0xFF };
            var expected = Enumerable.Repeat <byte>(0xFF, 16).ToArray();
            var expanded = Expander.DecompressRlew(0xABCD, input, expected.Length);

            expanded.Should().BeEquivalentTo(expected, "array should have been expanded");
        }
示例#4
0
        public void ShouldExpandMultipleRlewSections()
        {
            var input    = new byte[] { 0x55, 0x66, 0xCD, 0xAB, 0x08, 0x00, 0xFF, 0xFF, 0x1A, 0x2B, 0xCD, 0xAB, 0x04, 0x00, 0x11, 0x22, 0x33, 0x44 };
            var expected =
                new byte[] { 0x55, 0x66 }.
            Concat(Repeat(new byte[] { 0xFF, 0xFF }, 8)).
            Concat(new byte[] { 0x1A, 0x2B }).
            Concat(Repeat(new byte[] { 0x11, 0x22 }, 4)).
            Concat(new byte[] { 0x33, 0x44 }).ToArray();

            var expanded = Expander.DecompressRlew(0xABCD, input, expected.Length);

            expanded.Should().BeEquivalentTo(expected, "array should have been expanded");
        }