private void AssertBits(Bit[] bitsToDecode, Bit[] expectedValues)
        {
            var bitStream = new BitStream(bitsToDecode);

            var decoder = new ConvolutionalDecoder();

            var result = decoder.Decode(bitStream);

            var expectedStream = new BitStream(expectedValues);

            Assert.True((BitStream)result == expectedStream);
        }
Exemple #2
0
        /// <summary>
        /// Decodes a given encoded vector
        /// </summary>
        /// <param name="encodedVector">Encoded vector to decode</param>
        /// <param name="decoder">Decoder to decode a vector</param>
        /// <returns>A <see cref="StringResult"/> that contains a decoded vector as Result property</returns>
        public static async Task <StringResult> DecodeVector(string encodedVector, ConvolutionalDecoder decoder)
        {
            var bitStream = vectorConverter.ToBitStream(encodedVector);

            var result = await Task.FromResult(decoder.Decode(bitStream));

            var decodedVector = vectorConverter.FromBitStream(result);

            return(new StringResult
            {
                Errors = 0,
                Result = decodedVector
            });
        }