Пример #1
0
 private static void roundTrip(HuffmanEncoder encoder, HuffmanDecoder decoder, byte[] buf)
 {
     using(var baos = new MemoryStream()) {
         using(var dos = new BinaryWriter(baos)) {
             encoder.Encode(dos, buf);
             var actualBytes = decoder.Decode(baos.ToArray());
             Assert.IsTrue(buf.SequenceEqual(actualBytes));
         }
     }
 }
Пример #2
0
 private static void roundTrip(HuffmanEncoder encoder, HuffmanDecoder decoder, string s)
 {
     roundTrip(encoder, decoder, Encoding.UTF8.GetBytes(s));
 }